vendredi 9 octobre 2015

What is the best approach for sync local database sqlite with Production server (MySQL)?

I am executing a sql query using transaction.executeSql() for sqlite db with Javascript (Cordova). I need the last executed query to store in table for future use (sync). I didn't find anything like that. Is there any suggestion?

db.transaction(function(tx) {
 tx.executeSql("Insert into tablename (id, name) Values(?,?);", values, function(tx, results) 
{
    // I need the last executed query here.
});

Data is being updated in the sqlite offline. When user clicks on "Sync" button I will have to push all updates by this user to the server. So, I thought I will store all queries executed by this user in a table. When he/she clicks on sync button I will just execute those query on live mysql.

Is there any better approach?

Aucun commentaire:

Enregistrer un commentaire