Fix WebSQL for Android 4.0.2.

This commit is contained in:
Bryce Curtis 2012-02-28 23:26:21 -06:00
parent 3ebc1d71df
commit d2fc08959a
2 changed files with 3 additions and 5 deletions

View File

@ -1029,8 +1029,6 @@ module.exports = {
} }
if (db === null) { if (db === null) {
// TOOD: this is wrong
setupDroidDB();
return storage.openDatabase(name, version, desc, size); return storage.openDatabase(name, version, desc, size);
} }
else { else {

View File

@ -162,7 +162,7 @@ public class Storage extends Plugin {
try { try {
if (isDDL(query)) { if (isDDL(query)) {
this.myDb.execSQL(query); this.myDb.execSQL(query);
this.sendJavascript("droiddb.completeQuery('" + tx_id + "', '');"); this.sendJavascript("require('cordova/plugin/android/storage').completeQuery('" + tx_id + "', '');");
} }
else { else {
Cursor myCursor = this.myDb.rawQuery(query, params); Cursor myCursor = this.myDb.rawQuery(query, params);
@ -175,7 +175,7 @@ public class Storage extends Plugin {
System.out.println("Storage.executeSql(): Error=" + ex.getMessage()); System.out.println("Storage.executeSql(): Error=" + ex.getMessage());
// Send error message back to JavaScript // Send error message back to JavaScript
this.sendJavascript("droiddb.fail('" + ex.getMessage() + "','" + tx_id + "');"); this.sendJavascript("require('cordova/plugin/android/storage').fail('" + ex.getMessage() + "','" + tx_id + "');");
} }
} }
@ -233,7 +233,7 @@ public class Storage extends Plugin {
} }
// Let JavaScript know that there are no more rows // Let JavaScript know that there are no more rows
this.sendJavascript("droiddb.completeQuery('" + tx_id + "', " + result + ");"); this.sendJavascript("require('cordova/plugin/android/storage').completeQuery('" + tx_id + "', " + result + ");");
} }
} }