[EMAIL PROTECTED] wrote:
> "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]>
>
>
>   
Could this be cause by one thread opening a transaction, then a second
on a second connection trying to open a transaction on it, and failing
to open the transaction file (as it already exists?). Could this be
solved by per connection transaction journals, or maybe by blocking? One
problem I did see with all this, is that once this error occurs, there
are cascading failures (possibly because transaction left open due to
failure to commit or some other reason).

-- 
Bill King, Software Engineer
Trolltech, Brisbane Technology Park
26 Brandl St, Eight Mile Plains, 
QLD, Australia, 4113
Tel + 61 7 3219 9906 (x137)
Fax + 61 7 3219 9938
mobile: 0423 532 733

Reply via email to