class MySQLTransactionManager implements TransactionManager (View source)

TransactionManager that executes MySQL-compatible transaction control queries

Properties

protected $dbConn
protected $inTransaction

Methods

public
__construct(Database $dbConn)

No description

public
bool
transactionStart(string|bool $transactionMode = false, string|bool $sessionCharacteristics = false)

Start a prepared transaction

public
bool
transactionEnd($chain = false)

Complete a transaction

public
bool
transactionRollback(string $savepoint = null)

Roll-back a transaction

public
transactionSavepoint(string $savepoint)

Create a new savepoint

public
int
transactionDepth()

Return the depth of the transaction For unnested transactions returns 1 while in a transaction, 0 otherwise

public
bool
supportsSavepoints()

Return true if savepoints are supported by this transaction manager.

Details

__construct(Database $dbConn)

No description

Parameters

Database $dbConn

bool transactionStart(string|bool $transactionMode = false, string|bool $sessionCharacteristics = false)

Start a prepared transaction

Parameters

string|bool $transactionMode

Transaction mode, or false to ignore. Deprecated and will be removed in SS5.

string|bool $sessionCharacteristics

Session characteristics, or false to ignore. Deprecated and will be removed in SS5.

Return Value

bool

True on success

Exceptions

DatabaseException

bool transactionEnd($chain = false)

Complete a transaction

Parameters

$chain

Return Value

bool

True on success

Exceptions

DatabaseException

bool transactionRollback(string $savepoint = null)

Roll-back a transaction

Parameters

string $savepoint

If set, roll-back to the named savepoint

Return Value

bool

True on success

Exceptions

DatabaseException

transactionSavepoint(string $savepoint)

Create a new savepoint

Parameters

string $savepoint

The savepoint name

Exceptions

DatabaseException

int transactionDepth()

Return the depth of the transaction For unnested transactions returns 1 while in a transaction, 0 otherwise

Return Value

int

bool supportsSavepoints()

Return true if savepoints are supported by this transaction manager.

Savepoints aren't supported by all database connectors (notably PDO doesn't support them) and should be used with caution.

Return Value

bool