cordova-sqlite-evmax-build-free 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AUTHORS.md +1 -0
- package/CHANGES.md +38 -0
- package/LICENSE.md +2 -2
- package/README.md +30 -2
- package/SQLitePlugin.coffee.md +25 -7
- package/package.json +2 -2
- package/plugin.xml +4 -4
- package/spec/package.json +8 -1
- package/spec/www/index.html +1 -0
- package/spec/www/spec/android-db-location-test.js +327 -0
- package/spec/www/spec/db-tx-sql-features-test.js +21 -0
- package/spec/www/spec/db-tx-sql-select-value-test.js +2 -2
- package/spec/www/spec/sqlite-version-test.js +1 -1
- package/src/android/io/sqlc/SQLitePlugin.java +52 -23
- package/src/deps/android/sqlc-evmax-ndk-driver.jar +0 -0
- package/src/deps/common/sqlite3.c +12235 -4947
- package/src/deps/common/sqlite3.h +382 -149
- package/src/windows/SQLite3-WinRT-sync/SQLite3/SQLite3.Shared.vcxitems +1 -1
- package/src/windows/libs/x64/SQLite3.UWP.dll +0 -0
- package/src/windows/libs/x64/SQLite3.winmd +0 -0
- package/src/windows/libs/x86/SQLite3.UWP.dll +0 -0
- package/src/windows/libs/x86/SQLite3.winmd +0 -0
- package/www/SQLitePlugin.js +28 -9
- package/src/windows/libs/x86/BarcodeComponent.winmd +0 -0
- /package/src/windows/libs/{x64 → dummy}/BarcodeComponent.winmd +0 -0
|
@@ -1880,11 +1880,11 @@ var mytests = function() {
|
|
|
1880
1880
|
var db = openDatabase('SELECT-UPPER-with-slash-ab-bang-cd-TEXT-string-argument.db');
|
|
1881
1881
|
expect(db).toBeDefined();
|
|
1882
1882
|
db.transaction(function(tx) {
|
|
1883
|
-
tx.executeSql('SELECT UPPER(?) as myresult', ['/ab!cd'], function(ignored, rs) {
|
|
1883
|
+
tx.executeSql('SELECT UPPER(?) as myresult', ['/ab!cd!!ef!123/456'], function(ignored, rs) {
|
|
1884
1884
|
expect(rs).toBeDefined();
|
|
1885
1885
|
expect(rs.rows).toBeDefined();
|
|
1886
1886
|
expect(rs.rows.length).toBe(1);
|
|
1887
|
-
expect(rs.rows.item(0).myresult).toBe('/AB!CD');
|
|
1887
|
+
expect(rs.rows.item(0).myresult).toBe('/AB!CD!!EF!123/456');
|
|
1888
1888
|
done();
|
|
1889
1889
|
});
|
|
1890
1890
|
}, function(error) {
|
|
@@ -104,7 +104,7 @@ var mytests = function() {
|
|
|
104
104
|
expect(rs).toBeDefined();
|
|
105
105
|
expect(rs.rows).toBeDefined();
|
|
106
106
|
expect(rs.rows.length).toBe(1);
|
|
107
|
-
expect(rs.rows.item(0).myResult).toBe('3.
|
|
107
|
+
expect(rs.rows.item(0).myResult).toBe('3.43.1');
|
|
108
108
|
|
|
109
109
|
// Close (plugin only) & finish:
|
|
110
110
|
(isWebSql) ? done() : db.close(done, done);
|
|
@@ -12,6 +12,9 @@ import java.io.File;
|
|
|
12
12
|
|
|
13
13
|
import java.lang.IllegalArgumentException;
|
|
14
14
|
|
|
15
|
+
import java.net.URI;
|
|
16
|
+
import java.net.URISyntaxException;
|
|
17
|
+
|
|
15
18
|
import java.util.Map;
|
|
16
19
|
|
|
17
20
|
import java.util.concurrent.BlockingQueue;
|
|
@@ -155,8 +158,11 @@ public class SQLitePlugin extends CordovaPlugin {
|
|
|
155
158
|
case delete:
|
|
156
159
|
o = args.getJSONObject(0);
|
|
157
160
|
dbname = o.getString("path");
|
|
161
|
+
String dblocation = null;
|
|
162
|
+
if (o.has("androidDatabaseLocation"))
|
|
163
|
+
dblocation = o.getString("androidDatabaseLocation");
|
|
158
164
|
|
|
159
|
-
deleteDatabase(dbname, cbc);
|
|
165
|
+
deleteDatabase(dbname, dblocation, cbc);
|
|
160
166
|
|
|
161
167
|
break;
|
|
162
168
|
|
|
@@ -239,22 +245,37 @@ public class SQLitePlugin extends CordovaPlugin {
|
|
|
239
245
|
this.cordova.getThreadPool().execute(r);
|
|
240
246
|
}
|
|
241
247
|
}
|
|
248
|
+
|
|
242
249
|
/**
|
|
243
|
-
*
|
|
250
|
+
* Get a database file.
|
|
244
251
|
*
|
|
245
252
|
* @param dbName The name of the database file
|
|
246
253
|
*/
|
|
247
|
-
private
|
|
248
|
-
|
|
249
|
-
// ASSUMPTION: no db (connection/handle) is already stored in the map
|
|
250
|
-
// [should be true according to the code in DBRunner.run()]
|
|
251
|
-
|
|
254
|
+
private File getDatabaseFile(String dbname, String dblocation) throws URISyntaxException {
|
|
255
|
+
if (dblocation == null) {
|
|
252
256
|
File dbfile = this.cordova.getActivity().getDatabasePath(dbname);
|
|
253
257
|
|
|
254
258
|
if (!dbfile.exists()) {
|
|
255
259
|
dbfile.getParentFile().mkdirs();
|
|
256
260
|
}
|
|
257
261
|
|
|
262
|
+
return dbfile;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return new File(new File(new URI(dblocation)), dbname);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Open a database.
|
|
270
|
+
*
|
|
271
|
+
* @param dbName The name of the database file
|
|
272
|
+
*/
|
|
273
|
+
private SQLiteNativeDatabase openDatabase(String dbname, String dblocation, CallbackContext cbc, boolean old_impl, int dbid) throws Exception {
|
|
274
|
+
try {
|
|
275
|
+
// ASSUMPTION: no db (connection/handle) is already stored in the map
|
|
276
|
+
// [should be true according to the code in DBRunner.run()]
|
|
277
|
+
|
|
278
|
+
File dbfile = getDatabaseFile(dbname, dblocation);
|
|
258
279
|
Log.v("info", "Open sqlite db: " + dbfile.getAbsolutePath());
|
|
259
280
|
|
|
260
281
|
SQLiteNativeDatabase mydb = new SQLiteNativeDatabase();
|
|
@@ -273,17 +294,12 @@ public class SQLitePlugin extends CordovaPlugin {
|
|
|
273
294
|
}
|
|
274
295
|
}
|
|
275
296
|
|
|
276
|
-
private SQLiteAndroidDatabase openDatabase2(String dbname,
|
|
297
|
+
private SQLiteAndroidDatabase openDatabase2(String dbname, String dblocation, CallbackContext cbc, boolean old_impl) throws Exception {
|
|
277
298
|
try {
|
|
278
299
|
// ASSUMPTION: no db (connection/handle) is already stored in the map
|
|
279
300
|
// [should be true according to the code in DBRunner.run()]
|
|
280
301
|
|
|
281
|
-
File dbfile =
|
|
282
|
-
|
|
283
|
-
if (!dbfile.exists()) {
|
|
284
|
-
dbfile.getParentFile().mkdirs();
|
|
285
|
-
}
|
|
286
|
-
|
|
302
|
+
File dbfile = getDatabaseFile(dbname, dblocation);
|
|
287
303
|
Log.v("info", "Open sqlite db: " + dbfile.getAbsolutePath());
|
|
288
304
|
|
|
289
305
|
SQLiteAndroidDatabase mydb = new SQLiteAndroidDatabase();
|
|
@@ -339,7 +355,7 @@ public class SQLitePlugin extends CordovaPlugin {
|
|
|
339
355
|
}
|
|
340
356
|
}
|
|
341
357
|
|
|
342
|
-
private void deleteDatabase(String dbname, CallbackContext cbc) {
|
|
358
|
+
private void deleteDatabase(String dbname, String dblocation, CallbackContext cbc) {
|
|
343
359
|
DBRunner r = dbrmap.get(dbname);
|
|
344
360
|
if (r != null) {
|
|
345
361
|
try {
|
|
@@ -351,7 +367,7 @@ public class SQLitePlugin extends CordovaPlugin {
|
|
|
351
367
|
Log.e(SQLitePlugin.class.getSimpleName(), "couldn't close database", e);
|
|
352
368
|
}
|
|
353
369
|
} else {
|
|
354
|
-
boolean deleteResult = this.deleteDatabaseNow(dbname);
|
|
370
|
+
boolean deleteResult = this.deleteDatabaseNow(dbname, dblocation);
|
|
355
371
|
if (deleteResult) {
|
|
356
372
|
cbc.success();
|
|
357
373
|
} else {
|
|
@@ -367,10 +383,10 @@ public class SQLitePlugin extends CordovaPlugin {
|
|
|
367
383
|
*
|
|
368
384
|
* @return true if successful or false if an exception was encountered
|
|
369
385
|
*/
|
|
370
|
-
private boolean deleteDatabaseNow(String dbname) {
|
|
371
|
-
File dbfile = this.cordova.getActivity().getDatabasePath(dbname);
|
|
372
|
-
|
|
386
|
+
private boolean deleteDatabaseNow(String dbname, String dblocation) {
|
|
373
387
|
try {
|
|
388
|
+
File dbfile = getDatabaseFile(dbname, dblocation);
|
|
389
|
+
|
|
374
390
|
return cordova.getActivity().deleteDatabase(dbfile.getAbsolutePath());
|
|
375
391
|
} catch (Exception e) {
|
|
376
392
|
Log.e(SQLitePlugin.class.getSimpleName(), "couldn't delete database", e);
|
|
@@ -435,6 +451,7 @@ public class SQLitePlugin extends CordovaPlugin {
|
|
|
435
451
|
private class DBRunner implements Runnable {
|
|
436
452
|
final int dbid;
|
|
437
453
|
final String dbname;
|
|
454
|
+
final String dblocation;
|
|
438
455
|
// expose oldImpl:
|
|
439
456
|
boolean oldImpl;
|
|
440
457
|
private boolean bugWorkaround;
|
|
@@ -449,8 +466,20 @@ public class SQLitePlugin extends CordovaPlugin {
|
|
|
449
466
|
this.dbid = dbid;
|
|
450
467
|
this.dbname = dbname;
|
|
451
468
|
this.oldImpl = options.has("androidOldDatabaseImplementation");
|
|
452
|
-
Log.v(SQLitePlugin.class.getSimpleName(), "Android db implementation: built-in android.database.sqlite package");
|
|
469
|
+
//Log.v(SQLitePlugin.class.getSimpleName(), "Android db implementation: built-in android.database.sqlite package");
|
|
453
470
|
this.bugWorkaround = this.oldImpl && options.has("androidBugWorkaround");
|
|
471
|
+
|
|
472
|
+
String mydblocation = null;
|
|
473
|
+
if (options.has("androidDatabaseLocation")) {
|
|
474
|
+
try {
|
|
475
|
+
mydblocation = options.getString("androidDatabaseLocation");
|
|
476
|
+
} catch (Exception e) {
|
|
477
|
+
// IGNORED
|
|
478
|
+
Log.e(SQLitePlugin.class.getSimpleName(), "unexpected JSON exception, IGNORED", e);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
this.dblocation = mydblocation;
|
|
482
|
+
|
|
454
483
|
if (this.bugWorkaround)
|
|
455
484
|
Log.v(SQLitePlugin.class.getSimpleName(), "Android db closing/locking workaround applied");
|
|
456
485
|
|
|
@@ -461,9 +490,9 @@ public class SQLitePlugin extends CordovaPlugin {
|
|
|
461
490
|
public void run() {
|
|
462
491
|
try {
|
|
463
492
|
if (!oldImpl)
|
|
464
|
-
this.mydb = this.mydb1 = openDatabase(dbname,
|
|
493
|
+
this.mydb = this.mydb1 = openDatabase(dbname, dblocation, this.openCbc, this.oldImpl, this.dbid);
|
|
465
494
|
else
|
|
466
|
-
this.mydb = openDatabase2(dbname,
|
|
495
|
+
this.mydb = openDatabase2(dbname, dblocation, this.openCbc, this.oldImpl);
|
|
467
496
|
} catch (Exception e) {
|
|
468
497
|
Log.e(SQLitePlugin.class.getSimpleName(), "unexpected error, stopping db thread", e);
|
|
469
498
|
dbrmap.remove(dbname);
|
|
@@ -526,7 +555,7 @@ public class SQLitePlugin extends CordovaPlugin {
|
|
|
526
555
|
dbq.cbc.success();
|
|
527
556
|
} else {
|
|
528
557
|
try {
|
|
529
|
-
boolean deleteResult = deleteDatabaseNow(dbname);
|
|
558
|
+
boolean deleteResult = deleteDatabaseNow(dbname, dblocation);
|
|
530
559
|
if (deleteResult) {
|
|
531
560
|
dbq.cbc.success();
|
|
532
561
|
} else {
|
|
Binary file
|