Skip to content

Commit

Permalink
Fix WebSQL for Android 4.0.2.
Browse files Browse the repository at this point in the history
  • Loading branch information
brycecurtis committed Feb 29, 2012
1 parent 3ebc1d7 commit d2fc089
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 0 additions & 2 deletions framework/assets/js/cordova.android.js
Expand Up @@ -1029,8 +1029,6 @@ module.exports = {
}

if (db === null) {
// TOOD: this is wrong
setupDroidDB();
return storage.openDatabase(name, version, desc, size);
}
else {
Expand Down
6 changes: 3 additions & 3 deletions framework/src/org/apache/cordova/Storage.java
Expand Up @@ -162,7 +162,7 @@ public void executeSql(String query, String[] params, String tx_id) {
try {
if (isDDL(query)) {
this.myDb.execSQL(query);
this.sendJavascript("droiddb.completeQuery('" + tx_id + "', '');");
this.sendJavascript("require('cordova/plugin/android/storage').completeQuery('" + tx_id + "', '');");
}
else {
Cursor myCursor = this.myDb.rawQuery(query, params);
Expand All @@ -175,7 +175,7 @@ public void executeSql(String query, String[] params, String tx_id) {
System.out.println("Storage.executeSql(): Error=" + ex.getMessage());

// 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 + "');");
}
}

Expand Down Expand Up @@ -233,7 +233,7 @@ public void processResults(Cursor cur, String tx_id) {
}

// 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 + ");");
}

}

0 comments on commit d2fc089

Please sign in to comment.