in reply to SQLite UPDATE table lock

In my experience, SQLite only likes one active statement or cursor. So, nesting loops that read/write from tables at the same time generally don't work.

In your case, it seems it could be enough to ->finish your $sth before calling update_seasons. Alternatively, you could make your SQL more explicit by fetching the count(*) instead of asking the statement how many rows it would return. Then you would also need to use ->fetchall or selectall_arrayref to fetch all data in one go.

Replies are listed 'Best First'.
Re^2: SQLite UPDATE table lock
by packetstormer (Monk) on Jul 23, 2012 at 14:01 UTC
    Thanks for the suggestion. Placing the $sth->finish before the update call worked. I should have had COUNT(*) too (that was a typo) so a fetchrow()worked in that instance.
    Thanks

      If you change to select count(*) and call fetchall* you should not need to call finish. Generally speaking, if you are calling finish it should be an indication that you /might/ be doing something wrong.