litehelpers / Cordova-SQLitePlugin-legacy-iOS-broken-bug666

Cordova/PhoneGap SQLitePlugin for iOS as of September 2013, no longer supported - BROKEN due to BUG litehelpers/Cordova-sqlite-storage#666
89 stars 30 forks source link

Open existing database from other sources #10

Open brodycj opened 12 years ago

brodycj commented 12 years ago

It is easy for an application to open and read its own database files using the plugin interface. However quite a few people want to open a database file that was generated from another source. It would be nice to come up with an API, preferably a portable API, that can be used to open a specific database file path.

brodycj commented 12 years ago

From: http://gauravstomar.blogspot.ca/2011/08/prepopulate-sqlite-in-phonegap.html see https://groups.google.com/forum/?fromgroups#!topic/phonegap/dSnm2dTzPi4

document how to work with pre-populated SQLite databases

brodycj commented 12 years ago

PhoneGap thread: https://groups.google.com/forum/?fromgroups#!topic/phonegap/XlenKNxmoqE

From Avinoam: http://androidblogger.blogspot.com/2009/05/how-to-ship-application-with-pre-baked.html http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/

It will need automatic testing to verify that this is working right, see #4

ns-1m commented 12 years ago

Does this apply to Cordova-SQLitePlugin?

From: http://gauravstomar.blogspot.ca/2011/08/prepopulate-sqlite-in-phonegap.html

Why you need 2 db instead of one?

Probably you can create an example how to do this properly using Cordova-SQLitePlugin?

Why do we need Cordova-SQLitePlugin for when you can create using this instruction (below)?

From: http://gauravstomar.blogspot.ca/2011/08/prepopulate-sqlite-in-phonegap.html

What is the difference of having Cordova-SQLitePlugin or without one?

brodycj commented 12 years ago

On Fri, Apr 27, 2012 at 5:37 AM, Noli Sicad reply@reply.github.com wrote:

Does this apply to Cordova-SQLitePlugin?

From: http://gauravstomar.blogspot.ca/2011/08/prepopulate-sqlite-in-phonegap.html Yes it does. You should be able to prepopulate the sqlite db and expect this plugin to access the database.

Why you need 2 db instead of one? I personally do not need multiple databases, however the HTML5 SQL API does support multiple databases and some people may think of a use for them.

Probably you can create an example how to do this properly using Cordova-SQLitePlugin? Yes, I need to document this. I am not sure whether or not there will be any differences for this plugin.

What is the difference of having Cordova-SQLitePlugin or without one? I can think of several benefits of keeping this plugin:

  • reliability: for iOS, Cordova is synchronizing the database when it receives a signal that the application is being shut down. But if the application or even the device crashes, the application would stop without receiving the signal and the data will not be synchronized. For Android, we don't know what the built-in browser will be doing in the future.
  • control: is is possible with this plugin to control the location where the database is stored though I need to add an API function to change the location (see #3).
  • extensibility: I believe @ns-1m was making an adaptation to work with spatialite and someone else wanted to make this work with encrypted databases. From #8 I would like to add the options to openDatabase() to work with these types of databases.
brodycj commented 12 years ago

Link http://gauravstomar.blogspot.com/2011/08/prepopulate-sqlite-in-phonegap.html needs adaptation for SQLitePlugin, also SQLCipher version in the future.

brodycj commented 12 years ago

From #34, which has been closed as a duplicate of #10: thanks to @sebumd for blogging how to do this for the Android version. I am trying to post this to both #10 and #34 at the same time by e-mail. @sebumd this is so important that I will put the link into the README for the Android version.

On Wed, Aug 8, 2012 at 9:30 PM, sebumd notifications@github.com wrote:

That information is very out of date. I blogged about it here and will post a follow up sometime soon:

http://www.raymondcamden.com/index.cfm/2012/7/27/Guest-Blog-Post-Shipping-a-populated-SQLite-DB-with-PhoneGap

— Reply to this email directly or view it on GitHubhttps://github.com/chbrody/Cordova-SQLitePlugin/issues/34#issuecomment-7594613.

scottbuckel commented 12 years ago

Great! I will be blogging about a cross platform solution as I'm working on porting my app to iOS from Android. Stay Tuned.

scottbuckel commented 12 years ago

Here is a full tutorial about how I was able to use a pre-populated DB with SQLite, This plugin, and PhoneGap. Enjoy! I hope this helps someone.

http://www.corporatezen.com/shipping_prepopulated_database_with_phonegap

brodycj commented 12 years ago

@sebumd I did not see a link in your message. Did you want to add another link?