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 next 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.
Re: SQlite file locking - again help needed [message #33477 is a reply to message #33466] Thu, 11 August 2011 14:34 Go to previous messageGo to next message
BioBytes is currently offline  BioBytes
Messages: 307
Registered: October 2008
Location: France
Senior Member
Hi papascalientes,

Have you reviewed this link ?

http://www.sqlite.org/lang_transaction.html

Regards

Biobytes
Re: SQlite file locking - again help needed [message #33576 is a reply to message #33477] Thu, 25 August 2011 16:03 Go to previous message
papascalientes is currently offline  papascalientes
Messages: 5
Registered: February 2011
Promising Member
Hi Biobytes,

thank you for your response. But of course I have read the page about lang_transaction on sqlite.org - and everything else that could possibly have a connection to file locking on their website and in their user mailinglist. And I googled for more information. After not being successful with everything I tried, I finally asked, if someone could provide me with an example here.

Regards,
papascalientes
Previous Topic: question on schema file.. (Sqlite3)
Next Topic: SqlArray and updating new database data
Goto Forum:
  


Current Time: Sat Apr 20 14:14:37 CEST 2024

Total time taken to generate the page: 0.05095 seconds