Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Suggestions ➜ comments on using luasqlite db:nrows

comments on using luasqlite db:nrows

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Fiendish   USA  (2,555 posts)  Bio   Global Moderator
Date Sat 12 Nov 2011 06:19 AM (UTC)

Amended on Sat 12 Nov 2011 03:25 PM (UTC) by Fiendish

Message
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.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 12 Nov 2011 09:53 PM (UTC)
Message
Yes I wondered about that. Hence my caution when doing this:


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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


9,994 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.