Wonder if someone can help with me this.
I have an analysis application developed in Livecode that my customers are using. A problem they are experiencing is the 'not responding' and fading out of livecode when uploading large sets of data to my mySQL database. For example large amounts of data within a field containing over 100,000 lines of text needs to be uploaded to 1 field within my table in mySQL which can take some amount of time, depending on connection etc.
This is not a problem, however many users think the system has crashed - even though a 'please wait' stack opens. Users start clicking, then livecode app fades and can crash.
Is there a way where the user can keep pressing/clicking etc without the APP fading then creashing?
I am using the following code to upload to mySQL server:
Code: Select all
on mouseUp
//CONNECT TO DATABASE
-- use a global variable to hold the connection ID so other scripts can use it
global gConnectionID
-- set up the connection parameters - edit these to suit your database
put "xxxxxxxx" into tDatabaseAddress
put "xxxxxxxx" into tDatabaseName
put "xxxxxxxx" into tDatabaseUser
put "xxxxxxxx" into tDatabasePassword
-- connect to the database
put revOpenDatabase("MySQL", tDatabaseAddress, tDatabaseName, tDatabaseUser, tDatabasePassword) into tResult
-- check if it worked and display an error message if it didn't
-- & set the connection ID global
if tResult is a number then
put tResult into gConnectionID
//answer info "Proposal Generated." & cr & "Connection ID = " & gConnectionID
else
put empty into gConnectionID
end if
//ADD TO DATABASE
-- check the global connection ID to make sure we have a database connection
global gConnectionID
if gConnectionID is not a number then
answer error "Please connect to the database first."
exit to top
end if
-- edit these variables to match your database & table
-- this assumes a table called Table1 with 3 fields
put field "Ref" into tRef
replace "Ref: " with empty in tRef
put "UPDATE Analyser Login SET RentalM1=" & "'" & (field "Rental M1") & "'" & "WHERE ID=" & "'" & (tRef) & "'" into tSQL
put "UPDATE Analyser Login SET CallDataM1=" & "'" & (field "CallData M1") & "'" & "WHERE ID=" & "'" & (tRef) & "'" into tSQL2
put "UPDATE Analyser Login SET RentalM2=" & "'" & (field "Rental M2") & "'" & "WHERE ID=" & "'" & (tRef) & "'" into tSQL3
put "UPDATE Analyser Login SET CallDataM2=" & "'" & (field "CallData M2") & "'" & "WHERE ID=" & "'" & (tRef) & "'" into tSQL4
put "UPDATE Analyser Login SET RentalM3=" & "'" & (field "Rental M3") & "'" & "WHERE ID=" & "'" & (tRef) & "'" into tSQL5
put "UPDATE Analyser Login SET CallDataM3=" & "'" & (field "CallData M3") & "'" & "WHERE ID=" & "'" & (tRef) & "'" into tSQL6
-- construct the SQL - the :1, :2 & :3 placeholders in the SQL will be filled by variables in the revExecuteSQL line
//put "INSERT INTO " & tTableName & " (" & tFields & ") VALUES (:1, :2, :3)" into tSQL
-- send the SQL to the database, filling in the placeholders with data from variables
revExecuteSQL gConnectionID, tSQL
revExecuteSQL gConnectionID, tSQL2
revExecuteSQL gConnectionID, tSQL3
revExecuteSQL gConnectionID, tSQL4
revExecuteSQL gConnectionID, tSQL5
revExecuteSQL gConnectionID, tSQL6
-- check the result and display the data or an error message
if the result is a number then
answer info "Files Uploaded"
put "Files Uploaded" into field "Status" of group "AnalyseMaster"
else
answer error "There was a problem updating the record to the database:" & cr & the result
exit to top
end if
//DISCONNECT FROM DATABASE
global gConnectionID
-- if we have a connection, close it and clear the global connection ID
if gConnectionID is a number then
revCloseDatabase gConnectionID
put empty into gConnectionID
end if
end mouseUp
Thank you in advance.
Daniel