Sets the isolation level of the current transaction.
public setTransactionIsolationLevel ( string $level ) | ||
$level | string | The transaction isolation level to use for this transaction. This can be one of [[Transaction::READ_UNCOMMITTED]], [[Transaction::READ_COMMITTED]], [[Transaction::REPEATABLE_READ]] and [[Transaction::SERIALIZABLE]] but also a string containing DBMS specific syntax to be used after `SET TRANSACTION ISOLATION LEVEL`. |
/** * @inheritdoc * @see http://www.cubrid.org/manual/91/en/sql/transaction.html#database-concurrency */ public function setTransactionIsolationLevel($level) { // translate SQL92 levels to CUBRID levels: switch ($level) { case Transaction::SERIALIZABLE: $level = '6'; // SERIALIZABLE break; case Transaction::REPEATABLE_READ: $level = '5'; // REPEATABLE READ CLASS with REPEATABLE READ INSTANCES break; case Transaction::READ_COMMITTED: $level = '4'; // REPEATABLE READ CLASS with READ COMMITTED INSTANCES break; case Transaction::READ_UNCOMMITTED: $level = '3'; // REPEATABLE READ CLASS with READ UNCOMMITTED INSTANCES break; } parent::setTransactionIsolationLevel($level); }
/** * Sets the isolation level of the current transaction. * @param string $level The transaction isolation level to use for this transaction. * This can be one of [[Transaction::READ_UNCOMMITTED]], [[Transaction::READ_COMMITTED]], [[Transaction::REPEATABLE_READ]] * and [[Transaction::SERIALIZABLE]] but also a string containing DBMS specific syntax to be used * after `SET TRANSACTION ISOLATION LEVEL`. * @see http://en.wikipedia.org/wiki/Isolation_%28database_systems%29#Isolation_levels */ public function setTransactionIsolationLevel($level) { if ($level == \yii\db\Transaction::READ_UNCOMMITTED) { parent::setTransactionIsolationLevel('READ COMMITTED RECORD_VERSION'); } elseif ($level == \yii\db\Transaction::REPEATABLE_READ) { parent::setTransactionIsolationLevel('SNAPSHOT'); } elseif ($level == \yii\db\Transaction::SERIALIZABLE) { parent::setTransactionIsolationLevel('SNAPSHOT TABLE STABILITY'); } else { parent::setTransactionIsolationLevel($level); } }