DROP TABLE while a cursor is open leads to SQLITE_LOCKED

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

DROP TABLE while a cursor is open leads to SQLITE_LOCKED

Jürgen Baier
Hi,

I'm using the Xerial JDBC driver for accessing SQLite.

I have the problem that it is not possible to drop a table in the same
database connection while a resultset is open:

0. Preparation: Create table t1 and add some values

1. Open connection
2. Create temporary table tmp1
3. Execute SELECT statement on t1 (SELECT * FROM t1).
4. Execute DROP TABLE tmp1 while still iterating over the result of 3.

=> [SQLITE_LOCKED]  A table in the database is locked (database table is
locked)

Note that all this happens in a single thread.

Someone of the Xerial community pointed me to

https://www2.sqlite.org/cvstrac/wiki?p=DatabaseIsLocked

It seems while a resultset is open it also was not possible in earlier
SQLite versions to CREATE a table, but this restriction has been fixed
in the meantime.

Is it planned to fix this for DROP TABLE too? Or is there some workaround?

Thanks,

Jürgen



_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users