01-07-2021, 07:00 PM
Hi all and LiveCloud team...
Just a quick question about BatchSync - I am using cdb_batchSync to update the cloud database from the local database at certain intervals...
It certainly does the job, BUT... it seems to be a 'blocking' command, meaning that everything in the app stalls until the command completes.
Is there a 'non-blocking' version of this, or am i doing this wrong?
this is my algorithm for syncing the entire db in either direction:
command syncDB pSource
local tTableNames, tTableID, tInputA, tMessage
put cdb_tableNames() into tTableNames
repeat for each line tTable in tTableNames
put cdb_tableID(tTable) into tTableID
put "*" into tInputA[tTableID]["cdbRecordID"]
put pSource into tInputA[tTableID]["source"]
put true into tInputA[tTableID]["allowDeletes"]
put false into tInputA[tTableID]["detectCollisions"]
end repeat
get cdb_batchSync(tInputA)
if cdb_result() is not true then
put "Error syncing cloud <-> local database: " & cdb_result("response") into tMessage
answer tMessage
end if
end syncDB
I think it may just be a bit too complex to try and maintain a system that flags changes and only syncs them, not in the least as the data is relational involving multiple tables and is still being developed, so i would prefer a system that would just sync everything 'in the background' if that were possible...
As it stands, the process to sync does not appear asynchronous and blocks the interface - grateful for any advice/tips (or if appropriate a feature request for an asynchronous sync!)
Many thanks
Stam
Just a quick question about BatchSync - I am using cdb_batchSync to update the cloud database from the local database at certain intervals...
It certainly does the job, BUT... it seems to be a 'blocking' command, meaning that everything in the app stalls until the command completes.
Is there a 'non-blocking' version of this, or am i doing this wrong?
this is my algorithm for syncing the entire db in either direction:
command syncDB pSource
local tTableNames, tTableID, tInputA, tMessage
put cdb_tableNames() into tTableNames
repeat for each line tTable in tTableNames
put cdb_tableID(tTable) into tTableID
put "*" into tInputA[tTableID]["cdbRecordID"]
put pSource into tInputA[tTableID]["source"]
put true into tInputA[tTableID]["allowDeletes"]
put false into tInputA[tTableID]["detectCollisions"]
end repeat
get cdb_batchSync(tInputA)
if cdb_result() is not true then
put "Error syncing cloud <-> local database: " & cdb_result("response") into tMessage
answer tMessage
end if
end syncDB
I think it may just be a bit too complex to try and maintain a system that flags changes and only syncs them, not in the least as the data is relational involving multiple tables and is still being developed, so i would prefer a system that would just sync everything 'in the background' if that were possible...
As it stands, the process to sync does not appear asynchronous and blocks the interface - grateful for any advice/tips (or if appropriate a feature request for an asynchronous sync!)
Many thanks
Stam