diff --git a/framework/src/com/phonegap/Storage.java b/framework/src/com/phonegap/Storage.java old mode 100755 new mode 100644 index de30afb2..67fc6f3e --- a/framework/src/com/phonegap/Storage.java +++ b/framework/src/com/phonegap/Storage.java @@ -16,15 +16,15 @@ import android.database.Cursor; import android.database.sqlite.*; /** - * This class implements the HTML5 database support for Android 1.X devices. - * It is not used for Android 2.X, since HTML5 database is built in to the browser. + * This class implements the HTML5 database support for Android 1.X devices. It + * is not used for Android 2.X, since HTML5 database is built in to the browser. */ public class Storage extends Plugin { - - SQLiteDatabase myDb = null; // Database object - String path = null; // Database path - String dbName = null; // Database name - + + SQLiteDatabase myDb = null; // Database object + String path = null; // Database path + String dbName = null; // Database name + /** * Constructor. */ @@ -34,29 +34,37 @@ public class Storage extends Plugin { /** * Executes the request and returns PluginResult. * - * @param action The action to execute. - * @param args JSONArry of arguments for the plugin. - * @param callbackId The callback id used when calling back into JavaScript. - * @return A PluginResult object with a status and message. + * @param action + * The action to execute. + * @param args + * JSONArry of arguments for the plugin. + * @param callbackId + * The callback id used when calling back into JavaScript. + * @return A PluginResult object with a status and message. */ public PluginResult execute(String action, JSONArray args, String callbackId) { PluginResult.Status status = PluginResult.Status.OK; - String result = ""; - + String result = ""; + try { - // TODO: Do we want to allow a user to do this, since they could get to other app databases? + // TODO: Do we want to allow a user to do this, since they could get + // to other app databases? if (action.equals("setStorage")) { this.setStorage(args.getString(0)); - } - else if (action.equals("openDatabase")) { - this.openDatabase(args.getString(0), args.getString(1), args.getString(2), args.getLong(3)); - } - else if (action.equals("executeSql")) { - JSONArray a = args.getJSONArray(1); - int len = a.length(); - String[] s = new String[len]; - for (int i=0; i