"Jiri Hajek" <[EMAIL PROTECTED]> wrote:
> 
> 1. Occasionally after running Sqlite3_step() I get SQLITE_CANTOPEN ('Unable
> to open the database file') error. I found out that it can be fixed by
> running the query again, i.e. again calling Sqlite3_Prepare(). So this isn't
> a big issue, but still I wonder why this error message is returned?
> Shouldn't SQLITE_BUSY or SQLITE_LOCKED be returned instead?

This happens when CreateFileW() fails.  In some cases, it retries
a few times before giving up.  I think SQLITE_CANTOPEN is more
specific (and thus a better error) than SQLITE_BUSY or SQLITE_LOCKED
which can happen for a variety of reasons.

> 
> 2. More serious issue is that after I enable transaction usage (not used in
> 1.) sometimes (again, it's random) after calling 'BEGIN TRANSACTION' I get
> an error SQLITE_ERROR ('cannot start a transaction within a transaction').
> Problem is that I definitely am not already in a transaction. The only
> reason for this seems to be that there's >1 thread running, with only 1
> thread running there's no problem.
> 

The code that generates the 'cannot start a transaction within a
transactoin' message is very simple.  There is not much to go wrong.
I'm thinking that the either (1) some other thread is doing a "BEGIN" 
on the same database connection before the current thread gets around 
to it, or (2) the previous "COMMIT" or "ROLLBACK" ended the prior 
transaction did not run to completion.  In either case, you are in
an active transaction and the error message is telling you the truth.

If you have additional evidence of problems in SQLite, I will be
glad to listen to it.  But based on what I see above, I think this
is mostly likely a bug in your application, not in SQLite.

--
D. Richard Hipp   <[EMAIL PROTECTED]>

Reply via email to