On 15 Jul 2019, at 8:38pm, Zhu, Liang [AUTOSOL/ASSY/US] <liang....@emerson.com> 
wrote:

> I am getting the  SQLite_locked error on delete, and my data from the select 
> statement are junk.

I think you are saying that you get the result SQLITE_LOCKED.  To do this you 
must be

A) Using one database connection for two or more accesses (e.g. 
multi-threading) OR
B) Using shared-cache mode.

<https://www.sqlite.org/sharedcache.html>

Under these situations, SQLite has no way to prevent multiple threads from 
accessing the database at the same time.

To prevent it, make sure each thread uses a separate connection, and do not use 
shared-cache mode.  If you do this, then SQLite uses its busy/wait system, and 
will continually retry access until it reaches the time you've set as timeout:

<https://www.sqlite.org/c3ref/busy_timeout.html>

> We do the increment of 1000,  when the record reaches number which dividable 
> by 1000, we delete the record.

This does not seem to be a good way to delete old rows.  Can you not check the 
rowid instead ?
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to