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
I would be interested in this kind of port, however I do not have time right now to work on this. Maybe I can work on this sometime in the future. I hope someone will work to make this future-proof by fixing #14 to get this working on Cordova.
Why not use the Plugin that is already provided in the Android repo? It only gets enabled for certain versions of Android that don't properly support window.openDatabase() but all of the necessary code is already there:
I am guessing the Android Storage class should emulate the HTML5 Web API in the object returned by window.openDatabase(). I hope we can come up with a solution for #11 to emulate the HTML5 Web API in this plugin for the iOS.
I think it is better if we can adapt a version of this plugin to follow the same Storage API as has already been made for the Android. Someone has already adapted this plugin for Cordova, and I am about to ask if he can make an adaptation to follow the Android Storage API.
Well the index.html is just copy-pasting an adapted version of the README sample into the template but yes, I can add something like demo-index.html when I get a chance.
I made some more changes in https://github.com/chbrody/Cordova-SQLitePlugin/ for the Android (DroidGap) version including an API improvement and a common Lawnchair adapter. I still want to do a bit of cleanup before submitting a pull request.
Thanks for your response Chris Brody. I am using phonegap 1.2.0 and plugin is for ios. I tried to run the db process in background but it crashes the app. While inserting UI got stuck.
It is already in the README if you try to save too much data the UI will be blocked. The two solutions I can think of are to use a worker thread or make a timer mechanism. Both are possible from the application layer.
I tried to run the db operation in background thread i replace the code [self respond:callback withString:[resultSet JSONRepresentation] withType:@"success"]; with [self performSelectorOnMainThread:@selector(saveComplite:)
withObject:set waitUntilDone:YES]; but app crashes. I don't know what to do. Please give me solution for it. how to write the code for worker thread? Please paste some code.
@gyanendra-sncet sorry I have never worked with background threads on iOS before so I really cannot help you there. A background thread will only help you if you are doing really large batches, which I believe is not the case for you.
Also this plugin is no longer supported for PG 1.2.0. Please upgrade to 1.5+, preferably 1.7.0 and try again. You can also checkout my fork, which has support for Android and is closer to the HTML5 SQL API.
@chbrody Its ok. I have huge data to save in the sqlite so that is why UI is getting blocked so i though if it runs on background thread then ui will not blocked.
For a huge data record you would have to add the thread to solve the UI blocking and I think this would have to be done in the plugin. I will raise this in an issue in my fork, cannot promise when or even if I will ever make the solution. Also, would it help you to pre-populate the database like (http://gauravstomar.blogspot.com/2011/08/prepopulate-sqlite-in-phonegap.html)?
Activity
brody2consult commentedon Mar 23, 2012
I would be interested in this kind of port, however I do not have time right now to work on this. Maybe I can work on this sometime in the future. I hope someone will work to make this future-proof by fixing #14 to get this working on Cordova.
macdonst commentedon Mar 23, 2012
Why not use the Plugin that is already provided in the Android repo? It only gets enabled for certain versions of Android that don't properly support window.openDatabase() but all of the necessary code is already there:
https://github.com/apache/incubator-cordova-android/blob/master/framework/src/org/apache/cordova/Storage.java
brody2consult commentedon Mar 24, 2012
I am guessing the Android Storage class should emulate the HTML5 Web API in the object returned by window.openDatabase(). I hope we can come up with a solution for #11 to emulate the HTML5 Web API in this plugin for the iOS.
jawwadfarooq commentedon Mar 27, 2012
Quite useful if this plugin is available for Android as well
brody2consult commentedon Mar 27, 2012
@jawwadfarooq I think it was a very good suggestion by @macdonst to simply use the Plugin that is already provided in the Android repository: https://github.com/apache/incubator-cordova-android/blob/master/framework/src/org/apache/cordova/Storage.java
I think it is better if we can adapt a version of this plugin to follow the same Storage API as has already been made for the Android. Someone has already adapted this plugin for Cordova, and I am about to ask if he can make an adaptation to follow the Android Storage API.
brody2consult commentedon Apr 4, 2012
https://github.com/chbrody/Cordova-SQLitePlugin/tree/master/DroidGap copied from [sS]torage.j*, use it at your own risk!
ns-1m commentedon Apr 4, 2012
Chris, Brilliant!
Would it be possible to have this index.html for PGSQLplugin iOS as well.
https://github.com/chbrody/Cordova-SQLitePlugin/blob/master/DroidGap/assets/www/index.html
Probably, just rename old index.html to index_lawnchair.html and use
your index.html as default.
Thanks.
Noli
On 4/5/12, Chris Brody
reply@reply.github.com
wrote:
brody2consult commentedon Apr 5, 2012
Well the index.html is just copy-pasting an adapted version of the README sample into the template but yes, I can add something like demo-index.html when I get a chance.
brody2consult commentedon Apr 9, 2012
I made some more changes in https://github.com/chbrody/Cordova-SQLitePlugin/ for the Android (DroidGap) version including an API improvement and a common Lawnchair adapter. I still want to do a bit of cleanup before submitting a pull request.
gems09 commentedon May 4, 2012
I use this plugin when it starts inserting in to the db UI got stuck. Please provide the solution for it.
brody2consult commentedon May 4, 2012
Can you please specify which version you are using and can you post a sample, as simple as possible, that can demonstrate this behavior?
gems09 commentedon May 4, 2012
Thanks for your response Chris Brody. I am using phonegap 1.2.0 and plugin is for ios. I tried to run the db process in background but it crashes the app. While inserting UI got stuck.
brody2consult commentedon May 4, 2012
It is already in the README if you try to save too much data the UI will be blocked. The two solutions I can think of are to use a worker thread or make a timer mechanism. Both are possible from the application layer.
gems09 commentedon May 4, 2012
and this is the sample code for insertion same way i am fetching also.
database.transaction(function(transaction){
gems09 commentedon May 4, 2012
I tried to run the db operation in background thread i replace the code [self respond:callback withString:[resultSet JSONRepresentation] withType:@"success"]; with [self performSelectorOnMainThread:@selector(saveComplite:)
withObject:set waitUntilDone:YES]; but app crashes. I don't know what to do. Please give me solution for it. how to write the code for worker thread? Please paste some code.
brody2consult commentedon May 4, 2012
@gyanendra-sncet sorry I have never worked with background threads on iOS before so I really cannot help you there. A background thread will only help you if you are doing really large batches, which I believe is not the case for you.
brody2consult commentedon May 4, 2012
Also this plugin is no longer supported for PG 1.2.0. Please upgrade to 1.5+, preferably 1.7.0 and try again. You can also checkout my fork, which has support for Android and is closer to the HTML5 SQL API.
gems09 commentedon May 4, 2012
@chbrody Its ok. I have huge data to save in the sqlite so that is why UI is getting blocked so i though if it runs on background thread then ui will not blocked.
gems09 commentedon May 4, 2012
for PG 1.7.0 the sqlite plugin runs on the main thread so t don't think upgrading will solve my problem.
brody2consult commentedon May 4, 2012
For a huge data record you would have to add the thread to solve the UI blocking and I think this would have to be done in the plugin. I will raise this in an issue in my fork, cannot promise when or even if I will ever make the solution. Also, would it help you to pre-populate the database like (http://gauravstomar.blogspot.com/2011/08/prepopulate-sqlite-in-phonegap.html)?
gems09 commentedon May 4, 2012
Thanks Chris Brody. I have serious problem i need to to fix it. Thanks once again...
gems09 commentedon May 4, 2012
Pre population of db will not work because i am getting the data from server....
gems09 commentedon May 18, 2012
Hi Chris Brody. Any update one adding the thread to solve the UI blocking?