So, would this problem still exist if the code were to open two 'connections' to the database, issue the SELECT on one open connection and then issue the CREATE TABLE via the other open connection?

Does this in any way prevent an application from opening a single connection, issuing a SELECT, and in the callback handling each of the rows from the SELECT have the code issue another SELECT and have a second callback handle the results from that query?

-ken

On 8-Apr-05, at 2:46 PM, Jay Sprenkle wrote:


select_stmt = db.execute("SELECT * FROM people") # use some, but not all of the rows in select_stmt create_stmt = db.execute("CREATE TABLE other (a,b)") # error: database table is locked

Why does this happen?

Anyway around this?


You must finalize select_stmt before running again db.execute


Right. I have an instance where I would like to keep the
select_stmt
_open_ (or not finalized) while I create a new table. Is
this possible?

While you are reding the DB, you can't update it, sqlite support many
simultaneous readers but only one write; so you can't create
a new table
while your select statement is running.

but he has only one writer. A select is not a writer, the create statement is.
I couldn't get something like this to work either and ended up building a list
of updates in memory which I applied after the finalize of the select.





Reply via email to