Transaction Management

Hi all and as this is my first post, I hope to be as practical as possible…

I am designing an b2b bidding platform, I have been happily using yii and now the site is close to going live. For the development phase I have used sqlite, but entering the go-live phase I am wondering about transactions.

I have read extensively the sqlite docs and books available and have found that it is possible to use BEGIN EXCLUSIVE/IMMEDIATE TRANSACTION in order to control more safely the writes to the db.

However in the Yii docs I find no reference to such an option. In fact in the definitive guide to yii, there is some reference to the topic of transaction but nothing as specific as defining the transaction. Also the yii api tells me there is nothing under CDbConnection or CDbTransaction


$transaction=$connection->beginTransaction();

try

{

    $connection->createCommand($sql1)->execute();

    $connection->createCommand($sql2)->execute();

    //.... other SQL executions

    $transaction->commit();

}

catch(Exception $e) // an exception is raised if a query fails

{

    $transaction->rollback();

}

I figure that in SQLITE case the $connection->beginTransaction(); statement will create a DEFERRED transaction as this is the default for SQLITE

checking the PDO reference also there is nothing there:

My intuition tells me

1- I am missing the point big time OR

2- I have to achieve this via the


$connection->createCommand($sql1)->execute();

and pass the "BEGIN EXCLUSIVE TRANSACTION" there

3- I have not found any setup to pass to the SQLITE config in config.php that would allow me to override the DEFERRED default transaction mode (for writes…)

4- I have to do this with my sqlite db structure (there is a flag for this PRAGMA locking_mode)

Thanks all for your precious help and collaboration

Emmanuel

PS: I originally included all links but as this is my first post, I cant do that :D :D