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

Implement prepopulation #10

Closed
jrvidal opened this issue Sep 25, 2013 · 15 comments
Closed

Implement prepopulation #10

jrvidal opened this issue Sep 25, 2013 · 15 comments

Comments

@jrvidal
Copy link

jrvidal commented Sep 25, 2013

There is plenty of "third-party" code for copying a pre-populated database instead of creating a new one.

I have started a fork to try to get this feature working consistently in both Android and iOS. The Android part is already done by @jarlehansen.

Anyway, feedback welcome.

@brodybits
Copy link
Contributor

I am very thankful and please update AUTHORS.md as well when it is
finished. I have taken the liberty to cc the forum.

Just a small suggestion you may want to consider: I had seen a case with an
app that only needed read-only in which case you can just open the db file
directly, no need to copy.

Thanks,
Chris

On Thursday, September 26, 2013, J. Roberto Vidal wrote:

There is plenty of "third-party" code for copying a pre-populated database
instead of creating a new one.

I have started a fork https://github.com/jrvidal/Cordova-SQLitePluginto try to get this feature working consistently in both Android and iOS.
The Android part is already done by @jarlehansenhttps://github.com/jarlehansen
.

Anyway, feedback welcome.


Reply to this email directly or view it on GitHubhttps://github.com//issues/10
.

Sent from my mobile

@zeligmanos
Copy link

Are there any plans to enable us to use prepopulated SQLITE DBs, without resorting to writing native code?

@YannickGagnon
Copy link

What I do in iOS is create my SQLite database in resource folder and then copy it to the app documents' folder at runtime.

Yannick

On 2013-10-18, at 12:23, zeligmanos notifications@github.com wrote:

Are there any plans to enable us to use prepopulated SQLITE DBs, without resorting to writing native code?


Reply to this email directly or view it on GitHub.

@zeligmanos
Copy link

Hello Yannick,
thanks for the reply.
In order to access the file and copy it at runtime, you're using native code or the file Api of Phonegap?

@YannickGagnon
Copy link

I'm using object-c code in the AppDelegate.m file to copy my predefined DB
to the bundle documents folder. This way, when I open it with sqlite phone
gap plugin, it uses it right away without creating a new one.

https://gist.github.com/YannickGagnon/7055026

Hope this is helpful!

Yannick

2013/10/19 zeligmanos notifications@github.com

Hello Yannick,
thanks for the reply.
In order to access the file and copy it at runtime, you're using native
code or the file Api of Phonegap?


Reply to this email directly or view it on GitHubhttps://github.com/brodybits/cordova-sqlite-legacy/issues/10#issuecomment-26647907
.

Yannick.Gagnon@gmail.com

Life would be so much easier if we could just look at the source code. --
Dave Olson

@kaspro
Copy link

kaspro commented Oct 25, 2013

It seems that - at least when using with sqlcipher - when copying the DB to the bundle documents folder, it is not being recognised, because it is not searching for .db files (as per readme?). Simple fix:

SQLitePlugin.m:

  • NSString *dbPath = [NSString stringWithFormat:@"%@/%@", appDocsPath, dbFile];
  • NSString *dbPath = [NSString stringWithFormat:@"%@/%@.db", appDocsPath, dbFile];

Then, using Yannick's trick it all goes smoothly - thanks!

@zeligmanos
Copy link

@YannickGagnon sorry for the late reply.
I tested your suggestion and works like a charm!!
I need to congratulate you on the great resolution.

Now, I believe it's time for an update to the SQLite Plugin in terms of prepopulation.

@jarlehansen's solution for android and @YannickGagnon for iOS, both work great, so including these modifications in the plugin, prepopulation will be fully supported without extra code alterations on the user's side.

@brodybits
Copy link
Contributor

Were pre-populated files ever implemented? I don't see it in the current
iOS or Android code.

Note to self, example code can be found at:
Android -
https://groups.google.com/d/msg/cordova-sqliteplugin/oyybM3JVChI/KPTHO5qQfe0J
iOS -
https://groups.google.com/forum/#!searchin/cordova-sqliteplugin/prepopulated/cordova-sqliteplugin/T-E1abTW4ag/RRvVAj54UwsJ

On Wednesday, September 25, 2013 11:26:05 PM UTC-7, Chris Brody wrote:

I am very thankful and please update AUTHORS.md as well when it is
finished. I have taken the liberty to cc the forum.

Just a small suggestion you may want to consider: I had seen a case with
an app that only needed read-only in which case you can just open the db
file directly, no need to copy.

Thanks,
Chris

On Thursday, September 26, 2013, J. Roberto Vidal wrote:

There is plenty of "third-party" code for copying a pre-populated
database instead of creating a new one.

I have started a fork https://github.com/jrvidal/Cordova-SQLitePlugin
to try to get this feature working consistently in both Android and iOS.
The Android part is already done by @jarlehansen
https://github.com/jarlehansen.

Anyway, feedback welcome.


Reply to this email directly or view it on GitHub
#10.

Sent from my mobile

@brodybits
Copy link
Contributor

No, despite the discussions the changes to support the pre-populated database were never included in this version. README.md contains a pointer to a version that does support the pre-populated database for Android & iOS at: https://github.com/RikshaDriver/Cordova-PrePopulated-SQLitePlugin

@brodybits
Copy link
Contributor

I tried out the sqlite plugin at
https://github.com/RikshaDriver/Cordova-PrePopulated-SQLitePlugin which was
forked from a much earlier version of the plugin from chris
at https://github.com/brodysoft/Cordova-SQLitePlugin.
So far the prepopulation works fine without any issues for android and I
read reviews that it equally works on ios.

But I see the current plugin of chris has gone through a lot of changes
(windows phone support is in as well). I think it would be very useful to
have this feature supported and would be great to see it equally supported
for windows phone.

Are there are still plans to support pre-populated database as a standard
feature for android, ios and wp?

Thanks,
Sankar

@brodybits
Copy link
Contributor

I found another implementation that supports pre-populated databases at:
https://github.com/Antair/Cordova-SQLitePlugin

That one seems to be more up-to-date. I will consider merging that one in
the future.

On Wed, Aug 13, 2014 at 11:31 AM, shankar.nitc@gmail.com wrote:

I tried out the sqlite plugin at
https://github.com/RikshaDriver/Cordova-PrePopulated-SQLitePlugin which
was forked from a much earlier version of the plugin from chris at
https://github.com/brodysoft/Cordova-SQLitePlugin.
So far the prepopulation works fine without any issues for android and I
read reviews that it equally works on ios.

But I see the current plugin of chris has gone through a lot of changes
(windows phone support is in as well). I think it would be very useful to
have this feature supported and would be great to see it equally supported
for windows phone.

Are there are still plans to support pre-populated database as a standard
feature for android, ios and wp?

Thanks,
Sankar

You received this message because you are subscribed to the Google Groups
"Cordova-SQLitePlugin" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to Cordova-SQLitePlugin+unsubscribe@googlegroups.com.
To post to this group, send email to Cordova-SQLitePlugin@googlegroups.com
.
Visit this group at http://groups.google.com/group/Cordova-SQLitePlugin.
To view this discussion on the web visit
https://groups.google.com/d/msgid/Cordova-SQLitePlugin/e2098063-b491-44db-aeda-c04d6e442a90%40googlegroups.com
https://groups.google.com/d/msgid/Cordova-SQLitePlugin/e2098063-b491-44db-aeda-c04d6e442a90%40googlegroups.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

@brodybits
Copy link
Contributor

Hi Chris,

Thanks for the quick reply. Looking forward to have this merged to your
code.

Sankar

@NacreData
Copy link

bump

@brodybits
Copy link
Contributor

Moving discussion to #172.

brodybits pushed a commit that referenced this issue Feb 17, 2015
…10/#172)

Updates to readme to remove support for SQLCipher from this project
brodybits pushed a commit that referenced this issue Feb 18, 2015
Major changes from common-src:
Implement pre-population ref: #10/#172
Choose DB location to make iCloud backup optional ref: #16/#143
Fix db close conditions & prevent double-marshaling of data ref: pull #170
brodybits pushed a commit that referenced this issue Feb 18, 2015
Major changes from common-src & master-src:
- Implement pre-population ref: #10/#172
- Choose DB location to make iCloud backup optional ref: #16/#143
- Fix db close conditions & prevent double-marshaling of data ref: pull #170
brodybits pushed a commit that referenced this issue Feb 18, 2015
Important changes:
- Implement pre-population ref: #10/#172
- Choose DB location to make iCloud backup optional ref: #16/#143
- Fix db close conditions & prevent double-marshaling of data ref: pull #170
@brodybits
Copy link
Contributor

I have now pushed a new release to master with optional support for pre-populated database. Please see README.md for details.

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

6 participants