From 8ff4e969b899ed09f587675d9d46f3eece66b64a Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Sun, 7 Feb 2016 13:08:55 +0100 Subject: [PATCH] Remove Windows 'Universal' support from this version branch --- AUTHORS.md | 6 +- CHANGES.md | 1 + HISTORY.md | 4 + README.md | 59 ++-- plugin.xml | 17 -- .../SQLite3-WinRT/SQLite3/Constants.cpp | 1 - src/windows/SQLite3-WinRT/SQLite3/Constants.h | 50 --- .../SQLite3-WinRT/SQLite3/Database.cpp | 55 ---- src/windows/SQLite3-WinRT/SQLite3/Database.h | 28 -- .../SQLite3/SQLite3.Shared.vcxitems | 37 --- .../SQLite3.Windows/SQLite3.Windows.vcxproj | 248 --------------- .../SQLite3.WindowsPhone.vcxproj | 162 ---------- src/windows/SQLite3-WinRT/SQLite3/SQLite3.sln | 60 ---- .../SQLite3-WinRT/SQLite3/Statement.cpp | 90 ------ src/windows/SQLite3-WinRT/SQLite3/Statement.h | 35 --- src/windows/SQLite3-WinRT/SQLite3/pch.cpp | 1 - src/windows/SQLite3-WinRT/SQLite3/pch.h | 4 - .../SQLite3-WinRT/SQLite3JS/js/SQLite3.js | 287 ------------------ src/windows/SQLiteProxy.js | 162 ---------- 19 files changed, 26 insertions(+), 1281 deletions(-) delete mode 100644 src/windows/SQLite3-WinRT/SQLite3/Constants.cpp delete mode 100644 src/windows/SQLite3-WinRT/SQLite3/Constants.h delete mode 100644 src/windows/SQLite3-WinRT/SQLite3/Database.cpp delete mode 100644 src/windows/SQLite3-WinRT/SQLite3/Database.h delete mode 100644 src/windows/SQLite3-WinRT/SQLite3/SQLite3.Shared.vcxitems delete mode 100644 src/windows/SQLite3-WinRT/SQLite3/SQLite3.Windows/SQLite3.Windows.vcxproj delete mode 100644 src/windows/SQLite3-WinRT/SQLite3/SQLite3.WindowsPhone/SQLite3.WindowsPhone.vcxproj delete mode 100644 src/windows/SQLite3-WinRT/SQLite3/SQLite3.sln delete mode 100644 src/windows/SQLite3-WinRT/SQLite3/Statement.cpp delete mode 100644 src/windows/SQLite3-WinRT/SQLite3/Statement.h delete mode 100644 src/windows/SQLite3-WinRT/SQLite3/pch.cpp delete mode 100644 src/windows/SQLite3-WinRT/SQLite3/pch.h delete mode 100644 src/windows/SQLite3-WinRT/SQLite3JS/js/SQLite3.js delete mode 100644 src/windows/SQLiteProxy.js diff --git a/AUTHORS.md b/AUTHORS.md index 402245650..12cdf16f6 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -22,7 +22,7 @@ - Cordova 2.7+ port with background processing by @j3k0 (Jean-Christophe Hoelt ) - Maintained by @brodybits (Chris Brody) -## Windows (8.1) version +## REMOVED from this version branch: Windows (8.1) version -- SQLiteProxy.js by @vldmrrr (Vladimir Avdonin) and @brodybits (Chris Brody) -- Using SQLite3-WinRT C++ classes and SQLite3JS (Javascript part) by @doo (doo GmbH) +- ~~SQLiteProxy.js by @vldmrrr (Vladimir Avdonin) and @brodybits (Chris Brody)~~ +- ~~Using SQLite3-WinRT C++ classes and SQLite3JS (Javascript part) by @doo (doo GmbH)~~ diff --git a/CHANGES.md b/CHANGES.md index 650544aaa..8841f61ad 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,7 @@ ## 0.x.x-xx +- Windows version removed from this version branch - Move Android version to io.sqlc package ## 0.7.2-common-dev diff --git a/HISTORY.md b/HISTORY.md index c22e3ed0f..6ca25b1b2 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -120,6 +120,10 @@ Other major changes by @brodybits in 2015: - react-native-sqlite-storage version for Android and iOS developed and maintained by @andpor (Andrzej Porebski ), based on this project +## Major changes 2016 + +- Windows version removed from this version branch (available in cordova-sqlite-ext or Cordova-sqlite-legacy versions) + ## Recent changes See CHANGES.md diff --git a/README.md b/README.md index b53dee7f9..0e8b3cf8b 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Cordova/PhoneGap sqlite storage adapter (common-src branch) -Native interface to sqlite in a Cordova/PhoneGap plugin for Android, iOS, and Windows "Universal" (8.1), with API similar to HTML5/[Web SQL API](http://www.w3.org/TR/webdatabase/). +Native interface to sqlite in a Cordova/PhoneGap plugin for Android, _and_ iOS, ~~and Windows "Universal" (8.1),~~ with API similar to HTML5/[Web SQL API](http://www.w3.org/TR/webdatabase/). -License for Android and Windows "Universal" (8.1) versions: MIT or Apache 2.0 +License for Android ~~and Windows "Universal" (8.1)~~ version~~s~~: MIT or Apache 2.0 License for iOS version: MIT only -This version branch contains the source code for the Android, iOS, and Windows "Universal" (8.1) versions. This version branch does not contain any libraries or source code from www.sqlite.org. This version branch uses the built-in sqlite libraries on Android and iOS. +This version branch contains the source code for the Android, iOS~~, and Windows "Universal" (8.1)~~ versions. This version branch does not contain any libraries or source code from www.sqlite.org. This version branch uses the built-in sqlite libraries on Android and iOS. NOTE (TBD): no Circle CI or Travis CI working in this version branch. @@ -43,17 +43,18 @@ I raised [Cordova bug CB-9830](https://issues.apache.org/jira/browse/CB-9830) to ## Status +- Windows "Universal" version is removed from this version branch. - WP(7/8) is not supported by this version branch (TBD link to where WP(7/8) will be supported) - The following features are moved to [litehelpers / cordova-sqlite-ext](https://github.com/litehelpers/cordova-sqlite-ext) and removed from this project: - REGEXP support - Pre-populated database - Amazon Fire-OS is dropped due to lack of support by Cordova. Android version should be used to deploy to Fire-OS 5.0(+) devices ref: [cordova/cordova-discuss#32 (comment)](https://github.com/cordova/cordova-discuss/issues/32#issuecomment-167021676) -- Windows "Universal" for Windows 8.0/8.1(+) and Windows Phone 8.1(+) version is in an alpha state: - - Issue with UNICODE `\u0000` character (same as `\0`) - - No background processing (for future consideration) - - You *may* encounter issues with Cordova CLI due to [CB-8866](https://issues.apache.org/jira/browse/CB-8866). *Old workaround:* you can install using [litehelpers / cordova-windows-nufix](https://github.com/litehelpers/cordova-windows-nufix) and `plugman` as described below. - - In addition, problems with the Windows "Universal" version have been reported in case of a Cordova project using a Visual Studio template/extension instead of Cordova/PhoneGap CLI or `plugman` - - Not tested with a Windows 10 (or Windows Phone 10) target; Windows 10 build is not expected to work with Windows Phone +- ~~Windows "Universal" for Windows 8.0/8.1(+) and Windows Phone 8.1(+) version is in an alpha state:~~ + - ~~Issue with UNICODE `\u0000` character (same as `\0`)~~ + - ~~No background processing (for future consideration)~~ + - ~~You *may* encounter issues with Cordova CLI due to [CB-8866](https://issues.apache.org/jira/browse/CB-8866). *Old workaround:* you can install using [litehelpers / cordova-windows-nufix](https://github.com/litehelpers/cordova-windows-nufix) and `plugman` as described below.~~ + - ~~In addition, problems with the Windows "Universal" version have been reported in case of a Cordova project using a Visual Studio template/extension instead of Cordova/PhoneGap CLI or `plugman`~~ + - ~~Not tested with a Windows 10 (or Windows Phone 10) target; Windows 10 build is not expected to work with Windows Phone~~ - FTS3, FTS4, and R-Tree support is tested working OK in this version (for all target platforms in this version branch Android/iOS/Windows "Universal") - Android is supported back to SDK 10 (a.k.a. Gingerbread, Android 2.3.3); support for older versions is available upon request. - API to open the database may be changed somewhat to be more streamlined. Transaction and single-statement query API will NOT be changed. @@ -97,7 +98,7 @@ I raised [Cordova bug CB-9830](https://issues.apache.org/jira/browse/CB-9830) to - Memory issue observed when adding a large number of records due to the JSON implementation which is improved in [litehelpers / Cordova-sqlite-enterprise-free](https://github.com/litehelpers/Cordova-sqlite-enterprise-free) (available with a different licensing scheme) - A stability issue was reported on the iOS version when in use together with [SockJS](http://sockjs.org/) client such as [pusher-js](https://github.com/pusher/pusher-js) at the same time (see [litehelpers/Cordova-sqlite-storage#196](https://github.com/litehelpers/Cordova-sqlite-storage/issues/196)). The workaround is to call sqlite functions and [SockJS](http://sockjs.org/) client functions in separate ticks (using setTimeout with 0 timeout). - If a sql statement fails for which there is no error handler or the error handler does not return `false` to signal transaction recovery, the plugin fires the remaining sql callbacks before aborting the transaction. -- In case of an error, the error `code` member is bogus on Android and Windows (fixed for Android in [litehelpers / Cordova-sqlite-enterprise-free](https://github.com/litehelpers/Cordova-sqlite-enterprise-free)). +- In case of an error, the error `code` member is bogus on Android ~~and Windows~~ (fixed for Android in [litehelpers / Cordova-sqlite-enterprise-free](https://github.com/litehelpers/Cordova-sqlite-enterprise-free)). - Possible crash on Android when using Unicode emoji characters due to [Android bug 81341](https://code.google.com/p/android/issues/detail?id=81341), which _should_ be fixed in Android 6.x - In-memory database `db=window.sqlitePlugin.openDatabase({name: ":memory:"})` is currently not supported. - Close database bugs described below. @@ -116,7 +117,7 @@ I raised [Cordova bug CB-9830](https://issues.apache.org/jira/browse/CB-9830) to - The Android version cannot work with more than 100 open db files (due to the threading model used). - UNICODE line separator (`\u2028`) and paragraph separator (`\u2029`) are currently not supported and known to be broken in iOS version due to [Cordova bug CB-9435](https://issues.apache.org/jira/browse/CB-9435). - Blob type is currently not supported and known to be broken on multiple platforms. -- UNICODE `\u0000` (same as `\0`) character not working in Android (default native database implementation), Windows "Universal" (8.1/XX), ~~or _(in another version branch)_ WP(7/8)~~ +- UNICODE `\u0000` (same as `\0`) character not working in Android (default native database implementation)~~, Windows "Universal" (8.1/XX), or _(in another version branch)_ WP(7/8)~~ - Case-insensitive matching and other string manipulations on Unicode characters, which is provided by optional ICU integration in the sqlite source and working with recent versions of Android, is not supported for any target platforms. - iOS version uses a thread pool but with only one thread working at a time due to "synchronized" database access - Large query result can be slow, also due to JSON implementation @@ -148,7 +149,7 @@ I raised [Cordova bug CB-9830](https://issues.apache.org/jira/browse/CB-9830) to ## Common pitfall(s) - It is NOT allowed to execute sql statements on a transaction following the HTML5/[Web SQL API](http://www.w3.org/TR/webdatabase/), as described below. -- Not in this version branch: ~~It is possible to make a Windows Phone 8.1 project using either the `windows` platform or the `wp8` platform. The `windows` platform is highly recommended over `wp8` whenever possible. Also, some plugins only support `windows` and some plugins support only `wp8`.~~ +- ~~Not in this version branch: It is possible to make a Windows Phone 8.1 project using either the `windows` platform or the `wp8` platform. The `windows` platform is highly recommended over `wp8` whenever possible. Also, some plugins only support `windows` and some plugins support only `wp8`.~~ - The plugin class name starts with "SQL" in capital letters, but in Javascript the `sqlitePlugin` object name starts with "sql" in small letters. - Attempting to open a database before receiving the 'deviceready' event callback. - Inserting STRING into ID field @@ -363,7 +364,7 @@ You can find more details and a step-by-step description how to do this right in The threading model depends on which version is used: - For Android, one background thread per db; - for iOS, background processing using a very limited thread pool (only one thread working at a time); -- for Windows "Universal" (8.1), no background processing (for future consideration). +- ~~for Windows "Universal" (8.1), no background processing (for future consideration).~~ # Sample with PRAGMA feature @@ -532,26 +533,6 @@ Documentation at: http://ngcordova.com/docs/plugins/sqlite/ # Installing -## Windows "Universal" target platform - -**IMPORTANT:** There are issues supporing certain Windows target platforms due to [CB-8866](https://issues.apache.org/jira/browse/CB-8866): -- When using Visual Studio, the default target ("Mixed Platforms") will not work -- Problems have been with the Windows "Universal" version case of a Cordova project using a Visual Studio template/extension instead of Cordova/PhoneGap CLI or `plugman` - -*Old workaround:* As an alternative, which will support the ("Mixed Platforms") target, you can use `plugman` instead with [litehelpers / cordova-windows-nufix](https://github.com/litehelpers/cordova-windows-nufix), as described here. - -### Old workaround - Using plugman to support "Mixed Platforms" - -- make sure you have the latest version of `plugman` installed: `npm install -g plugman` -- Download the [cordova-windows-nufix 3.9.0-nufixpre-01 zipball](https://github.com/litehelpers/cordova-windows-nufix/archive/3.9.0-nufixpre-01.zip) (or you can clone [litehelpers / cordova-windows-nufix](https://github.com/litehelpers/cordova-windows-nufix) instead) -- Create your Windows "Universal" (8.1) project using [litehelpers / cordova-windows-nufix](https://github.com/litehelpers/cordova-windows-nufix): - - `path.to.cordova-windows-nufix/bin/create.bat your_app_path your.app.id YourAppName` -- `cd your_app_path` and install plugin using `plugman`: - - `plugman install --platform windows --project . --plugin https://github.com/litehelpers/cordova-sqlite-common` -- Put your sql program in your project `www` (don't forget to reference it from `www\index.html` and wait for `deviceready` event) - -Then your project in `CordovaApp.sln` should work with "Mixed Platforms" on both Windows 8.1 and Windows Phone 8.1. - ## Easy install with Cordova CLI tool npm install -g cordova # if you don't have cordova @@ -560,7 +541,7 @@ Then your project in `CordovaApp.sln` should work with "Mixed Platforms" on both You can find more details at [this writeup](http://iphonedevlog.wordpress.com/2014/04/07/installing-chris-brodys-sqlite-database-with-cordova-cli-android/). -**WARNING:** for Windows target platform please read the section above. +~~**WARNING:** for Windows target platform please read the section above.~~ **IMPORTANT:** sometimes you have to update the version for a platform before you can build, like: `cordova prepare ios` @@ -575,7 +556,7 @@ You can find more details at [this writeup](http://iphonedevlog.wordpress.com/20 plugman install --platform MYPLATFORM --project path.to.my.project.folder --plugin https://github.com/litehelpers/cordova-sqlite-common ``` -where MYPLATFORM is `android`, `ios`, or `windows`. +where MYPLATFORM is `android`, `ios`~~, or `windows`~~. A posting how to get started developing on Windows host without the Cordova CLI tool (for Android target only) is available [here](http://brodybits.blogspot.com/2015/03/trying-cordova-for-android-on-windows-without-cordova-cli.html). @@ -584,10 +565,10 @@ A posting how to get started developing on Windows host without the Cordova CLI - `SQLitePlugin.coffee.md`: platform-independent (Literate coffee-script, can be read by recent coffee-script compiler) - `www`: `SQLitePlugin.js` platform-independent Javascript as generated from `SQLitePlugin.coffee.md` (and checked in!) - `src`: platform-specific source code: - - `external` - placeholder used to import `sqlite3.[hc]` in this version branch-needed to build Windows "Universal" (8.1) version + - `external` - placeholder ~~used to import `sqlite3.[hc]` in this version branch-needed to build Windows "Universal" (8.1) version~~ - `android` - Java plugin code for Android - `ios` - Objective-C plugin code for iOS; - - `windows` - Javascript proxy code and SQLite3-WinRT project for Windows "Universal" (8.1); + - ~~`windows` - Javascript proxy code and SQLite3-WinRT project for Windows "Universal" (8.1);~~ - `spec`: test suite using Jasmine (2.2.0), ported from QUnit `test-www` test suite, working on all platforms - `tests`: very simple Jasmine test suite that is run on Circle CI (Android version) and Travis CI (iOS version) - `Lawnchair-adapter`: Lawnchair adaptor, based on the version from the Lawnchair repository, with the basic Lawnchair test suite in `test-www` subdirectory @@ -669,10 +650,6 @@ Sample change to `config.xml` for Cordova/PhoneGap 2.x: ``` -## Manual installation - Windows "Universal" (8.1) version - -Described above. - ## Quick installation test Assuming your app has a recent template as used by the Cordova create script, add the following code to the `onDeviceReady` function, after `app.receivedEvent('deviceready');`: diff --git a/plugin.xml b/plugin.xml index c159931dc..6d34fdd6f 100644 --- a/plugin.xml +++ b/plugin.xml @@ -59,23 +59,6 @@ - - - - - - - - - - - - - - - - - diff --git a/src/windows/SQLite3-WinRT/SQLite3/Constants.cpp b/src/windows/SQLite3-WinRT/SQLite3/Constants.cpp deleted file mode 100644 index 36803ba92..000000000 --- a/src/windows/SQLite3-WinRT/SQLite3/Constants.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "Constants.h" diff --git a/src/windows/SQLite3-WinRT/SQLite3/Constants.h b/src/windows/SQLite3-WinRT/SQLite3/Constants.h deleted file mode 100644 index 3910fa39c..000000000 --- a/src/windows/SQLite3-WinRT/SQLite3/Constants.h +++ /dev/null @@ -1,50 +0,0 @@ -#pragma once - -#include "sqlite3.h" - -namespace SQLite3 -{ - public ref class Datatype sealed - { - public: - static property int Integer { int get() { return SQLITE_INTEGER; } } - static property int Float { int get() { return SQLITE_FLOAT; } } - static property int Text { int get() { return SQLITE_TEXT; } } - static property int Blob { int get() { return SQLITE_BLOB; } } - static property int Null { int get() { return SQLITE_NULL; } } - }; - - public ref class ResultCode sealed - { - public: - static property int Ok { int get() { return SQLITE_OK; } } - static property int Error { int get() { return SQLITE_ERROR; } } - static property int Internal { int get() { return SQLITE_INTERNAL; } } - static property int Perm { int get() { return SQLITE_PERM; } } - static property int Abort { int get() { return SQLITE_ABORT; } } - static property int Busy { int get() { return SQLITE_BUSY; } } - static property int Locked { int get() { return SQLITE_LOCKED; } } - static property int NoMem { int get() { return SQLITE_NOMEM; } } - static property int ReadOnly { int get() { return SQLITE_READONLY; } } - static property int Interrupt { int get() { return SQLITE_INTERRUPT; } } - static property int IoErr { int get() { return SQLITE_IOERR; } } - static property int Corrupt { int get() { return SQLITE_CORRUPT; } } - static property int NotFound { int get() { return SQLITE_NOTFOUND; } } - static property int Full { int get() { return SQLITE_FULL; } } - static property int CantOpen { int get() { return SQLITE_CANTOPEN; } } - static property int Protocol { int get() { return SQLITE_PROTOCOL; } } - static property int Empty { int get() { return SQLITE_EMPTY; } } - static property int Schema { int get() { return SQLITE_SCHEMA; } } - static property int TooBig { int get() { return SQLITE_TOOBIG; } } - static property int Constraint { int get() { return SQLITE_CONSTRAINT; } } - static property int Mismatch { int get() { return SQLITE_MISMATCH; } } - static property int Misuse { int get() { return SQLITE_MISUSE; } } - static property int NoLfs { int get() { return SQLITE_NOLFS; } } - static property int Auth { int get() { return SQLITE_AUTH; } } - static property int Format { int get() { return SQLITE_FORMAT; } } - static property int Range { int get() { return SQLITE_RANGE; } } - static property int NotADb { int get() { return SQLITE_NOTADB; } } - static property int Row { int get() { return SQLITE_ROW; } } - static property int Done { int get() { return SQLITE_DONE; } } - }; -} diff --git a/src/windows/SQLite3-WinRT/SQLite3/Database.cpp b/src/windows/SQLite3-WinRT/SQLite3/Database.cpp deleted file mode 100644 index 20be1c26a..000000000 --- a/src/windows/SQLite3-WinRT/SQLite3/Database.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include "Winerror.h" - -#include "Database.h" -#include "Statement.h" - -namespace SQLite3 -{ - Database::Database(Platform::String^ dbPath) - : sqlite(nullptr) - { - int ret = sqlite3_open16(dbPath->Data(), &sqlite); - - if (ret != SQLITE_OK) - { - sqlite3_close(sqlite); - - HRESULT hresult = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, ret); - throw ref new Platform::COMException(hresult); - } - } - - Database::~Database() - { - if (sqlite != nullptr) sqlite3_close(sqlite); - } - - Statement^ Database::Prepare(Platform::String^ sql) - { - return ref new Statement(this, sql); - } - - int Database::closedb() - { - int rc = sqlite3_close(sqlite); - if (rc == SQLITE_OK) sqlite = nullptr; - return rc; - } - - int Database::close_v2() - { - int rc = sqlite3_close_v2(sqlite); - if (rc == SQLITE_OK) sqlite = nullptr; - return rc; - } - - int Database::LastInsertRowid() - { - return sqlite3_last_insert_rowid(sqlite); - } - - int Database::TotalChanges() - { - return sqlite3_total_changes(sqlite); - } -} diff --git a/src/windows/SQLite3-WinRT/SQLite3/Database.h b/src/windows/SQLite3-WinRT/SQLite3/Database.h deleted file mode 100644 index bb411e80b..000000000 --- a/src/windows/SQLite3-WinRT/SQLite3/Database.h +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once - -#include "sqlite3.h" - -namespace SQLite3 -{ - ref class Statement; - - public ref class Database sealed - { - public: - Database(Platform::String^ dbPath); - virtual ~Database(); - - int closedb(); - int close_v2(); - - Statement^ Prepare(Platform::String^ sql); - - int LastInsertRowid(); - int TotalChanges(); - - private: - friend Statement; - - sqlite3* sqlite; - }; -} diff --git a/src/windows/SQLite3-WinRT/SQLite3/SQLite3.Shared.vcxitems b/src/windows/SQLite3-WinRT/SQLite3/SQLite3.Shared.vcxitems deleted file mode 100644 index cd9e2a4bc..000000000 --- a/src/windows/SQLite3-WinRT/SQLite3/SQLite3.Shared.vcxitems +++ /dev/null @@ -1,37 +0,0 @@ - - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - true - {db84ae51-4b93-44f5-be22-1eae1833ecec} - SQLite3 - SQLite3.Shared - 248F659F-DAC5-46E8-AC09-60EC9FC95053 - - - - %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) - - - - - - - - - - - - false - - - - - - Create - - - - - - \ No newline at end of file diff --git a/src/windows/SQLite3-WinRT/SQLite3/SQLite3.Windows/SQLite3.Windows.vcxproj b/src/windows/SQLite3-WinRT/SQLite3/SQLite3.Windows/SQLite3.Windows.vcxproj deleted file mode 100644 index 5725a3137..000000000 --- a/src/windows/SQLite3-WinRT/SQLite3/SQLite3.Windows/SQLite3.Windows.vcxproj +++ /dev/null @@ -1,248 +0,0 @@ - - - - - - Debug - ARM - - - Debug - Win32 - - - Debug - x64 - - - Release - ARM - - - Release - Win32 - - - Release - x64 - - - - - {d1848fee-6a8e-4ef1-8bfb-8652e5a9cd4a} - SQLite3 - SQLite3 - en-US - 12.0 - true - Windows Store - 8.1 - CodeSharingWindowsRuntimeComponent - - - - - - DynamicLibrary - true - v120 - - - DynamicLibrary - true - v120 - - - DynamicLibrary - true - v120 - - - DynamicLibrary - false - true - v120 - - - DynamicLibrary - false - true - v120 - - - DynamicLibrary - false - true - v120 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - false - - - - false - - - - false - - - - false - - - - false - - - - false - - - - - NotUsing - _WINRT_DLL;%(PreprocessorDefinitions) - pch.h - $(IntDir)pch.pch - $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) - /bigobj %(AdditionalOptions) - 28204 - %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory);$(MSBuildThisFileDirectory)..\..\..\..\common;$(MSBuildThisFileDirectory)..\..\..\..\external - - - Console - runtimeobject.lib;%(AdditionalDependencies) - false - - - - - - NotUsing - _WINRT_DLL;NDEBUG;%(PreprocessorDefinitions) - pch.h - $(IntDir)pch.pch - $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) - /bigobj %(AdditionalOptions) - 28204 - %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory);$(MSBuildThisFileDirectory)..\..\..\..\common;$(MSBuildThisFileDirectory)..\..\..\..\external - - - Console - runtimeobject.lib;%(AdditionalDependencies) - false - - - - - - NotUsing - _WINRT_DLL;%(PreprocessorDefinitions) - pch.h - $(IntDir)pch.pch - $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) - /bigobj %(AdditionalOptions) - 28204 - %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory);$(MSBuildThisFileDirectory)..\..\..\..\common;$(MSBuildThisFileDirectory)..\..\..\..\external - true - - - Console - runtimeobject.lib;%(AdditionalDependencies) - false - - - - - - NotUsing - _WINRT_DLL;NDEBUG;%(PreprocessorDefinitions) - pch.h - $(IntDir)pch.pch - $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) - /bigobj %(AdditionalOptions) - 28204 - %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory);$(MSBuildThisFileDirectory)..\..\..\..\common;$(MSBuildThisFileDirectory)..\..\..\..\external - true - - - Console - runtimeobject.lib;%(AdditionalDependencies) - false - - - - - - NotUsing - _WINRT_DLL;%(PreprocessorDefinitions) - pch.h - $(IntDir)pch.pch - $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) - /bigobj %(AdditionalOptions) - 28204 - %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory);$(MSBuildThisFileDirectory)..\..\..\..\common;$(MSBuildThisFileDirectory)..\..\..\..\external - - - Console - runtimeobject.lib;%(AdditionalDependencies) - false - - - - - - NotUsing - _WINRT_DLL;NDEBUG;%(PreprocessorDefinitions) - pch.h - $(IntDir)pch.pch - $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) - /bigobj %(AdditionalOptions) - 28204 - %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory);$(MSBuildThisFileDirectory)..\..\..\..\common;$(MSBuildThisFileDirectory)..\..\..\..\external - - - Console - runtimeobject.lib;%(AdditionalDependencies) - false - - - - - - - - - diff --git a/src/windows/SQLite3-WinRT/SQLite3/SQLite3.WindowsPhone/SQLite3.WindowsPhone.vcxproj b/src/windows/SQLite3-WinRT/SQLite3/SQLite3.WindowsPhone/SQLite3.WindowsPhone.vcxproj deleted file mode 100644 index 4c7b654b2..000000000 --- a/src/windows/SQLite3-WinRT/SQLite3/SQLite3.WindowsPhone/SQLite3.WindowsPhone.vcxproj +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - Debug - ARM - - - Debug - Win32 - - - Release - ARM - - - Release - Win32 - - - - - {6435c2e4-4fd2-405a-9ee2-5312ae852782} - SQLite3 - SQLite3 - en-US - 12.0 - true - Windows Phone - 8.1 - CodeSharingWindowsRuntimeComponent - - - - - - DynamicLibrary - true - v120_wp81 - - - DynamicLibrary - true - v120_wp81 - - - DynamicLibrary - false - true - v120_wp81 - - - DynamicLibrary - false - true - v120_wp81 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - NotUsing - _WINRT_DLL;%(PreprocessorDefinitions) - pch.h - $(IntDir)pch.pch - /bigobj %(AdditionalOptions) - true - %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory);$(MSBuildThisFileDirectory)..\..\..\..\common;$(MSBuildThisFileDirectory)..\..\..\..\external - - - Console - false - - - - - - NotUsing - _WINRT_DLL;NDEBUG;%(PreprocessorDefinitions) - pch.h - $(IntDir)pch.pch - /bigobj %(AdditionalOptions) - true - %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory);$(MSBuildThisFileDirectory)..\..\..\..\common;$(MSBuildThisFileDirectory)..\..\..\..\external - - - Console - false - - - - - - NotUsing - _WINRT_DLL;%(PreprocessorDefinitions) - pch.h - $(IntDir)pch.pch - /bigobj %(AdditionalOptions) - true - %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory);$(MSBuildThisFileDirectory)..\..\..\..\common;$(MSBuildThisFileDirectory)..\..\..\..\external - true - - - Console - false - - - - - - NotUsing - _WINRT_DLL;NDEBUG;%(PreprocessorDefinitions) - pch.h - $(IntDir)pch.pch - /bigobj %(AdditionalOptions) - true - %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory);$(MSBuildThisFileDirectory)..\..\..\..\common;$(MSBuildThisFileDirectory)..\..\..\..\external - true - - - Console - false - - - - - - - - diff --git a/src/windows/SQLite3-WinRT/SQLite3/SQLite3.sln b/src/windows/SQLite3-WinRT/SQLite3/SQLite3.sln deleted file mode 100644 index 2e30775e4..000000000 --- a/src/windows/SQLite3-WinRT/SQLite3/SQLite3.sln +++ /dev/null @@ -1,60 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Express 2013 for Windows -VisualStudioVersion = 12.0.30501.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SQLite3", "SQLite3", "{F0B5DA26-91CD-44D3-97C8-19B43134837E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite3.Shared", "SQLite3\SQLite3.Shared\SQLite3.Shared.vcxitems", "{DB84AE51-4B93-44F5-BE22-1EAE1833ECEC}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite3.Windows", "SQLite3\SQLite3.Windows\SQLite3.Windows.vcxproj", "{D1848FEE-6A8E-4EF1-8BFB-8652E5A9CD4A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite3.WindowsPhone", "SQLite3\SQLite3.WindowsPhone\SQLite3.WindowsPhone.vcxproj", "{6435C2E4-4FD2-405A-9EE2-5312AE852782}" -EndProject -Global - GlobalSection(SharedMSBuildProjectFiles) = preSolution - SQLite3\SQLite3.Shared\SQLite3.Shared.vcxitems*{db84ae51-4b93-44f5-be22-1eae1833ecec}*SharedItemsImports = 9 - SQLite3\SQLite3.Shared\SQLite3.Shared.vcxitems*{d1848fee-6a8e-4ef1-8bfb-8652e5a9cd4a}*SharedItemsImports = 4 - SQLite3\SQLite3.Shared\SQLite3.Shared.vcxitems*{6435c2e4-4fd2-405a-9ee2-5312ae852782}*SharedItemsImports = 4 - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|ARM = Debug|ARM - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|ARM = Release|ARM - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D1848FEE-6A8E-4EF1-8BFB-8652E5A9CD4A}.Debug|ARM.ActiveCfg = Debug|ARM - {D1848FEE-6A8E-4EF1-8BFB-8652E5A9CD4A}.Debug|ARM.Build.0 = Debug|ARM - {D1848FEE-6A8E-4EF1-8BFB-8652E5A9CD4A}.Debug|Win32.ActiveCfg = Debug|Win32 - {D1848FEE-6A8E-4EF1-8BFB-8652E5A9CD4A}.Debug|Win32.Build.0 = Debug|Win32 - {D1848FEE-6A8E-4EF1-8BFB-8652E5A9CD4A}.Debug|x64.ActiveCfg = Debug|x64 - {D1848FEE-6A8E-4EF1-8BFB-8652E5A9CD4A}.Debug|x64.Build.0 = Debug|x64 - {D1848FEE-6A8E-4EF1-8BFB-8652E5A9CD4A}.Release|ARM.ActiveCfg = Release|ARM - {D1848FEE-6A8E-4EF1-8BFB-8652E5A9CD4A}.Release|ARM.Build.0 = Release|ARM - {D1848FEE-6A8E-4EF1-8BFB-8652E5A9CD4A}.Release|Win32.ActiveCfg = Release|Win32 - {D1848FEE-6A8E-4EF1-8BFB-8652E5A9CD4A}.Release|Win32.Build.0 = Release|Win32 - {D1848FEE-6A8E-4EF1-8BFB-8652E5A9CD4A}.Release|x64.ActiveCfg = Release|x64 - {D1848FEE-6A8E-4EF1-8BFB-8652E5A9CD4A}.Release|x64.Build.0 = Release|x64 - {6435C2E4-4FD2-405A-9EE2-5312AE852782}.Debug|ARM.ActiveCfg = Debug|ARM - {6435C2E4-4FD2-405A-9EE2-5312AE852782}.Debug|ARM.Build.0 = Debug|ARM - {6435C2E4-4FD2-405A-9EE2-5312AE852782}.Debug|Win32.ActiveCfg = Debug|Win32 - {6435C2E4-4FD2-405A-9EE2-5312AE852782}.Debug|Win32.Build.0 = Debug|Win32 - {6435C2E4-4FD2-405A-9EE2-5312AE852782}.Debug|x64.ActiveCfg = Debug|Win32 - {6435C2E4-4FD2-405A-9EE2-5312AE852782}.Release|ARM.ActiveCfg = Release|ARM - {6435C2E4-4FD2-405A-9EE2-5312AE852782}.Release|ARM.Build.0 = Release|ARM - {6435C2E4-4FD2-405A-9EE2-5312AE852782}.Release|Win32.ActiveCfg = Release|Win32 - {6435C2E4-4FD2-405A-9EE2-5312AE852782}.Release|Win32.Build.0 = Release|Win32 - {6435C2E4-4FD2-405A-9EE2-5312AE852782}.Release|x64.ActiveCfg = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {DB84AE51-4B93-44F5-BE22-1EAE1833ECEC} = {F0B5DA26-91CD-44D3-97C8-19B43134837E} - {D1848FEE-6A8E-4EF1-8BFB-8652E5A9CD4A} = {F0B5DA26-91CD-44D3-97C8-19B43134837E} - {6435C2E4-4FD2-405A-9EE2-5312AE852782} = {F0B5DA26-91CD-44D3-97C8-19B43134837E} - EndGlobalSection -EndGlobal diff --git a/src/windows/SQLite3-WinRT/SQLite3/Statement.cpp b/src/windows/SQLite3-WinRT/SQLite3/Statement.cpp deleted file mode 100644 index 50fdea13f..000000000 --- a/src/windows/SQLite3-WinRT/SQLite3/Statement.cpp +++ /dev/null @@ -1,90 +0,0 @@ -#include "Winerror.h" - -#include "Statement.h" -#include "Database.h" - -namespace SQLite3 -{ - Statement::Statement(Database^ database, Platform::String^ sql) - { - int ret = sqlite3_prepare16(database->sqlite, sql->Data(), -1, &statement, 0); - - if (ret != SQLITE_OK) - { - sqlite3_finalize(statement); - - HRESULT hresult = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, ret); - throw ref new Platform::COMException(hresult); - } - } - - Statement::~Statement() - { - sqlite3_finalize(statement); - } - - int Statement::Step() - { - return sqlite3_step(statement); - } - - int Statement::ColumnCount() - { - return sqlite3_column_count(statement); - } - - int Statement::ColumnType(int index) - { - return sqlite3_column_type(statement, index); - } - - Platform::String^ Statement::ColumnName(int index) - { - return ref new Platform::String(static_cast(sqlite3_column_name16(statement, index))); - } - - Platform::String^ Statement::ColumnText(int index) - { - return ref new Platform::String(static_cast(sqlite3_column_text16(statement, index))); - } - - int Statement::ColumnInt(int index) - { - return sqlite3_column_int(statement, index); - } - - long long Statement::ColumnInt64(int index) - { - return sqlite3_column_int64(statement, index); - } - - double Statement::ColumnDouble(int index) - { - return sqlite3_column_double(statement, index); - } - - int Statement::BindText(int index, Platform::String^ val) - { - return sqlite3_bind_text16(statement, index, val->Data(), -1, SQLITE_TRANSIENT); - } - - int Statement::BindInt(int index, int val) - { - return sqlite3_bind_int(statement, index, val); - } - - int Statement::BindInt64(int index, long long val) - { - return sqlite3_bind_int64(statement, index, val); - } - - int Statement::BindDouble(int index, double val) - { - return sqlite3_bind_double(statement, index, val); - } - - int Statement::BindNull(int index) - { - return sqlite3_bind_null(statement, index); - } -} diff --git a/src/windows/SQLite3-WinRT/SQLite3/Statement.h b/src/windows/SQLite3-WinRT/SQLite3/Statement.h deleted file mode 100644 index 5f0c1bc7d..000000000 --- a/src/windows/SQLite3-WinRT/SQLite3/Statement.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once - -#include "sqlite3.h" - -namespace SQLite3 -{ - ref class Database; - - public ref class Statement sealed - { - public: - Statement(Database^ database, Platform::String^ sql); - virtual ~Statement(); - - int Step(); - - int ColumnCount(); - int ColumnType(int index); - Platform::String^ ColumnName(int index); - - Platform::String^ ColumnText(int index); - int ColumnInt(int index); - long long ColumnInt64(int index); - double ColumnDouble(int index); - - int BindText(int index, Platform::String^ val); - int BindInt(int index, int val); - int BindInt64(int index, long long val); - int BindDouble(int index, double val); - int BindNull(int index); - - private: - sqlite3_stmt* statement; - }; -} diff --git a/src/windows/SQLite3-WinRT/SQLite3/pch.cpp b/src/windows/SQLite3-WinRT/SQLite3/pch.cpp deleted file mode 100644 index bcb5590be..000000000 --- a/src/windows/SQLite3-WinRT/SQLite3/pch.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "pch.h" diff --git a/src/windows/SQLite3-WinRT/SQLite3/pch.h b/src/windows/SQLite3-WinRT/SQLite3/pch.h deleted file mode 100644 index 10fe677c7..000000000 --- a/src/windows/SQLite3-WinRT/SQLite3/pch.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -#include -#include diff --git a/src/windows/SQLite3-WinRT/SQLite3JS/js/SQLite3.js b/src/windows/SQLite3-WinRT/SQLite3JS/js/SQLite3.js deleted file mode 100644 index 687123aea..000000000 --- a/src/windows/SQLite3-WinRT/SQLite3JS/js/SQLite3.js +++ /dev/null @@ -1,287 +0,0 @@ -(function () { - "use strict"; - - var Statement, Database, ItemDataSource, GroupDataSource; - - // Alternative typeof implementation yielding more meaningful results, - // see http://javascriptweblog.wordpress.com/2011/08/08/fixing-the-javascript-typeof-operator/ - function type(obj) { - var typeString; - - typeString = Object.prototype.toString.call(obj); - return typeString.substring(8, typeString.length - 1).toLowerCase(); - } - - function throwSQLiteError(message, comException) { - var error = new Error(message); - error.resultCode = comException.number & 0xffff; - throw error; - } - - Statement = WinJS.Class.define(function (db, sql, args) { - try { - this.statement = db.connection.prepare(sql); - } catch (comException) { - throwSQLiteError('Error preparing an SQLite statement.', comException); - } - - if (args) { - this.bind(args); - } - }, { - bind: function (args) { - var index, resultCode; - - args.forEach(function (arg, i) { - index = i + 1; - switch (type(arg)) { - case 'number': - if (arg % 1 === 0) { - resultCode = this.statement.bindInt64(index, arg); - } else { - resultCode = this.statement.bindDouble(index, arg); - } - break; - case 'string': - resultCode = this.statement.bindText(index, arg); - break; - case 'null': - resultCode = this.statement.bindNull(index); - break; - default: - throw new Error("Unsupported argument type: " + type(arg)); - } - if (resultCode !== SQLite3.ResultCode.ok) { - throw new Error("Error " + resultCode + " when binding argument to SQL query."); - } - }, this); - }, - run: function () { - this.statement.step(); - }, - one: function () { - this.statement.step(); - return this._getRow(); - }, - all: function () { - var result = []; - - this.each(function (row) { - result.push(row); - }); - return result; - }, - each: function (callback) { - while (this.statement.step() === SQLite3.ResultCode.row) { - callback(this._getRow()); - } - }, - map: function (callback) { - var result = []; - - this.each(function (row) { - result.push(callback(row)); - }); - return result; - }, - close: function () { - this.statement.close(); - }, - _getRow: function () { - var i, len, name, row = {}; - - for (i = 0, len = this.statement.columnCount() ; i < len; i += 1) { - name = this.statement.columnName(i); - row[name] = this._getColumn(i); - } - - return row; - }, - _getColumn: function (index) { - switch (this.statement.columnType(index)) { - case SQLite3.Datatype.integer: - return this.statement.columnInt64(index); - case SQLite3.Datatype.float: - return this.statement.columnDouble(index); - case SQLite3.Datatype.text: - return this.statement.columnText(index); - case SQLite3.Datatype["null"]: - return null; - default: - throw new Error('Unsupported column type in column ' + index); - } - } - }); - - Database = WinJS.Class.define(function (dbPath) { - try { - this.connection = SQLite3.Database(dbPath); - } catch (comException) { - throwSQLiteError('Error creating an SQLite database connection.', comException); - } - }, { - run: function (sql, args) { - var statement = this.prepare(sql, args); - - statement.run(); - statement.close(); - }, - one: function (sql, args) { - var row, statement = this.prepare(sql, args); - - row = statement.one(); - statement.close(); - return row; - }, - all: function (sql, args) { - var rows, statement = this.prepare(sql, args); - - rows = statement.all(); - statement.close(); - return rows; - }, - each: function (sql, args, callback) { - if (!callback && type(args) === 'function') { - callback = args; - args = null; - } - - var statement = this.prepare(sql, args); - - statement.each(callback); - statement.close(); - }, - map: function (sql, args, callback) { - if (!callback && type(args) === 'function') { - callback = args; - args = null; - } - - var rows, statement = this.prepare(sql, args); - - rows = statement.map(callback); - statement.close(); - return rows; - }, - prepare: function (sql, args) { - return new Statement(this, sql, args); - }, - itemDataSource: function (sql, args, keyColumnName, groupKeyColumnName) { - if (type(args) === 'string') { - groupKeyColumnName = keyColumnName; - keyColumnName = args; - args = undefined; - } - - return new ItemDataSource(this, sql, args, keyColumnName, groupKeyColumnName); - }, - groupDataSource: function (sql, args, keyColumnName, sizeColumnName) { - if (type(args) === 'string') { - sizeColumnName = keyColumnName; - keyColumnName = args; - args = undefined; - } - - return new GroupDataSource(this, sql, args, keyColumnName, sizeColumnName); - }, - close: function () { - return this.connection.closedb(); - }, - close_v2: function () { - return this.connection.close_v2(); - }, - lastInsertRowid: function () { - return this.connection.lastInsertRowid(); - }, - totalChanges: function () { - return this.connection.totalChanges(); - } - }); - - ItemDataSource = WinJS.Class.derive(WinJS.UI.VirtualizedDataSource, - function (db, sql, args, keyColumnName, groupKeyColumnName) { - var dataAdapter = { - getCount: function () { - var row = db.one('SELECT COUNT(*) AS cnt FROM (' + sql + ')', args); - return WinJS.Promise.wrap(row.cnt); - }, - itemsFromIndex: function (requestIndex, countBefore, countAfter) { - var items, - limit = countBefore + 1 + countAfter, - offset = requestIndex - countBefore; - - items = db.map( - 'SELECT * FROM (' + sql + ') LIMIT ' + limit + ' OFFSET ' + offset, - function (row) { - var item = { - key: row[keyColumnName].toString(), - data: row - }; - if (groupKeyColumnName) { - item.groupKey = row[groupKeyColumnName].toString(); - } - return item; - }); - - return WinJS.Promise.wrap({ - items: items, - offset: countBefore, - atEnd: items.length < limit - }); - } - }; - - this._baseDataSourceConstructor(dataAdapter); - } - ); - - GroupDataSource = WinJS.Class.derive(WinJS.UI.VirtualizedDataSource, - function (db, sql, args, keyColumnName, sizeColumnName) { - var groups, - dataAdapter, - keyIndexMap = {}, - groupIndex = 0, - firstItemIndex = 0; - - groups = db.map(sql, args, function (row) { - var item = { - key: row[keyColumnName].toString(), - groupSize: row[sizeColumnName], - firstItemIndexHint: firstItemIndex, - data: row - }; - - keyIndexMap[item.key] = groupIndex; - groupIndex += 1; - firstItemIndex += item.groupSize; - - return item; - }); - - dataAdapter = { - getCount: function () { - return WinJS.Promise.wrap(groups.length); - }, - itemsFromIndex: function (requestIndex, countBefore, countAfter) { - return WinJS.Promise.wrap({ - items: groups.slice(), - offset: requestIndex, - absoluteIndex: requestIndex, - atStart: true, - atEnd: true - }); - }, - itemsFromKey: function (key, countBefore, countAfter) { - return this.itemsFromIndex(keyIndexMap[key], countBefore, countAfter); - } - }; - - this._baseDataSourceConstructor(dataAdapter); - } - ); - - WinJS.Namespace.define('SQLite3JS', { - Database: Database - }); - -}()); diff --git a/src/windows/SQLiteProxy.js b/src/windows/SQLiteProxy.js deleted file mode 100644 index 74985c91a..000000000 --- a/src/windows/SQLiteProxy.js +++ /dev/null @@ -1,162 +0,0 @@ -var dbmap = {}; - -var nextTick = window.setImmediate || function(fun) { - window.setTimeout(fun, 0); -}; - -function handle(p, win, fail) { - if (p) - p.done( - function (res) { - if (res[1]) - fail(res[1]); - else - win(res[0]?JSON.parse(res[0]):[]); - }, - function (err) { - fail(err); - } - ); -} - -module.exports = { - open: function(win, fail, args) { - var options = args[0]; - var res; - - function openImmediate(dbname) { - //var dbname = options.name; - // from @EionRobb / phonegap-win8-sqlite: - var opendbname = Windows.Storage.ApplicationData.current.localFolder.path + "\\" + dbname; - console.log("open db name: " + dbname + " at full path: " + opendbname); - - var db = new SQLite3JS.Database(opendbname); - dbmap[dbname] = db; - nextTick(function() { - win(); - }); - //res = SQLitePluginRT.SQLitePlugin.openAsync(options.name); - } - - try { - //res = SQLitePluginRT.SQLitePlugin.openAsync(options.name); - var dbname = options.name; - - openImmediate(dbname); - } catch(ex) { - //fail(ex); - nextTick(function() { - fail(ex); - }); - } - //handle(res, win, fail); - }, - close: function(win, fail, args) { - var options = args[0]; - var res; - try { - //res = SQLitePluginRT.SQLitePlugin.closeAsync(JSON.stringify(options)); - var dbname = options.path; - nextTick(function() { - if (!!dbmap[dbname] && dbmap[dbname].close() == 0) { - delete dbmap[dbname]; - win(); - } else { - fail(); // XXX TODO REPORT ERROR - } - }); - } catch (ex) { - fail(ex); - } - //handle(res, win, fail); - }, - backgroundExecuteSqlBatch: function(win, fail, args) { - var options = args[0]; - var dbname = options.dbargs.dbname; - var executes = options.executes; - //var executes = options.executes.map(function (e) { return [String(e.qid), e.sql, e.params]; }); - var db = dbmap[dbname]; - var results = []; - var i, count=executes.length; - //console.log("executes: " + JSON.stringify(executes)); - //console.log("execute sql count: " + count); - for (i=0; i 0) { - var lastInsertRowid = db.lastInsertRowid(); - if (lastInsertRowid !== 0) result.insertId = lastInsertRowid; - } - results.push({ - type: "success", - qid: e.qid, - result: result - }); - } catch(ex) { - console.log("sql exception error: " + ex.message); - results.push({ - type: "error", - qid: e.qid, - result: { code: -1, message: ex.message } - }); - } - } - //console.log("return results: " + JSON.stringify(results)); - nextTick(function() { - //console.log("return results: " + JSON.stringify(results)); - win(results); - }); - }, - "delete": function(win, fail, args) { - var options = args[0]; - var res; - try { - //res = SQLitePluginRT.SQLitePlugin.deleteAsync(JSON.stringify(options)); - var dbname = options.path; - - WinJS.Application.local.exists(dbname).then(function(isExisting) { - if (!isExisting) { - // XXX FUTURE TBD consistent for all platforms: - fail("file does not exist"); - return; - } - - if (!!dbmap[dbname]) { - dbmap[dbname].close_v2(); - - delete dbmap[dbname]; - } - - //console.log('test db name: ' + dbname); - Windows.Storage.ApplicationData.current.localFolder.getFileAsync(dbname) - .then(function (dbfile) { - //console.log('get db file to delete ok'); - return dbfile.deleteAsync(Windows.Storage.StorageDeleteOption.permanentDelete); - }, function (e) { - console.log('get file failure: ' + JSON.stringify(e)); - // XXX FUTURE TBD consistent for all platforms: - fail(e); - }).then(function () { - //console.log('delete ok'); - win(); - }, function (e) { - console.log('delete failure: ' + JSON.stringify(e)); - // XXX FUTURE TBD consistent for all platforms: - fail(e); - }); - - }); - - } catch(ex) { - fail(ex); - } - //handle(res, win, fail); - } -}; -require("cordova/exec/proxy").add("SQLitePlugin", module.exports);