You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1: Use cordova-sqlite-ext with createFromLocation option in sqlitePlugin.openDatabase
2: Use cordova-sqlite-storage (or any other version) with a plugin such as cordova-plugin-dbcopy (not supported here)
3: Use File API to copy database from another location (such as www) from JavaScript into the proper location then use cordova-sqlite-storage (or any other version) to open the database
4: Download the sqlite database file using something like FileTransfer, store it in the proper location, and the use cordova-sqlite-storage (or any other version)
5: Fetch the data by REST using AJAX, possibly using a library call such as $.ajax and store it (using cordova-sqlite-storage or any other version)
6: INSERT the data records from another source such as a sqlite dump or a hard coded object in JavaScript
At this point the createFromLocation option discussed in option 1 will only work in cordova-sqlite-ext (and certain other cordova-sqlite-evplus-legacy versions). (The other options will work in all sqlite plugin versions.) The rest of this discussion concerns a solution for option 1.
Ideally it should be possible to have a JavaScript solution for option 1 that works together with cordova-plugin-file and this plugin. My idea is that the JavaScript solution should be able to determine the correct destination path from the default database directory path (#680) and then copy the pre-populated database into the right place. An alternative of course would be to copy the database into an arbitrary path and then open the database from there ref: #681.
The tricky part is how to read from the www resource location ref:
Unfortunately this does not seem so good for potentially large binary files.
I can think of the following solutions:
Enhance cordova-plugin-file to support read-only directory & file objects in case of the www folder on Android. (This could help the Cordova user community in general. May be excessively time consuming.)
Build a custom www reader plugin that can return limited directory and file objects from the www directory. The limited file objects would only be intended to read the binary data and copy it to an arbitrary file path.
From storesafe/cordova-sqlite-storage-help#26 I identified 7 pre-populated database alternatives:
At this point the
createFromLocation
option discussed in option 1 will only work in cordova-sqlite-ext (and certain other cordova-sqlite-evplus-legacy versions). (The other options will work in all sqlite plugin versions.) The rest of this discussion concerns a solution for option 1.Ideally it should be possible to have a JavaScript solution for option 1 that works together with cordova-plugin-file and this plugin. My idea is that the JavaScript solution should be able to determine the correct destination path from the default database directory path (#680) and then copy the pre-populated database into the right place. An alternative of course would be to copy the database into an arbitrary path and then open the database from there ref: #681.
The tricky part is how to read from the
www
resource location ref:A solution for Android could be to use an XHR file reader such as https://github.com/macdonst/XhrFileReader ref:
Unfortunately this does not seem so good for potentially large binary files.
I can think of the following solutions:
The text was updated successfully, but these errors were encountered: