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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  SQL SELECT query returning old values?

SQL SELECT query returning old values?

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


Posted by Kahenraz   (75 posts)  [Biography] bio
Date Wed 12 Oct 2016 02:22 PM (UTC)
Message
I have a simple query pulling information from a live database where the values can change. The problem is that the data I get can lag or fail to update at all despite the database being up to date.

For example, see this query where I pull a value:

db_object = db_object or assert(sqlite3.open("some_db.db"))

local q = "SELECT thing FROM table WHERE field = something"

for row in db_object:nrows(q) do
   print(row.thing)
end -- for


I have a dataviewer Valentina Studio which is also connected and every time I pull a value with that it's up to date. But when my trigger fires and pulls the data then sometimes it's really old.

I'm reusing the same database connection rather than opening/closing a new one for each fire of the trigger. But I've also tried opening/closing the connection each query but the data is still old.

Any idea why this is happening? I can't use SQLite if the data I'm getting isn't reliable.
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Wed 12 Oct 2016 08:44 PM (UTC)
Message
I've never seen that happen. Can you make up a minimal test that proves it?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Wed 12 Oct 2016 08:55 PM (UTC)

Amended on Wed 12 Oct 2016 08:56 PM (UTC) by Nick Gammon

Message
I think SQLite3 would be unusable if this happened generally. I can only think you are using it in an unusual way, for example keeping the database on a network drive, and the operating system serving up cached copies of the file to SQLite3.

Quote:

I have a dataviewer Valentina Studio which is also connected and every time I pull a value with that it's up to date.


Where is the modification being made? In Valentina Studio (which I haven't heard of) or elsewhere in the MUSHclient code?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Thu 13 Oct 2016 06:43 AM (UTC)
Message
I just want to point out that SQLite3 is (or claims to be) the most widely-deployed and used database engine, with billions of copies in use. For example, in Macs, iPhone, Android devices, Windows 10, many web browsers, and so on. See: Most Widely Deployed and Used Database Engine

The interface in MUSHclient is just a wrapper to call the various functions in the engine. The library itself is updated every few versions of MUSHclient in order to get speed improvements, extra features, and bug fixes.

The likelihood that you have somehow got a situation where the database engine "fails to update at all" is extremely low. It is probably a coding error.

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


12,898 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

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

[Best viewed with any browser - 2K]    [Hosted at HostDash]