Hi,
The C code that I use with SQLite is pretty well tested and
known to work well so far, but I've ran into some documentation
which leads me to suspect there is a problem with my existing
code, or a problem with the documentation.
>From the documentation: http://www.sqlite.org/c3ref/step.html
"SQLITE_BUSY means that the database engine was unable to acquire the
database locks it needs to do its job. If the statement is a COMMIT
or occurs outside of an explicit transaction, then you can retry the
statement. If the statement is not a COMMIT and occurs within an
explicit transaction then you should rollback the transaction before
continuing."
This last sentence is disconcerting, what I've done to simplify my
code is have a common function through which all statements are
executed, ... while executing a statement, usually with sqlite3_exec(),
I test for SQLITE_BUSY and run a retry loop there.
Since I run all of these statements withing transactions (between
"BEGIN" statements and "COMMIT" / "ROLLBACK" statements"), my
expectation is that SQLITE_BUSY will only ever be returned for
the leading "BEGIN" statement.
Now that I've started converting some of the code (just the
deletes/inserts) to use prepared statements, I've run into
the above, worrisome documentation.
If my prepared statements are always run after "BEGIN" and
before "COMMIT" or "ROLLBACK", is there any way that
SQLITE_BUSY can be returned ?
>From the documentation, it looks as though I should be writing
much more paranoid code, i.e. I should be checking for SQLITE_BUSY
at *any* point within the transaction and, if it occurs I should
rollback the whole transaction and try again from the beginning.
Is that the case ?
Thanks for your input.
Kind Regards,
-Tristan
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users