Skip to content

Commit

Permalink
Merge branch 'cordova-sqlite-common' into new-common-src
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Brody committed Jul 7, 2015
2 parents 0560e40 + 2c4b690 commit 73b042a
Show file tree
Hide file tree
Showing 29 changed files with 1,759 additions and 183 deletions.
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
language: objective-c
git:
depth: 2
node_js:
- "0.10"
install:
- echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- npm install -g cordova-paramedic
- npm install -g cordova
- npm install -g ios-sim
script:
- cordova-paramedic --platform ios --plugin ${TRAVIS_BUILD_DIR}
- cp ${TRAVIS_BUILD_DIR}/spec/www/spec/simple-test.js ${TRAVIS_BUILD_DIR}/tests/tests.js
- cordova-paramedic --platform ios --plugin ${TRAVIS_BUILD_DIR} --timeout 3600000
185 changes: 105 additions & 80 deletions README.md

Large diffs are not rendered by default.

23 changes: 13 additions & 10 deletions SQLitePlugin.coffee.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@

dbname = openargs.name

if typeof dbname != 'string'
throw newSQLError 'sqlite plugin database name must be a string'

@openargs = openargs
@dbname = dbname

Expand Down Expand Up @@ -134,6 +137,7 @@
return

SQLitePlugin::transaction = (fn, error, success) ->
# FUTURE TBD check for valid fn here
if !@openDBs[@dbname]
error newSQLError 'database not open'
return
Expand All @@ -142,6 +146,7 @@
return

SQLitePlugin::readTransaction = (fn, error, success) ->
# FUTURE TBD check for valid fn here (and add test for this)
if !@openDBs[@dbname]
error newSQLError 'database not open'
return
Expand Down Expand Up @@ -284,6 +289,7 @@
## SQLite plugin transaction object for batching:

SQLitePluginTransaction = (db, fn, error, success, txlock, readOnly) ->
# FUTURE TBD check this earlier:
if typeof(fn) != "function"
###
This is consistent with the implementation in Chrome -- it
Expand Down Expand Up @@ -336,8 +342,6 @@
# finalization since it is used to execute COMMIT and ROLLBACK.
SQLitePluginTransaction::addStatement = (sql, values, success, error) ->

qid = @executes.length

params = []
if !!values && values.constructor == Array
for v in values
Expand All @@ -351,7 +355,6 @@
@executes.push
success: success
error: error
qid: qid

sql: sql
params: params
Expand Down Expand Up @@ -423,14 +426,12 @@
while i < batchExecutes.length
request = batchExecutes[i]

qid = request.qid

mycbmap[qid] =
mycbmap[i] =
success: handlerFor(i, true)
error: handlerFor(i, false)

tropts.push
qid: qid
qid: 1111
sql: request.sql
params: request.params

Expand All @@ -439,12 +440,14 @@
mycb = (result) ->
#console.log "mycb result #{JSON.stringify result}"

for r in result
last = result.length-1
for i in [0..last]
r = result[i]
type = r.type
qid = r.qid
# NOTE: r.qid can be ignored
res = r.result

q = mycbmap[qid]
q = mycbmap[i]

if q
if q[type]
Expand Down
21 changes: 21 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
machine:
environment:
ANDROID_NDK_HOME: $ANDROID_NDK

dependencies:
pre:
- npm install -g cordova-paramedic
- npm install -g cordova

test:
pre:
- emulator -avd circleci-android21 -no-audio -no-window:
background: true
parallel: true
- circle-android wait-for-boot
override:
- cordova-paramedic --platform android --plugin .
- cp spec/www/spec/simple-test.js tests/tests.js
- cordova-paramedic --platform android --plugin . --timeout 3600000
- cp spec/www/spec/legacy.js tests/tests.js
- cordova-paramedic --platform android --plugin . --timeout 7200000
38 changes: 38 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "cordova-sqlite-common",
"version": "0.7.0-dev",
"description": "Native interface to SQLite for PhoneGap/Cordova (common version-limited functionality)",
"cordova": {
"id": "cordova-sqlite-common",
"platforms": [
"android",
"ios",
"windows",
"amazon-fireos"
]
},
"repository": {
"type": "git",
"url": "https://github.com/litehelpers/cordova-sqlite-common.git"
},
"keywords": [
"sqlite",
"ecosystem:cordova",
"cordova-android",
"cordova-ios",
"cordova-windows",
"cordova-amazon-fireos"
],
"engines": [
{
"name": "cordova",
"version": ">=3.3.0"
}
],
"author": "various",
"license": "MIT",
"bugs": {
"url": "https://github.com/litehelpers/cordova-sqlite-common/issues"
},
"homepage": "https://github.com/litehelpers/cordova-sqlite-common"
}
34 changes: 10 additions & 24 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<?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="io.liteglue.sqliteStorage"
version="0.7.0">
id="cordova-sqlite-common"
version="0.7.0-dev">

<name>Cordova sqlite storage</name>
<name>Cordova sqlite storage (common)</name>

<license>MIT</license>

<keywords>sqlite</keywords>

<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>Various</author>

Expand All @@ -21,14 +23,6 @@

<!-- android -->
<platform name="android">
<!-- NOTE: AndroidManifest.xml should be specified per-application!
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<activity android:name="org.pgsqlite.SQLitePlugin"
android:label="@string/app_name">
</activity>
</config-file>
-->

<!-- Cordova >= 3.0.0 -->
<config-file target="res/xml/config.xml" parent="/*">
<feature name="SQLitePlugin">
Expand Down Expand Up @@ -69,27 +63,19 @@
<merges target="" />
</js-module>

<!-- SQLite3 JS module from SQLite3-WinRT/SQLite3JS:
<!-- SQLite3 JS module from SQLite3-WinRT/SQLite3JS: -->
<js-module src="src/windows/SQLite3-WinRT/SQLite3JS/js/SQLite3.js" name="SQLite3">
<merges target="" />
</js-module>
-->
<!-- Thanks to AllJoyn-Cordova / cordova-plugin-alljoyn:
<framework src="src/windows/SQLite3-WinRT/SQLite3/SQLite3-Windows8.1.vcxproj" custom="true" type="projectReference" target="windows" />
-->

<!-- Thanks to AllJoyn-Cordova / cordova-plugin-alljoyn: -->
<framework src="src/windows/SQLite3-WinRT/SQLite3/SQLite3.Windows/SQLite3.Windows.vcxproj" custom="true" type="projectReference" target="windows" />
<framework src="src/windows/SQLite3-WinRT/SQLite3/SQLite3.WindowsPhone/SQLite3.WindowsPhone.vcxproj" custom="true" type="projectReference" target="phone" />

</platform>

<!-- amazon-fireos -->
<platform name="amazon-fireos">
<!-- NOTE: AndroidManifest.xml should be specified per-application!
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<activity android:name="org.pgsqlite.SQLitePlugin"
android:label="@string/app_name">
</activity>
</config-file>
-->

<!-- Cordova >= 3.0.0 -->
<config-file target="res/xml/config.xml" parent="/*">
<feature name="SQLitePlugin">
Expand Down
1 change: 1 addition & 0 deletions spec/www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<script src="SQLitePlugin.js"></script>

<!-- spec file(s): -->
<script src="spec/browser-check-startup.js"></script>
<script src="spec/simple-test.js"></script>
<script src="spec/legacy.js"></script>

Expand Down
33 changes: 33 additions & 0 deletions spec/www/spec/browser-check-startup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* 'use strict'; */

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]

window.hasBrowser = true;
window.hasWebKitBrowser = isWebKit;

describe('check startup', function() {
it('receives deviceready event', function(done) {
expect(true).toBe(true);
document.addEventListener("deviceready", function() {
done();
});
}, MYTIMEOUT);

it('has openDatabase', function() {
if (isWebKit) expect(window.openDatabase).toBeDefined();
expect(window.sqlitePlugin).toBeDefined();
expect(window.sqlitePlugin.openDatabase).toBeDefined();
});
});

/* vim: set expandtab : */
Loading

0 comments on commit 73b042a

Please sign in to comment.