Question: Under what circumstances can a table be locked when the database
is first opened?

My program does:

DROP TABLE IF EXISTS
CREATE TABLE
INSERT INTO (multiple times)
SELECT * (for each row)

Run it once and it works perfectly. Run it twice and the DROP TABLE triggers
the error:

SQLITE_LOCKED, database table is locked

Delete the database and run it again and it works. Just once.

Nothing in the documentation tells me how a table can be locked when the
database is first opened. I'm using the raw C interface on Windows, so what
can I be doing wrong?

The code is actually written in C#, but uses Interop to call the C API
directly. The database open code looks like this. No open flags are used.

LastResult = (Result)sqlite3_open(path, out _dbhandle);

Regards
David M Bennett FACS

Andl - A New Data Language - andl.org


Reply via email to