From e4846e131ce014ec9d979183f440f5c4b040d2b4 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Mon, 11 Dec 2017 19:00:31 -0500 Subject: [PATCH] Test & document default PRAGMA journal_mode setting --- README.md | 3 +++ spec/www/spec/sqlite-version-test.js | 31 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/README.md b/README.md index cbf649a96..5b4c24562 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,9 @@ Use the `location` or `iosDatabaseLocation` option in `sqlitePlugin.openDatabase - R-Tree is *not* tested or supported for Android in this version branch. - Android versions supported: 2.3.3 - 7.1.1 (API level 10 - 25), depending on Cordova version ref: - iOS versions supported: 8.x / 9.x / 10.x / 11.x +- Default `PRAGMA journal_mode` setting (*tested*): + - Android (builtin android.database implementation): `persist` + - otherwise: `delete` - In case of memory issues please use smaller transactions or use the version at [litehelpers / Cordova-sqlite-evcore-extbuild-free](https://github.com/litehelpers/Cordova-sqlite-evcore-extbuild-free) (GPL or commercial license terms). diff --git a/spec/www/spec/sqlite-version-test.js b/spec/www/spec/sqlite-version-test.js index 3dc99933e..0b5a50366 100755 --- a/spec/www/spec/sqlite-version-test.js +++ b/spec/www/spec/sqlite-version-test.js @@ -114,6 +114,37 @@ var mytests = function() { }); + describe(suiteName + 'additional sqlite check(s)', function() { + + it(suiteName + 'Check default PRAGMA journal_mode setting (plugin ONLY)', function(done) { + if (isWebSql) pending('SKIP: NOT SUPPORTED for (WebKit) Web SQL'); + + var db = openDatabase("Check-sqlite-PRAGMA-encoding.db", "1.0", "Demo", DEFAULT_SIZE); + + expect(db).toBeDefined(); + + db.executeSql('PRAGMA journal_mode', [], function(rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); + // TBD different for builtin android.database implementation: + if (!isWindows && isAndroid) // TBD ... + expect(rs.rows.item(0).journal_mode).toBe('persist'); + else + expect(rs.rows.item(0).journal_mode).toBe('delete'); + + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + done(); + }); + }, MYTIMEOUT); + + }); + }); }