Skip to content

Commit

Permalink
cordova-sqlite-legacy-express-core 1.0.0-pre1 with fixes
Browse files Browse the repository at this point in the history
- Update Android/iOS src copyright year for 2017 in this version branch
- Drop engine constraints in package.json & plugin.xml (in this version branch)
- Support macOS platform with builtin libsqlite3.dylib framework in this version branch
- Test fixes
- doc fixes
  • Loading branch information
Christopher J. Brody committed Apr 19, 2017
1 parent 0381d9f commit 8fd7846
Show file tree
Hide file tree
Showing 18 changed files with 170 additions and 137 deletions.
3 changes: 2 additions & 1 deletion AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
- Fixes to support old Android versions by @nolanlawson
- Thanks to Mark Oppenheim <mark.oppenheim@mnetics.co.uk> for fixes to open/close callbacks and repeated open/close/delete operations

## iOS version
## iOS/macOS version

- Original authors: @davibe (Davide Bertola <dade@dadeb.it>) and @joenoon (Joe Noon <joenoon@gmail.com>)
- Cordova 2.7+ port with background processing by @j3k0 (Jean-Christophe Hoelt <hoelt@fovea.cc>)
Expand All @@ -26,3 +26,4 @@

- ~~SQLiteProxy.js by @vldmrrr (Vladimir Avdonin) and @brodybits (Chris Brody)~~
- ~~Using SQLite3-WinRT C++ classes and SQLite3JS (Javascript part) by @doo (doo GmbH)~~
- ~~Thanks to @AllJoyn-Cordova for idea how to integrate Windows 8.1/Windows Phone 8.1 Visual C++ projects in plugin.xml~~
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changes

### cordova-sqlite-legacy-express-core 1.0.0-pre1

- Drop engine constraints in package.json & plugin.xml (in this version branch)
- Support macOS platform with builtin libsqlite3.dylib framework in this version branch

## 1.2.2

- Self-test function to verify ability to open/populate/read/delete a test database
Expand Down
9 changes: 7 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ MIT or Apache 2.0

MIT or Apache 2.0

## iOS version
## iOS/macOS version

MIT only

## Windows (8.1) version
based on Phonegap-SQLitePlugin by @davibe (Davide Bertola <dade@dadeb.it>) and @joenoon (Joe Noon <joenoon@gmail.com>)

## REMOVED from this version branch: Windows (8.1/...) version

MIT or Apache 2.0

Expand All @@ -22,3 +24,6 @@ by @doo (doo GmbH)

MIT License

## SQLite3

Public domain
100 changes: 58 additions & 42 deletions README.md

Large diffs are not rendered by default.

14 changes: 4 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "cordova-sqlite-storage",
"version": "1.2.2",
"description": "Native interface to SQLite for PhoneGap/Cordova (core version)",
"name": "cordova-sqlite-legacy-express-core",
"version": "1.0.0-pre1",
"description": "Native interface to SQLite for PhoneGap/Cordova (legacy express core version)",
"cordova": {
"id": "cordova-sqlite-storage",
"id": "cordova-sqlite-legacy-express-core",
"platforms": [
"android",
"ios"
Expand All @@ -19,12 +19,6 @@
"cordova-android",
"cordova-ios"
],
"engines": [
{
"name": "cordova",
"version": ">=3.3.0"
}
],
"author": "various",
"license": "MIT",
"bugs": {
Expand Down
26 changes: 16 additions & 10 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="cordova-sqlite-storage"
version="1.2.2">
id="cordova-sqlite-legacy-express-core"
version="1.0.0-pre1">

<name>Cordova sqlite storage plugin (core version)</name>
<name>Cordova sqlite storage plugin - express core version</name>

<license>MIT</license>

Expand All @@ -13,12 +13,6 @@
<description>Native interface to SQLite for PhoneGap/Cordova. Allows you to use more storage and provides more flexibility than the standard Web SQL database (window.openDatabase).</description>
<author>Litehelpers/Various</author>

<engines>
<engine name="cordova" version=">=6.0.0" />
<engine name="cordova-android" version=">=5.0.0" />
<engine name="cordova-ios" version=">=4.0.0" />
</engines>

<js-module src="www/SQLitePlugin.js" name="SQLitePlugin">
<clobbers target="SQLitePlugin" />
</js-module>
Expand All @@ -34,7 +28,6 @@

<source-file src="src/android/io/sqlc/SQLitePlugin.java" target-dir="src/io/sqlc"/>
<source-file src="src/android/io/sqlc/SQLiteAndroidDatabase.java" target-dir="src/io/sqlc"/>

</platform>

<!-- ios -->
Expand All @@ -49,7 +42,20 @@
<header-file src="src/ios/SQLitePlugin.h" />
<source-file src="src/ios/SQLitePlugin.m" />
<framework src="libsqlite3.dylib" />
</platform>

<!-- macOS (osx) -->
<platform name="osx">
<config-file target="config.xml" parent="/*">
<feature name="SQLitePlugin">
<param name="ios-package" value="SQLitePlugin" />
</feature>
</config-file>

<!-- Note: the macOS (osx) src is based off src/ios implicitly -->
<header-file src="src/ios/SQLitePlugin.h" />
<source-file src="src/ios/SQLitePlugin.m" />
<framework src="libsqlite3.dylib" />
</platform>

</plugin>
Expand Down
6 changes: 3 additions & 3 deletions spec/config.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.phonegap.plugins.sqlite.tests" version="0.0.1"
xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Cordova SQLite Plugin Test Runner</name>
<name>cordova-sqlite-spec</name>
<description>
Runs the unit tests suite for the Cordova SQLite plugin.
</description>
<author email="nolan@nolanlawson.com" href="http://nolanlawson.com">
Nolan Lawson
<author email="info@litehelpers.net" href="http://litehelpers.net">
Various
</author>
<content src="index.html" />
<access origin="*" />
Expand Down
5 changes: 3 additions & 2 deletions spec/www/spec/basic-misc-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ var mytests = function() {
}, MYTIMEOUT);

it(suiteName + 'create virtual table using R-Tree', function(done) {
if (isWebSql) pending('BROKEN (NOT IMPLEMENTED) for Web SQL');
if (isWebSql) pending('SKIP for (Android/iOS WebKit) Web SQL');
if (isWP8) pending('NOT IMPLEMENTED for WP(8)'); // NOT IMPLEMENTED in CSharp-SQLite
if (isAndroid) pending('NOT IMPLEMENTED for all versions of Android'); // NOT IMPLEMENTED for all versions of Android database (failed in Circle CI)

Expand Down Expand Up @@ -261,7 +261,8 @@ var mytests = function() {
});
}, MYTIMEOUT);

it(suiteName + 'DELETE LIMIT', function(done) {
// NOT supported by SQLite amalgamation ...
xit(suiteName + 'DELETE LIMIT', function(done) {
if (isWP8) pending('NOT IMPLEMENTED for WP(8)');
if (isWindows) pending('NOT IMPLEMENTED for Windows');
if (isAndroid && !isWebSql) pending('SKIP for Android plugin'); // FUTURE TBD test with newer versions (android.database)
Expand Down
15 changes: 6 additions & 9 deletions spec/www/spec/browser-check-startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@

var MYTIMEOUT = 12000;

var isAndroid = /Android/.test(navigator.userAgent);
var isWP8 = /IEMobile/.test(navigator.userAgent); // Matches WP(7/8/8.1)
//var isWindows = /Windows NT/.test(navigator.userAgent); // Windows [NT] (8.1)
var isWindows = /Windows /.test(navigator.userAgent); // Windows (8.1)
//var isWindowsPC = /Windows NT/.test(navigator.userAgent); // Windows [NT] (8.1)
//var isWindowsPhone_8_1 = /Windows Phone 8.1/.test(navigator.userAgent); // Windows Phone 8.1
//var isIE = isWindows || isWP8 || isWindowsPhone_8_1;
var isIE = isWindows || isWP8;
var isWebKit = !isIE; // TBD [Android or iOS]
var isAndroid = !isWindows && /Android/.test(navigator.userAgent);
var isMac = /Macintosh/.test(navigator.userAgent);

window.hasBrowser = true;
window.hasWebKitBrowser = isWebKit;
// XXX FUTURE TODO rename to something like window.hasWebKitWebSQL here
// and in actual test scripts
window.hasWebKitBrowser = (!isWindows && !isWP8 && !isMac && (isAndroid || !(window.webkit && window.webkit.messageHandlers)));

describe('check startup', function() {
it('receives deviceready event', function(done) {
Expand All @@ -24,7 +21,7 @@ describe('check startup', function() {
}, MYTIMEOUT);

it('has openDatabase', function() {
if (isWebKit) expect(window.openDatabase).toBeDefined();
if (window.hasWebKitBrowser) expect(window.openDatabase).toBeDefined();
expect(window.sqlitePlugin).toBeDefined();
expect(window.sqlitePlugin.openDatabase).toBeDefined();
});
Expand Down
5 changes: 3 additions & 2 deletions spec/www/spec/db-tx-sql-results.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,9 @@ var mytests = function() {

if (isWebSql) {
// Web SQL STANDARD:
// 1. this is a native object that is NOT affected by the change:
expect(temp1.data).toBe('test');
// 1. this is a native object that is NOT affected by the change (SKIP for Android 5.x/+):
if (!isAndroid || /Android [1-4]/.test(navigator.userAgent))
expect(temp1.data).toBe('test');
// 2. object returned by second resultSet.rows.item call not affected:
expect(temp2.data).toBe('test');
} else {
Expand Down
32 changes: 19 additions & 13 deletions spec/www/spec/db-tx-string-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,13 @@ var mytests = function() {
});
});

// NOTE: the next two tests show that for iOS:
// - UNICODE \u2028 line separator from Javascript to Objective-C is working ok
// - UNICODE \u2028 line separator from Objective-C to Javascript is BROKEN
// ref: litehelpers/Cordova-sqlite-storage#147
// NOTE: the next 2 tests show that for iOS/macOS/Android:
// - UNICODE \u2028 line separator from JavaScript to native (Objective-C/Java) is working OK
// - UNICODE \u2028 line separator from native (Objective-C/Java) to JavaScript is BROKEN
// For reference:
// - litehelpers/Cordova-sqlite-storage#147
// - Apache Cordova CB-9435 (issue with cordova-ios, also affects macOS)
// - cordova/cordova-discuss#57 (issue with cordova-android)
it(suiteName + "UNICODE \\u2028 line separator string length", function(done) {
if (isWP8) pending('BROKEN for WP(8)'); // [BUG #202] Certain UNICODE characters not working with WP(8)

Expand All @@ -225,9 +228,9 @@ var mytests = function() {
});

it(suiteName + ' handles UNICODE \\u2028 line separator correctly [string test]', function (done) {

if (isWP8) pending('BROKEN for WP(8)'); // [BUG #202] UNICODE characters not working with WP(8)
if (!(isWebSql || isAndroid || isIE)) pending('BROKEN for iOS'); // XXX [BUG #147] (no callback received)
if (!isWebSql && !isWindows && isAndroid) pending('SKIP for Android plugin (cordova-android 6.x BUG: cordova/cordova-discuss#57)');
if (!isWebSql && !isWindows && !isAndroid && !isWP8) pending('SKIP for iOS/macOS plugin (Cordova BUG: CB-9435)');

// NOTE: since the above test shows the UNICODE line separator (\u2028)
// is seen by the sqlite implementation OK, it is now concluded that
Expand All @@ -248,11 +251,14 @@ var mytests = function() {
});
});

// NOTE: the next two tests repeat the above for UNICODE \u2029 paragraph separator
// for iOS:
// - UNICODE \u2029 line separator from Javascript to Objective-C is working ok
// - UNICODE \u2029 line separator from Objective-C to Javascript is BROKEN
// ref: litehelpers/Cordova-sqlite-storage#147
// NOTE: the next 2 tests repeat the above for UNICODE \u2029 paragraph separator
// on iOS/macOS/Android:
// - UNICODE \u2029 paragraph separator from JavaScript to native (Objective-C/Java) is working OK
// - UNICODE \u2029 paragraph separator from native (Objective-C/Java) to JavaScript is BROKEN
// For reference:
// - litehelpers/Cordova-sqlite-storage#147
// - Apache Cordova CB-9435 (issue with cordova-ios, also affects macOS)
// - cordova/cordova-discuss#57 (issue with cordova-android)
it(suiteName + "UNICODE \\u2029 line separator string length", function(done) {
if (isWP8) pending('BROKEN for WP(8)'); // [BUG #202] Certain UNICODE characters not working with WP(8)

Expand All @@ -275,9 +281,9 @@ var mytests = function() {
});

it(suiteName + ' handles UNICODE \\u2029 line separator correctly [string test]', function (done) {

if (isWP8) pending('BROKEN for WP(8)'); // [BUG #202] UNICODE characters not working with WP(8)
if (!(isWebSql || isAndroid || isIE)) pending('BROKEN for iOS'); // XXX [BUG #147] (no callback received)
if (!isWebSql && !isWindows && isAndroid) pending('SKIP for Android plugin (cordova-android 6.x BUG: cordova/cordova-discuss#57)');
if (!isWebSql && !isWindows && !isAndroid && !isWP8) pending('SKIP for iOS/macOS plugin (Cordova BUG: CB-9435)');

// NOTE: since the above test shows the UNICODE paragraph separator (\u2029)
// is seen by the sqlite implementation OK, it is now concluded that
Expand Down
29 changes: 14 additions & 15 deletions spec/www/spec/db-tx-value-bindings-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,11 @@ function start(n) {
if (wait == 0) test_it_done();
}

var isAndroid = /Android/.test(navigator.userAgent);
var isWP8 = /IEMobile/.test(navigator.userAgent); // Matches WP(7/8/8.1)
//var isWindows = /Windows NT/.test(navigator.userAgent); // Windows [NT] (8.1)
var isWindows = /Windows /.test(navigator.userAgent); // Windows (8.1)
//var isWindowsPC = /Windows NT/.test(navigator.userAgent); // Windows [NT] (8.1)
//var isWindowsPhone_8_1 = /Windows Phone 8.1/.test(navigator.userAgent); // Windows Phone 8.1
//var isIE = isWindows || isWP8 || isWindowsPhone_8_1;
var isIE = isWindows || isWP8;
var isWebKit = !isIE; // TBD [Android or iOS]
var isAndroid = !isWindows && /Android/.test(navigator.userAgent);
var isMac = /Macintosh/.test(navigator.userAgent);
var isWKWebView = !isWindows && !isAndroid && !isWP8 && !isMac && !!window.webkit && !!window.webkit.messageHandlers;

// NOTE: In the core-master branch there is no difference between the default
// implementation and implementation #2. But the test will also apply
Expand Down Expand Up @@ -180,10 +176,9 @@ var mytests = function() {
var row = res.rows.item(0);
expect(row.test_date).toBe(1424174959894);

// NOTE: storing big integer in TEXT field WORKING OK with WP(8) version.
// It is now suspected that the issue lies with the results handling.
// XXX Brody TODO: storing big number in TEXT field is different for Plugin vs. Web SQL!
if (isWebSql)
// NOTE: big number stored in field with TEXT affinity with different conversion
// in case of plugin (certain platforms) vs. Android/iOS WebKit Web SQL
if (isWebSql || isMac || isWKWebView)
expect(row.test_text).toBe("1424174959894.0"); // ([Big] number inserted as string ok)
else
expect(row.test_text).toBe("1424174959894"); // (Big integer number inserted as string ok)
Expand Down Expand Up @@ -377,13 +372,17 @@ var mytests = function() {
});
});

// XXX Brody NOTE: same issue is now reproduced in a string test.
// TBD ???: combine with other test
// BUG #147 iOS version of plugin BROKEN:

// Issue with iOS/macOS/Android
// For reference:
// - litehelpers/Cordova-sqlite-storage#147
// - Apache Cordova CB-9435 (issue with cordova-ios, also affects macOS)
// - cordova/cordova-discuss#57 (issue with cordova-android)
test_it(suiteName +
' handles UNICODE \\u2028 line separator correctly [in database]', function () {
if (isWP8) pending('BROKEN for WP(8)'); // [BUG #202] UNICODE characters not working with WP(8)
if (!(isWebSql || isAndroid || isIE)) pending('BROKEN for iOS'); // XXX [BUG #147] (no callback received)
if (!isWebSql && !isWindows && isAndroid) pending('SKIP for Android plugin (cordova-android 6.x BUG: cordova/cordova-discuss#57)');
if (!isWebSql && !isWindows && !isAndroid && !isWP8) pending('SKIP for iOS/macOS plugin (Cordova BUG: CB-9435)');

var dbName = "Unicode-line-separator.db";
var db = openDatabase(dbName, "1.0", "Demo", DEFAULT_SIZE);
Expand Down
Loading

0 comments on commit 8fd7846

Please sign in to comment.