-
Notifications
You must be signed in to change notification settings - Fork 715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: initial browser platform #576
base: dev
Are you sure you want to change the base?
Conversation
Hi @brodybits Please, when is this going to be released? Thanks for the great work. Arcadius |
Thanks @arcadius for your interest. The thing is that there are some differences in behavior between this plugin and WebKit Web SQL on chrome listed in https://github.com/litehelpers/Cordova-sqlite-storage#deviations, which could trip developers who develop on Chrome browser and then run on a mobile platform. I will probably need a couple months or so to clear the most serious deviations before releasing. Priority feature support goes to paid customers, please contact [email protected] for more details. |
Thanks @brodybits for the detailed info 👍 |
NOTE: This is an initial implementation with some major items missing including: - echoTest/selfTest - sqlBatch - deleteDatabase Also broken: error handling Certain tests are disabled due to timeouts. Quite a few more tests will need to be adapted to work with the browser platform.
69dda76
to
334aedb
Compare
XXX TBD TODOs: - tests do not always check actual results on browser - document some behavior differences - TBD open/close/delete - TODO fix self test - check that tests continue to pass on other platforms - run tests on Chrome browser on Windows
Hi @brodybits any idea when this would be released? Thank you for such a wonderful plugin. |
How can I use this feature? |
You should be able to use Git to checkout my P.S. The |
Hi, in my case I need a better than chrome implementation of SQLite in browser. My application use attach database an cross database joins functionality and that is not possible on chrome sqlite implementation. So i started to develop the browser platform for the pllugin using https://github.com/kripken/sql.js/. One of the thing i use it's the cordova-proxy used in cordova-plugin-file plugin to capture all cordova calls to redirect that calls for browser platform. It means that SQLitePLugin.js doesn't need to be modified and the proxy work is the same as android/ios plugin. @brodybits Do you think it is interesting for the project? |
From what I saw sql.js only stores in a memory database, does NOT read or write to actual sqlite3 database files. Please share a clear pointer in case I am mistaken here.
Sounds interesting but I do not see this. It would be great if you can share a pointer.
Probably not due to the extra overhead and complexity. Please report here or in private to [email protected] if you publish a fork or new project using SQL.js. I would be happy to link to it if it would be sufficiently useful for some other users. |
My idea is to execute selenium test on the browser. This is why I started to work in cordova platform browser. SQL.js is fast enough, work well, and support complex sqlite querys like attach. It consume a lot of memory, in my case 500mb with 200mb database. It's true that it is an in memory database, but you can export and import to browser persistent filesystem quite fast. The code to support browser platform is easy and does not affect to other platforms like android or iOS. I don't know how to share my code, maybe a gist ? |
Hi @lasterra, It sounds good whether you want to share your implementation as a gist or as a whole project on GitHub. (It may help some more people if you share it as a fork or new project on GitHub.) I will probably want to link to it, in case it may help some others. Also, the memory usage does not surprise me. |
My colleagues and I just discussed the question of Web SQL vs. sql.js. To get an overview, I assembled a feature matrix:
For our team, the decision was obvious. sql.js covers everything we need, while Web SQL is only supported on two browsers, and even these two may remove support at any time. We would very much like to see a port to sql.js! Other teams may have very different requirements, of course. If persistence is a key requirement, Web SQL may look better. |
@DanielSWolf thanks for the feedback, you already got a couple thumbs up. I have the following remarks:
In case of cordova-sqlite-storage and cordova-sqlite-ext I generally prefer to keep the binary and other bulky dependencies (such as sqlite3.[hc]) in a separate npm package that is already added by a before_plugin_install hook script. It should be no problem for this to work with SQL.js but I would like to test it before making any promises on this plugin version. Using SQL.js should be no problem on cordova-sqlite-evcore-extbuild-free and upcoming evmax plugin versions, though it may be a slightly breaking change. |
I started working on implementation of browser support using SQL.js in #774, discovered something I had overlooked: browser support using SQL.js will NOT work across page changes in a multi-page app due to lack of actual persistence. Recommendation for those who need persistence on browser platform and those who want browser platform support TODAY is to use brodybits / sql-promise-helper; how to use brodybits / sql-promise-helper on browser platform is described in brodycj/sql-promise-helper#4. |
* INLINE string test with U+0000 (issue reproduced) and cover issue in documentation * U+0000 string param manipulation test with doc fix * fix openDatabase() calls in string tests (general) * check default page/cache size ref: storesafe/cordova-sqlite-storage#781 * test openDatabase() with 2-byte cent character (¢) * test openDatabase() with U+0801 (3-byte Samaritan) * doc fixes related to database file names * test fix for emoji in database file name * other openDatabase() file name test fixes * spec with Jasmine 2.5.2 NOTE: Jasmine 2.6.0 and newer reports uncaught errors on some tests on HTML5 (WebKit) Web SQL tests (FUTURE TBD for further investigation) * fix label on db-sql-operations-test.js * Add browser platform usage notes * https link to litehelpers.net * cordova-sqlite-storage 2.3.2 - quick updates - Mark some Android errors as internal plugin errors (quick fix) - remove trailing whitespace from Android implementation - quick doc updates - test coverage updates included * Test comment for 4-byte UTF-8 characters per string test case, removed from another place ref: storesafe/cordova-sqlite-storage#564 * test sqlBatch with changing element values * remove ignored params from plugin-specific tests * test sqlBatch([]) (empty array) - reports success * Fix label & db name in INSERT boolean value test * Mark extra US-ASCII string tests * Remove redundant backslash string tests * "incomplete input" error mapping test fixes * Multiple db.executeSql string result test fixes * Multi-db PRAGMA/transaction combo test fixes old QUnit-like utility functions removed from this test script * other db.executeSql test fixes * '012012012' string INSERT value bindings test ref: storesafe/cordova-sqlite-storage#791 * '012012.012' string INSERT value bindings test Additional test ref: storesafe/cordova-sqlite-storage#791 * US-ASCII string concatenation test with parameters * Mark INLINE BLOB value storage tests section * Move more db.executeSql SELECT result description * Fix U+0000 parameter UPPER test for Android 8 * Skip a couple U+0000 tests on Web SQL on Android 6 (for now) * extra-long timeout for db combo test * test and document usage with numbered parameters resolves storesafe/cordova-sqlite-storage#787 * doc update examples & tutorials (with pitfall) Closes storesafe/cordova-sqlite-storage#609 * Move & update existing browser platform notes ref: - storesafe/cordova-sqlite-storage#297 - storesafe/cordova-sqlite-storage#576 - storesafe/cordova-sqlite-storage-help#8 * More June 2018 doc updates * cordova-sqlite-storage 2.3.3 - quick fix Quick fix for some iOS/macOS internal plugin error log messagess (some test & doc updates are included in this release) * possible "incomplete input" error on Android 7 * Remove some scripts from circle.yml & .travis.yml Remove some test scripts from Travis CI & Circle CI * spec remove test of obsolete WP8 platform * spec with explicit check for Apple iOS userAgent THANKS for info: https://www.sitepoint.com/identify-apple-iphone-ipod-ipad-visitors/ * spec rename hasWebKitBrowser to hasWebKitWebSQL * spec rename isWKWebView to hasMobileWKWebView * MSAppHost userAgent pattern to check for Windows * U+0000 test fixes & updates * INSERT inline X'FFD1FFD2' test updates & fixes * SELECT X'FFD1FFD2' test fix * tx-semantics-test.js test fixes * Check insertId after UPDATE & update doc other advanced rowsAffected test updates to check insertId closes storesafe/cordova-sqlite-storage#802 * (WebKit) Web SQL testing on browser platform * cordova-sqlite-storage 2.4.0 - quick fix release Report internal plugin error in case of attempt to open database with no database name on iOS or macOS Upcoming major release July 2018 -> September 2018 Test & documentation updates included in this release: - Cover use of standard (WebKit) Web SQL API in spec test suite - Test and document insertId in UPDATE result set on plugin vs (WebKit) Web SQL - other test updates * Followup test fix for iOS Web SQL Followup fix for the following commit: 62767f6 - spec rename isWKWebView to hasMobileWKWebView * Fix FTS3 test for Chrome vs Safari browser * Doc fix for Android/iOS vs browser WebKit feature FTS3/FTS4/R-Tree * general doc updates * ALTER tests do not ignore close error on Windows * some open/close/delete database test fixes * minor test fixes * Windows error test & doc fixes (existing behavior) ref: - storesafe/cordova-sqlite-storage#539 - storesafe/cordova-sqlite-storage#821 * Check actual sqlite version in separate case * Planned December 2018 release update notes ref: storesafe/cordova-sqlite-storage#773 * Introduce androidDatabaseProvider: 'system' option to replace androidDatabaseImplementation setting (cordova-sqlite-storage 2.5.0) * Comment out plugin on browser test conditions which are currently not needed (introduced in eade090) * INLINE INSERT X'FFD1FFD2' BLOB test fixes * PRAGMA & multiple db combo test fixes * SELECT X'40414243' (INLINE BLOB) test fixes and SELECT LOWER(X'40414243') test fixes * db-simultaneous-tx-access-test.js fixes * db-tx-multiple-update-test.js fixes * SELECT LOWER(X'41F09F9883') test fixes ref: storesafe/cordova-sqlite-storage#564 * SELECT LOWER(X'41EDA0BDEDB88321') test returns emoji on Android plugin on default NDK provider (all Android versions tested) and androidDatabaseProvider: 'system' on Android 4.x ref: storesafe/cordova-sqlite-storage#564 * tests with 25 emojis ref: storesafe/cordova-sqlite-evcore-extbuild-free#43 * SELECT LOWER(X'41F0908CB1') string test and SELECT LOWER(X'41EDA080EDBCB1') string test ref: storesafe/cordova-sqlite-storage#564 * doc update for issue #564 Note that the same non-standard encoding of 4-byte UTF-8 characters on Android pre-6.0 is also observed on the evcore plugin version. * browser platform now planned for November 2018 * fix internal plugin cleanup error log on Android (cordova-sqlite-storage 2.5.1) * INSERT 25 emojis test fixes ref: storesafe/cordova-sqlite-evcore-extbuild-free#43 * cordova-sqlite-evcore-legacy-ext-common-free link fixed * Windows platform notes fixes * Fix link to Android database provider section * minor doc fix * INLINE BLOB test description fixes * Ignore Android end transaction error when closing for androidDatabaseProvider: 'system' setting, to avoid possible crash during app shutdown (cordova-sqlite-storage 2.5.2) Resolves storesafe/cordova-sqlite-storage#833 * cordova-sqlite-storage 2.6.0 with SQLite 3.26.0 with security update and support for window functions using [email protected] and add another upcoming breaking change Resolves storesafe/cordova-sqlite-storage#837 * Project maintenance status ref: storesafe#81 * Start 0.1.12-rc3_dev * Fix SQLITE_ENABLE_MEMORY_MANAGEMENT setting in doc * SQLITE_DEFAULT_SYNCHRONOUS=3 for iOS/macOS (extra durable) * FTS3/FTS5 update from SQLite 3.26.0 for iOS/macOS (security update) * FTS3/FTS5 update from SQLite 3.26.0 for Android in custom build which now includes SQLITE_DEFAULT_SYNCHRONOUS=3 build setting for extra durability * Fix SQLITE_DEFAULT_PAGE_SIZE / CACHE_SIZE in doc * cordova-sqlcipher-adapter 0.1.12-rc3 * fix a couple build flags in README.md * Start 0.2.0-dev * package.json fix URLs * Update CHANGES.md for using JARs again * Remove default page/cache size settings for unencrypted databases on iOS/macOS & unsupported Windows platforms (already gone for Android) * Skip faster repeated open/close test on Android * Update outer label on spec/www/spec/cipher.js * [email protected] * Remove incorrect page size statement from doc * cordova-sqlcipher-adapter doc fixes * Update for Cordova 8.1.x * Remove redundant FUTURE TBD NDEBUG build item * SQLITE_OMIT_DEPRECATED build flag on iOS/macOS (cordova-sqlcipher-adapter 0.2.1) * doc issue ref for SQLITE_OMIT_DEPRECATED * SQLCipher 4.0.1 update (cordova-sqlcipher-adapter 0.3.0-pre1) * Update description for SQLCipher 3 vs 4, etc. * cordova-sqlcipher-adapter 0.3.0 * start cordova-sqlite-storage-ext-core-common plugin version branch Note that this plugin version branch is made for easy merge of changes into the cordova-sqlcipher-adapter plugin version * Update about text for this plugin version branch * Quick test & doc updates for Android 8(+) & iOS 12 * Use SQLite 3.22.0 in this plugin version branch with SQLITE_DEFAULT_SYNCHRONOUS=3 (EXTRA DURABLE) compile-time setting from [email protected] * cordova-sqlite-storage-ext-core-common 1.0.0 * cordova-sqlite-storage-ext-core-common 1.0.1-dev * Completely remove iOS/macOS MRC support (should be considered a POSSIBLY BREAKING change) ref: storesafe/cordova-sqlite-storage#769 * remove backgroundExecuteSql method not needed (iOS/macOS) ref: storesafe/cordova-sqlite-storage#769 * no extra @synchronized block per batch (iOS/macOS) should be considered a POSSIBLY BREAKING change ref: storesafe/cordova-sqlite-storage#769 * drop workaround for pre-Honeycomb Android API (BREAKING CHANGE) * Completely remove old Android SuppressLint (android.annotation.SuppressLint) - POSSIBLY BREAKING CHANGE * non-static Android database runner map (POTENTIALLY BREAKING CHANGE) ref: storesafe/cordova-sqlite-storage#763 * remove internal qid usage from JavaScript (not needed) * SQLITE_DBCONFIG_DEFENSIVE flag - iOS/macOS/Windows (POTENTIALLY BREAKING CHANGE) * cordova-sqlite-storage-ext-core-common 2.0.0 * start [email protected] * SQLITE_DEFAULT_SYNCHRONOUS=3 on Windows (EXTRA DURABLE compile-time setting on the disabled Windows platform) * quick doc fixes * Cleanup SQLite version test in this plugin version * Quick fixes for INSERT syntax error test in this plugin version * Cleanup SQLiteAndroidDatabase.java in this plugin version remove workaround solutions for pre-Honeycomb & dbFile not needed in this plugin version * Update supported Android/iOS versions in this plugin version NOTE that there should be no issues with pre-Honeycomb since this plugin version uses a special version of the AOSP SQLite database implementation. * SQLITE_DBCONFIG_DEFENSIVE flag for Android (custom build) in addition to iOS/macOS/Windows (POTENTIALLY BREAKING CHANGE) * minor description update * [email protected] * fix cordova-sqlite-storage-ext-core-common changes * cordova-sqlite-ext-core-common 0.1.0-dev Note that a 0.x.x version identifier is used in this plugin version branch since it is not ready for production, due to missing SQLITE_DBCONFIG_DEFENSIVE option setting on Android. * beforePluginInstall.js updates - use standard Promise - get the plugin package name from package.json - use const instead of var - remove hasbang line that is not needed NOTE that this update should be considered a POSSIBLY BREAKING CHANGE since const may not work on some really old Node.js versions. * remove node_modules/.keep (not needed) * .gitignore add package-lock.json * [email protected] update in devDependencies Note that this means that minimum of Node.js version 6 is required for prepareSpec.js to work. (This should not impose such a minimum Node.js version on Cordova projects *using* this pluign.) * Cleanup remove trailing whitespace in bin/test.ps1 * SQLitePlugin.coffee.md openDatabase step 1 comment * cordova-sqlite-ext-core-common 0.1.0 * cordova-sqlite-ext-common-core 0.1.0-dev * Improved test updates for iOS 12 & recent SQLite * Update README.md for major release coming in 2019 Note that use of SQLITE_DBCONFIG_DEFENSIVE setting is implemented for iOS/macOS/Windows at this point in this plugin version branch. * Update REGEXP test conditions including an updated note that some REGEXP test conditions should be removed for plugin versions such as cordova-sqlite-ext * cordova-sqlite-ext-common-core 0.1.0 * cordova-sqlite-ext-common-core 0.1.1-dev * SQLite3-Win-RT->SQLite3-WinRT-sync in src/windows move the embedded SQLite3-WinRT component to src/windows/SQLite3-WinRT-sync and update plugin.xml * SQLite3-WinRT component info in README.md * Another update regarding new major release * cordova-sqlite-extcore 0.1.0 * cordova-sqlite-ext-common-core 0.2.0-dev * Completely remove old Windows vcxproj files that were used for Windows 8.1 & Windows Phone 8.1 builds * Move SQLite3.UWP.vcxproj out of extra SQLite3.UWP subdirectory * cordova-sqlite-ext-common-core 0.2.0 * cordova-sqlite-storage 3.0.0-dev * Use cordova-sqlite-storage-dependencies 2.0.0 with SQLITE_DBCONFIG_DEFENSIVE setting used by sqlite-native-driver.jar on Android * cordova-sqlite-storage 3.0.0 * cordova-sqlite-storage 3.0.1-dev * no SQLITE_DEFAULT_CACHE_SIZE on iOS/macOS/Windows * update email & website links * Update README.md for projects moved so far * free consulting special * cordova-sqlite-storage 3.1.0 * package.json update cordova-sqlite-storage links * cordova-sqlite-storage 3.1.1-dev * fs-extra & cross-spawn in scripts/prepareSpec.js instead of shelljs * Fix prepare-spec "script" name in package.json * clean-spec shell "script" in package.json * .gitignore ignore yarn.lock * Mark old bin scripts as UNSUPPORTED with a note that package scripts should be used instead * prepare-js "script" (using coffeescript@1 for now) * sqlite3_threadsafe() error handling on iOS/macOS * cordova-sqlite-storage 3.2.0 * cordova-sqlite-storage 3.2.1-dev * fix internal clean-spec script * fs-extra@8 update in devDependencies * [email protected] update with SQLite 3.28.0 update for all supported platforms Android/iOS/macOS/Windows * cordova-sqlite-storage 3.2.1 * cordova-sqlite-storage 3.2.2-dev * cordova-sqlite-storage-commoncore 1.0.0-pre1 starting version branch for additional EU character testing NOTE that this version branch is currently known to require slightly older Cordova CLI version such as cordova@8, cordova@7, or cordova@6 in order to install properly. This is due to use of an obsolete Cordova module. This is not an issue with recent versions of cordova-sqlite-storage itself or any of the other up-to-date version branches. * Update string test comments for ICU-UNICODE for: - Web SQL on Chrome desktop browser - plugin with androidDatabaseImplementation: 2 on Android 4.4 & newer * additional EU string manipulation test cases * cordova-sqlite-storage-commoncore 1.0.0 with some additional EU character testing NOTE that this version branch is currently known to require slightly older Cordova CLI version such as cordova@8, cordova@7, or cordova@6 in order to install properly. This is due to use of an obsolete Cordova module. This is not an issue with recent versions of cordova-sqlite-storage itself or any of the other up-to-date version branches. * quick updates & fixes to error mapping tests - test syntax error with comma after the field name - quick fix of error test on (WebKit) Web SQL on Safari desktop browser - pretter detection of iOS platform - IGNORE difference in an error message on iOS as well as Android 7.0(+) - other minor updates & fixes * SQLCipher 4.2.0 update (cordova-sqlcipher-adapter 0.4.1) * Fix CHANGES.md for 3.2.1 vs 3.2.2-dev * remove some promotions, for now at least * quick test updates for Android 9 (Pie) * New page/cache default sizes with [email protected] update (cordova-sqlite-storage plugin version) * cordova-sqlite-storage 3.3.0 * start cordova-sqlite-storage 3.3.1-dev * quick workaround for `SYNTAX_ERR` redefinition * cordova-sqlite-storage 3.4.0 * cordova-sqlite-storage 3.4.1-dev * fix CHANGES.md for 3.4.0 vs 3.4.1-dev cordova-sqlite-storage 3.4.0 vs 3.4.1-dev * add string test with double-quotes in result key * [email protected] update with SQLite 3.30.1 * cordova-sqlite-storage 3.4.1 * start cordova-sqlite-storage 3.4.2-dev * double-quotes in result key test fixes ref: storesafe/cordova-sqlite-evcore-extbuild-free#51 * rename PSPDFThreadSafeMutableDictionary to CustomPSPDFThreadSafeMutableDictionary and completely remove PSPDFThreadSafeMutableDictionary.h (cordova-sqlite-storage 4.0.0-pre1) * cordova-sqlite-storage 4.0.0 * start cordova-sqlite-storage 4.0.1-dev * [TBD] add PENDING rename table with view test PENDING due to KNOWN CRASH on SQLite 3.30.1 (Decmeber 2019) ref: - http://sqlite.1065341.n5.nabble.com/Crash-Bug-Report-tc109903.html - storesafe/cordova-sqlite-storage#904 * doc updates & fixes * start cordova-sqlite-storage 5.0.0-dev (MAJOR update) * avoid incorrect default directory on iOS/macOS - to be extra safe (see <storesafe/cordova-sqlite-storage#907>) - ensure that default "nosync" directory *always* has resource value set for `NSURLIsExcludedFromBackupKey` - add more checks for missing database directory * cordova-sqlite-storage@5 doc updates - add comparison of supported plugin versions near the beginning - updated list of breaking changes coming soon - hide browser usage notes for now (at least) - other minor updates * cordova-sqlite-storage 5.0.0 * start cordova-sqlite-storage 5.0.1-dev * [email protected] back CHANGES.md (restore the cordova-sqlite-storage 5.0.0 heading in CHANGES.md) * update breaking changes coming soon in doc * fix cordova-sqlite-storage 3.4.1 update in CHANGES.md * test & doc INCONSISTENT error message formatting on Android (with android-database-sqlcipher) ref: storesafe#95 * status fixes in cordova-sqlcipher-adapter doc - add missing `SQLITE_ENABLE_DBSTAT_VTAB` item for Android only - fix for default `PRAGMA journal_mode` setting * SQLCipher version test & doc updates - update SQLCipher version test to be specific Android vs iOS/mac/... - remove a specific SQLCipher version number from Announcements in README.md * start cordova-sqlcipher-adapter 0.5.0-dev * SQLCipher 4.3.0 update for iOS/macOS * SQLCipher 4.3.0 update for Android now using `androidx.sqlite:sqlite:2.1.0` framework reference in plugin.xml - `SQLITE_OMIT_PROGRESS_CALLBACK` is no longer used on Android - Extra-old `armeabi` CPU for Android pre-5.0 is no longer supported by this plugin version. * general cordova-sqlcipher-adapter doc updates (before upcoming merge) * cordova-sqlcipher-adapter 0.5.0 * use [email protected] with SQLite 3.32.3 update * enable RENAME table with view test From December 2019 SQLite crash report, fixed in 2020 * cordova-sqlite-storage 5.0.1 * remove incorrect Android framework info * start cordova-sqlcipher-adapter 0.5.1-dev * SQLCipher 4.4.0 (community) update for iOS & macOS ("osx") * SQLCipher 4.4.0 (community) update for Android (in custom build, as documented) * add PRAGMA cipher_version test * cordova-sqlcipher-adapter 0.5.1 * document AndroidX requirement * start cordova-sqlcipher-adapter 0.5.2-dev * SQLCipher 4.4.2 (community) update for Android (in custom build, as documented) * SQLCipher 4.4.2 (community) update for iOS & macOS * cordova-sqlcipher-adapter 0.5.2 * fix: added migration form sqlcipher3 to 4 on iOS. * refactor: code refactor for iOS * chore: added comment in sqlcipher process on iOS * added parameter name for code readability * chore: added missing comment * RMET-2046 SQLite 3.33.0 update - Android (#12) * feat: updated jars * updated jars * feat: updated gitignore. added db migration * feat: added database migration * fix: added migration code. * chore: updated changelog Co-authored-by: Christopher J. Brody <[email protected]> Co-authored-by: Christopher J. Brody <[email protected]> Co-authored-by: Christopher J. Brody <[email protected]> Co-authored-by: Christopher J. Brody <[email protected]>
Basic functionality working with browser platform (ref: #297). This is basically a special version of SQLitePlugin.js which simulates the sqlite plugin functionality on the Chrome browser. Note that this assumes that the Chrome browser will not remove the deprecated Web SQL implementation anytime soon.
NOTICE that the echoTest, selfTest, and deleteDatabase functions are not implemented.
Some tests were disabled or commented out due to timeouts. A number of tests will need to be adapted to deal with the behavior on the browser platform.