Friday 15 May 2015

database - Phonegap storage transaction callback called several times -


I am developing a PhoneGap 2.5 application with local operations, using transactions to perform database operations. The problem is that once in a while, the application becomes where the transaction callback is called more than once for the same transaction. This is an example of how I do the transactions (when the saved function of DBVS is called):

  function DbAccess (db) {this.db = db; This.save = function (data, callback) {warning ('saving'); // it's D.B. Transaction (Tx) was called once (Tx Execute SQL ('Make Table ...'); Tx. XQUE SQL ('DIET FAR ...'); Tx. XQUE SQL ('INSERT .. );}, Function (error) {// on error callback ({"success": wrong});}, function () callback on {// success ({"success": true});});}}   

When the application comes into this situation, the callback function is repeated multiple times (via error on success callback function) It is possible, though the save function is called only once (warning only pop once above) I suspect these errors appear when the application creates more than one database. I create a database whose Name is based on the username used to enter the app (user name and example variables are user input):

  var using dbName = If you delete the application data then the name + '_' + example; var db = window.openDatabase (DBN name, "1.0", "offline data", 1000000);   

Launching from, the problems are closed. Why am I doing this, so any help would be greatly appreciated, I am in no mileage.

this is Websql, not indexed DD

Your search is like a bug on phonegrap looks like. Try listening for error and success callback at

executeSQL . Hearing your callback for success, execute your three steps. This should fix the problem.

Multiple databases should be fine.

No comments:

Post a Comment