Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | List of all members
moodle_transaction Class Reference

Delegated transaction class. More...

Public Member Functions

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

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: