Final Class Yiisoft\Db\Sqlite\Transaction
| Inheritance | Yiisoft\Db\Sqlite\Transaction » Yiisoft\Db\Driver\Pdo\AbstractPdoTransaction |
|---|
Implements the SQLite Server specific transaction.
Protected Methods
| Method | Description | Defined By |
|---|---|---|
| setTransactionIsolationLevel() | Sets the isolation level of the current transaction. | Yiisoft\Db\Sqlite\Transaction |
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 | \Yiisoft\Db\Exception\Exception | |
|---|---|---|
| throws | \Yiisoft\Db\Exception\InvalidConfigException | |
| throws | \Yiisoft\Db\Exception\NotSupportedException | |
| 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.',
),
};
}
Signup or Login in order to comment.