setTransactionIsolationLevel() 공개 메소드

Sets the isolation level of the current transaction.
또한 보기: http://en.wikipedia.org/wiki/Isolation_%28database_systems%29#Isolation_levels
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`.
예제 #1
0
파일: Schema.php 프로젝트: yiisoft/yii2
 /**
  * @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);
 }
예제 #2
0
 /**
  * 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);
     }
 }