Skip to content
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

Open existing database from other sources #10

Open
brody4hire opened this issue Apr 18, 2012 · 9 comments
Open

Open existing database from other sources #10

brody4hire opened this issue Apr 18, 2012 · 9 comments

Comments

@brody4hire
Copy link
Member

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.

@brody4hire
Copy link
Member Author

@brody4hire
Copy link
Member Author

@ns-1m
Copy link

ns-1m commented Apr 27, 2012

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?

@brody4hire
Copy link
Member Author

On Fri, Apr 27, 2012 at 5:37 AM, Noli Sicad
[email protected]
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 Make Cordova 1.6 compatible #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 Better database option interface #8 I would like to add the options to
    openDatabase() to work with these types of databases.

@brody4hire
Copy link
Member Author

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

@brody4hire
Copy link
Member Author

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 [email protected] 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
Copy link

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
Copy link

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

@brody4hire
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants