Home » U++ Library support » U++ SQL » SQlite file locking - again help needed
SQlite file locking - again help needed [message #33466] |
Wed, 10 August 2011 10:01  |
papascalientes
Messages: 5 Registered: February 2011
|
Promising Member |
|
|
Could someone perhaps give me an example of how to handle file locking situations when writing to an SQlite database in an application that is running on a network? I have to use SQlite databases and everything I tried (thank you Mirek for your earlier help) didn't work the way I wanted.
The basic code I use without handling file locking looks like this example for a write operation on an already existing sqlite database Z.db3 with a table named ZTABLE:
******* begin code example ********************************
Sqlite3Session z_sql3;
if(!z_sql3.Open(z.db3))
throw Exc("Can't create or open database file: Z.db3");
Sql sqlz(z_sql3);
z_sql3.Begin();
cInsertstring="INSERT INTO ZTABLE VALUES("firtst nametest, last nametest")"; // using testvariables
sqlz.ClearError();
sqlz.Execute(cInsertstring);
z_sql3.Commit();
z_sql3.Close();
*************** end of example **********************************
How and where can I check, whether the database is locked (SQL_BUSY error) and if it is locked, retry to write 5 times?
And (where) do I have to use a ROLLBACK? I am not quite sure in which cases a rollback is done automatically by sqlite.
|
|
|
Goto Forum:
Current Time: Tue May 13 10:47:30 CEST 2025
Total time taken to generate the page: 0.02208 seconds
|