Hi, 

what I do not really understand is why the statement in step (3) is allowed to 
read the database at all and not aborts by a SQLITE_BUSY error. The transaction 
in step (2) is modifying the database, in my case the statement is creating the 
database. But assume that step (2) is modifying it only, so step (3) - that 
tries to read the database during modification - is potentially incorrect 
anyway. 

Nevertheless, it is probably just a misinterpretation of the error messages 
from my side.

Regards,
Hardy

> Am 2019-10-31 um 01:53 schrieb Keith Medcalf <kmedc...@dessus.com>:
> 
> 
> On Wednesday, 30 October, 2019 16:33, mailing lists <mailingli...@skywind.eu> 
> wrote:
> 
>> I face the following issue:
> 
>> 1) SQLite has been compiled with SQLITE_THREADSAFE=1 and
>> SQLITE_DEFAULT_SYNCHRONOUS=3
>> 2) I am opening in a thread a new database (standard journal mode) and
>> creating some tables, indices etc. (explicit transaction)
>> 3) while creating the database a new database connection (read only) is
>> established in another thread that tries to get some data by a prepared
>> statement.
> 
>> 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.
> 
> That is because your SQL statement has an error.  By the sounds of it the 
> table(s) you are trying to query do not exist because you have not yet 
> committed the transaction which is creating them.  
> 
> Key hints "new database" (contains nothing), creating tables etc in an 
> explicit transaction, and while creating the database ... preparing a 
> statement that reads the database fails with an error.
> 
>> 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?
> 
> Yes.
> 
> -- 
> The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
> lot about anticipated traffic volume.
> 
> 
> 
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to