On 7 Nov 2010, at 4:29am, cricketfan wrote:

>        I am trying to select some columns from a table and use that to
> update another column in the same table using prepare/step/reset/finalize
> methods. However, when I use the update statement while stepping it is
> executing the flow 2 times.

You can't UPDATE a table while you're in the middle of stepping through a 
SELECT.  Because the UPDATE might change one of the things that governs the 
results of the SELECT command and cause it to repeat or skip records.  The 
neatest way to do what you want is to first perform the SELECT, read all the 
rows into an array, and finalize it.  Then perform any UPDATE you need.

An alternative would be to address the database as if you're using two 
different processes with two different database handles.  But depending on how 
you're accessing the database this may merely delay your UDPATE thread until 
the SELECT thread is finished.

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

Reply via email to