samedi 18 avril 2015

performing a unique transaction in sqlite3 php

i have an sqlite3 database accessed using php,to which users insert and update rows simultaneously(multi-threaded). In order to avoid data corruption(and inaccurate results resulted from multiple connections and changes to the same row at the same time),i read about sqlite's unique transaction(http://ift.tt/XV8FHa). however,i am not sure if i implimented it properly.i am using phppdo.



$conn->beginTransaction();
$conn->exec("BEGIN EXCLUSIVE TRANSACTION");
//
//..a few insert and update queries

$db.commit();


as i understand it,a transaction is in the DEFFERED state by default. My question is - does the code i enclosed actually convert/create an exclusive transaction, and in case it does not - how do i accomplish that?


Thanks,


Aucun commentaire:

Enregistrer un commentaire