The documentation for db:nrows (and possibly db:rows and db:urows as well) should note that you should never break or return before the for loop is finished, because that apparently leaves the table locked as I've discovered the hard way. You can test this by doing something like "PRAGMA wal_checkpoint;" (assuming your journal_mode is set to WAL) after breaking out of the db:nrows loop and then checking the error code.
comments on using luasqlite db:nrows
Posted by Fiendish on Sat 12 Nov 2011 06:19 AM — 2 posts, 10,413 views.
Yes I wondered about that. Hence my caution when doing this:
Although you should only get one match, I let the for loop iterate and "clean up" afterwards.
Documentation amended for the next release.
for a in db:nrows "SELECT * FROM sqlite_master WHERE name = 'rooms_lookup' AND type = 'table'" do
table_exists = true
end -- for
Although you should only get one match, I let the for loop iterate and "clean up" afterwards.
Documentation amended for the next release.