Database Query Screen Lock

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
A1Qicks
Posts: 79
Joined: Sat Dec 26, 2015 10:47 am

Database Query Screen Lock

Post by A1Qicks » Thu Jan 07, 2016 2:32 pm

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?

charms
Posts: 122
Joined: Mon Feb 10, 2014 6:21 pm
Contact:

Re: Database Query Screen Lock

Post by charms » Sat Jan 16, 2016 4:16 pm

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

Post Reply