Skip to content

Commit

Permalink
Test & document default PRAGMA journal_mode setting
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher J. Brody committed Dec 13, 2017
1 parent 70a653d commit e4846e1
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: <https://cordova.apache.org/docs/en/latest/guide/platforms/android/>
- 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).

<!-- END Status -->
Expand Down
31 changes: 31 additions & 0 deletions spec/www/spec/sqlite-version-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

});

});

}
Expand Down

0 comments on commit e4846e1

Please sign in to comment.