The second error problem is due to the first.
 Another process has begun a transaction Prior to you running the commit. /End 
transaction. At this point you have no choice but to rollback and re run the 
loop.

A Proper fix might include changing the begin transaction to a "begin 
immediate",  Then Either The begin will either fail and not be able to start a 
TXN. Or it will succeed.. If it fails simply wait a while and retry.

I would not follow the other posters advice regarding finalize. You want to use 
sqlite3_reset on all of the prepared statements. Before you close the database 
you should finalize or if your unlikely to need the statement in a while then 
finalize. 

HTH
Ken


--- On Wed, 10/8/08, Manoj Marathayil <[EMAIL PROTECTED]> wrote:
From: Manoj Marathayil <[EMAIL PROTECTED]>
Subject: [sqlite] END TRANSACTION failed with "database is locked"
To: [email protected]
Date: Wednesday, October 8, 2008, 8:50 AM

Hi,
I am executing some operations in a loop and all the operations are wrapped
inside a transaction. During one iteration the "END TRANSACTION"
returned
with an error "database is locked". Since this is in a loop my next
request
to "BEGIN TRASACTION" failed with "cannot start a transaction
within a
transaction". What is the normal way to get rid of this situation? Is it
right to check the status with "sqlite3_get_autocommit" and issue a
"ROLLBACK TRASACTION" if it inside a transaction before issuing
BEGIN?

Regards,
Manoj
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to