Андрей Евгеньевич Осипов <aosi...@geobuilder.ru> wrote:
> Pseudocode:
> 
> 1.       Query1.CreateAndExecute( "SELECT ... FROM TestTable INNER JOIN 
> TestTableRTree ON ... WHERE (...)") // This query should
> return one and only record 
> 
> 2.       Query2.Create( "UPDATE TestTable SET (....) WHERE (...) // Trying to 
> update currect record of the Query1, this cause
> execution trigger that changes record in the TestTableRTree 
> 
> 3.       Query2.Execute();
> 
> 4.       Query1.MoveNext(); // This call is finished with code SQLITE_ROW, 
> not SQLITE_DONE. It is error

Modifying a table just as you are iterating over it exhibits undefined 
behavior. Some rows could be visited more than once, others skipped; you could 
observe stale values, or even values from now-deleted rows; WHERE and ORDER BY 
conditions might be violated. That it sometimes appears to work is purely by 
accident.
-- 
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to