[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Suggestions
. . -> [Subject]  comments on using luasqlite db:nrows

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

comments on using luasqlite db:nrows

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Fiendish   USA  (848 posts)  [Biography] bio   Global Moderator
Date Sat 12 Nov 2011 06:19 AM (UTC)  quote  ]

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.

http://aardwolfclientpackage.googlecode.com/
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Sat 12 Nov 2011 09:53 PM (UTC)  quote  ]
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
[Go to top] 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.


929 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]