Hello.
I am using RDC and DBRequestManager among other things to 'download' a table from a mysql server to local sqlite database. It works alright, but I need to execute the job in 'background'.
The table should download (to update local data) lets say every 30 seconds (I am using a timer to trigger the download). Download takes roughly 5 seconds for 200 records. During the download, the app gets unresponsive, I can't click on any button, or anything else. As the download finishes, all is normal again. This is not acceptable for the end user, as he must use the other functions of the program all the time.
Is this normal or should the job execute transparently and I am missing something?
p.s.
I think RDC is not the culprit.
The java server tells me the query took 45 msecs;
Handlejob in dbrequestmanager takes 1500 msecs!
Then dbutils.insertmaps takes the rest of the time to transfer data from table (as dbresult coming from handlejob) to SQLite table.
How can I have all this run in the background?
Thank you.
Alan
I am using RDC and DBRequestManager among other things to 'download' a table from a mysql server to local sqlite database. It works alright, but I need to execute the job in 'background'.
The table should download (to update local data) lets say every 30 seconds (I am using a timer to trigger the download). Download takes roughly 5 seconds for 200 records. During the download, the app gets unresponsive, I can't click on any button, or anything else. As the download finishes, all is normal again. This is not acceptable for the end user, as he must use the other functions of the program all the time.
Is this normal or should the job execute transparently and I am missing something?
B4X:
'*******************************************
'*******************************************
' REQMANAGER JOBDONE - CENTRAL ROUTINE
'*******************************************
'here we return after reqManager has done
'its job
'*******************************************
Sub JobDone(Job As HttpJob)
If Job.Success = False Then
Log("Error: " & Job.ErrorMessage)
Else
Log("exporting/importing.....")
If Job.JobName = "DBRequest" Then
If Job.Tag = PerTag Then
Dim table As DBResult = reqManager.HandleJob(Job)
Dim LOM As List
Dim temp As Double
LOM.Initialize
For Each row() As Object In table.Rows
Dim m As Map
Dim i As Int
m.Initialize
i=0
For Each record As Object In row
m.Put(table.Columns.GetKeyAt(i),record)
i=i+1
Next
LOM.Add(m)
Next
Logd("got LOM permessi")
Log("Job Tag: " & Job.Tag)
TabUtils.EmptyPerdataloc 'now we can safely delete data from table
DBUtils.InsertMaps(SQL,"perdataloc",LOM) 'and put in new data
Log("finish local perdataloc")
End If
End If
Job.Release
End If
......
Sub Import 'this is where I make the call from timer (or from buttonclick, same result)
import_permessi("%")
End Sub
Sub import_permessi(Name As String)
CmdImp.Initialize
CmdImp.Name="select_permessi"
CmdImp.Parameters=Array As Object(Name)
Connect
reqManager.ExecuteQuery(CmdImp,0,PerTag)
End Sub
Sub EmptyPerdataloc
Dim query As String
query = "DELETE from perdataloc"
SQLX.ExecNonQuery(query)
End Sub
'this is the line in config of java server
sql.select_permessi=SELECT * FROM permessi
'the table has 70 fields of mixed varchar and integers
p.s.
I think RDC is not the culprit.
The java server tells me the query took 45 msecs;
Handlejob in dbrequestmanager takes 1500 msecs!
Then dbutils.insertmaps takes the rest of the time to transfer data from table (as dbresult coming from handlejob) to SQLite table.
How can I have all this run in the background?
Thank you.
Alan
Last edited: