Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous message
papascalientes is currently offline  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.
 
Read Message
Read Message
Read Message
Previous Topic: question on schema file.. (Sqlite3)
Next Topic: SqlArray and updating new database data
Goto Forum:
  


Current Time: Sat May 04 06:07:04 CEST 2024

Total time taken to generate the page: 0.02786 seconds