2016-07-26 8 views
2

I持つデータベース接続要素とYiiの初期設定配列:設定分離レベルグローバル

'components'=>array(
     ...... 
     'db'=>array(
      'connectionString' => 'mysql:host=localhost;dbname=blog', 
      'emulatePrepare' => true, 
      'username' => 'root', 
      'password' => '', 
      'charset' => 'utf8', 
      'tablePrefix' => 'tbl_', 
     ), 
    ) 

それはアプリケーション全体に対してグローバルに同じようにトランザクション分離レベルで設定することは可能ですか? 'DB' =>配列に

'initSQLs' => array('SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;'), 

を追加

+0

データベースをロックするには? –

+0

@eskimoトランザクションの分離レベルについては、https://en.wikipedia.org/wiki/Isolation_(database_systems) – Andremoniy

+0

こちらからご覧いただけます。http://www.yiiframework.com/doc-2.0/guide-db -dao.html#performing-transactions – Andremoniy

答えて

1

してみてください。

SERIALIZABLEは、必要なトランザクション分離レベルに変更できます。

関連する問題