Page 1 of 1

Database Query Screen Lock

Posted: Thu Jan 07, 2016 2:32 pm
by A1Qicks
I'm currently using a database for some regular message updates (partly due to resources and partly because I don't yet understand servers - I may move over as time passes but I want to get to grips with MySQL first), and my code (when running) opens a connection, queries the database, and closes the connection every two seconds.

This, by itself, works fine. I haven't got any errors in the basic design, nothing I add is causing problems with that.

But while it's doing this, the screen locks - or perhaps freezes - for about half a second. During this time, the user may be constantly typing, which means that a split second freeze can cause sentences to stt loing lke tis as letters don't register during the freeze.

Is there any way to avoid this within the bounds of my current system or is this a limitation of databases and database querying within LiveCode?

Re: Database Query Screen Lock

Posted: Sat Jan 16, 2016 4:16 pm
by charms
I don't know in detail what you try to do, or how your code looks but you could try using the dispatch command that will execute a message in a new thread.

Write a message with your SQL statement, for example:

Code: Select all

on messageUpdateConnectToDb
 -- add your code to connect to the database
end messageUpdateConnectToDb
Use the dispatch command to execute the message:

Code: Select all

dispatch messageUpdateConnectToDb