Closed mamingxuan closed 8 years ago
Thanks @mamingxuan for your feedback! Actually, I tested this plugin only on iOS so it is great that you want to use it on Android. I replaced backgroundExecuteSql
with backgroundExecuteSqlBatch
and made some other adjustments to extract the result correctly and make it works on iOS.
Since I don't currently have an Android dev environment set up, could you test the last version of the plugin please? If you run the example app, you should be able to see the following result: {"rows":[{"solution":5}],"affectedRows":0}
.
Hello,@mvila. At first, I found that your plugin could not run at Android dev. Fortunately, I have fixed the error. After fixing it, the plugin is able to run on Android now. The following codes will help you understand more clearly.
src/android/io/liteglue/SQLitePlugin.java from line 137-155
JSONArray txargs = allargs.getJSONArray("executes");
if (txargs.isNull(0)) {
queries = new String[0];
} else {
int len = txargs.length();
queries = new String[len];
queryIDs = new String[len];
jsonparams = new JSONArray[len];
for (int i = 0; i < len; i++) {
JSONObject a = txargs.getJSONObject(i);
queries[i] = a.getString("sql");
queryIDs[i] = a.getString("qid");
jsonArr = a.getJSONArray("params");
paramLen = jsonArr.length();
jsonparams[i] = jsonArr;
}
}
Absolutely, "executes" is an array, not an object.
So, everything is good now?
Yes, everything is OK
OK @mamingxuan, thanks for your help.
replace
with
error is