On 30 Oct 2019, at 10:33pm, mailing lists <mailingli...@skywind.eu> wrote:

> In this second thread (step (3)) I get an SQLITE_ERROR in sqlite3_prepare. I 
> actually expected an SQLITE_BUSY error. Remark: as step (2) is a transaction 
> no tables exist when step (3) starts execution.
> 
> Is my understanding correct that I only get an SQLITE_BUSY error when 
> actually trying to run a query? In all other cases I should get different 
> error codes, or?

I cannot immediately solve your problem, but here are some things you didn't 
mention which might help.

Did you test it to see that if the other program (the one which writes) isn't 
running you don't get the error ?

SQLite has two locking errors: SQLITE_BUSY and SQLITE_LOCKED.

In order to prepare a statement, SQLite has to read the database.  It does this 
because preparing a statement requires it to know the layout of the table and 
which indexes are available.  If another connection has the database locked, 
SQLite cannot do this.

When you tell SQLite to open a database it does not do it.  It reads in the 
schema (structures of tables and indexes) only when you do the first thing that 
needs them.  So if you're writing a small test program, it might not be doing 
things when you expect it to.

If you are doing this as a test, that's fine.  If you are writing software for 
production use, then both programs should be setting a timeout of at least a 
few seconds:

<https://sqlite.org/c3ref/busy_timeout.html>
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to