Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
moodle_transaction Class Reference

Delegated transaction class. More...

Public Member Functions

 __construct ($database)
 Delegated transaction constructor, can be called only from moodle_database class.
 
 allow_commit ()
 Commit delegated transaction.
 
 dispose ()
 Mark transaction as disposed, no more commits and rollbacks allowed.
 
 get_backtrace ()
 Returns backtrace of the code starting exception.
 
 is_disposed ()
 Is the delegated transaction already used?
 
 rollback ($e)
 Rollback all current delegated transactions.
 

Detailed Description

Delegated transaction class.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

moodle_transaction::__construct ( $database)

Delegated transaction constructor, can be called only from moodle_database class.

Unfortunately PHP's protected keyword is useless.

Parameters
moodle_database$database

Member Function Documentation

◆ allow_commit()

moodle_transaction::allow_commit ( )

Commit delegated transaction.

The real database commit SQL is executed only after committing all delegated transactions.

Incorrect order of nested commits or rollback at any level is resulting in rollback of SQL transaction.

Return values
void

◆ dispose()

moodle_transaction::dispose ( )

Mark transaction as disposed, no more commits and rollbacks allowed.

To be used only from moodle_database class

Return values
null

◆ get_backtrace()

moodle_transaction::get_backtrace ( )

Returns backtrace of the code starting exception.

Return values
array

◆ is_disposed()

moodle_transaction::is_disposed ( )

Is the delegated transaction already used?

Return values
booltrue if commit and rollback allowed, false if already done

◆ rollback()

moodle_transaction::rollback ( $e)

Rollback all current delegated transactions.

Parameters
Exception | Throwable$emandatory exception/throwable
Return values
void

The documentation for this class was generated from the following file: