Re: [sqlite] Table locked when trying to delete a record whilst a cursor to the table is open

2004-10-22 Thread Andrew Clark
One work around is to load the results of your SELECT into a TEMP table, then loop through the TEMP table to do your DELETEs. SQLite does allow you to delete, update, or insert tables from within the middle of a select as long as the tables being updated, deleted, or inserted are distinct from

Re: [sqlite] Table locked when trying to delete a record whilst a cursor to the table is open

2004-10-22 Thread Andrew Clark
Hi, My program model in effect was a Component based model whereby I created an Object Enumerator which is currently implemented as an SQLite Select Query and whilst enumerating the objects I was then calling Delete() on some objects to tell them to destroy. The problem with SQLite was that i

Re: [sqlite] Table locked when trying to delete a record whilst a cursor to the table is open

2004-10-22 Thread D. Richard Hipp
Clay Dowling wrote: Andrew, What you're trying to do won't work. Clay is correct. The btree code in SQLite will get confused if you delete (or otherwise modify) entries in a table while SQLite is trying to scan that table. This means that you cannot do a DELETE on the table in the middle of a

[sqlite] Table locked when trying to delete a record whilst a cursor to the table is open

2004-10-21 Thread Andrew Clark
Hi, Sorry I forgot to say.. I do know that the error occurs because there are read locks on the table, but is there any reason why say a single process should not be able to modify the table anyway? Or is there something in the Cursor enumeration code that would not be happy if a record

[sqlite] Table locked when trying to delete a record whilst a cursor to the table is open

2004-10-21 Thread Andrew Clark
Hi, First of all here the simple example of what i am doing would be: "SELECT id FROM test" Get first Result DELETE FROM test WHERE id=xxx Close Cursor - When i call the DELETE command I get an error of TABLE LOCKED which for those that