Final Class Yiisoft\Db\Sqlite\Transaction
| Inheritance | Yiisoft\ |
|---|
Implements the SQLite Server specific transaction.
Protected Methods
| Method | Description | Defined By |
|---|---|---|
| setTransactionIsolationLevel() | Sets the isolation level of the current transaction. | Yiisoft\ |
Method Details
Sets the isolation level of the current transaction.
See also:
- \
Yiisoft\ Db\ Transaction\ TransactionInterface::READ_UNCOMMITTED - \
Yiisoft\ Db\ Transaction\ TransactionInterface::SERIALIZABLE
| protected void setTransactionIsolationLevel ( string $level ) | ||
| $level | string |
The transaction isolation level to use for this transaction. |
| throws | \ |
|
|---|---|---|
| throws | \ |
|
| throws | \ |
|
| throws | Throwable |
When unsupported isolation levels are used. SQLite only supports |
protected function setTransactionIsolationLevel(string $level): void
{
match ($level) {
self::SERIALIZABLE => $this->db->createCommand('PRAGMA read_uncommitted = False;')->execute(),
self::READ_UNCOMMITTED => $this->db->createCommand('PRAGMA read_uncommitted = True;')->execute(),
default => throw new NotSupportedException(
self::class . ' only supports transaction isolation levels READ UNCOMMITTED and SERIALIZABLE.',
),
};
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.