-
Notifications
You must be signed in to change notification settings - Fork 715
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
Android not saving the inserts [workaround needed] #193
Comments
It sounds like an issue introduced by recent updates to the Android sqlite classes. SQLite itself should never do this: https://www.sqlite.org/transactional.html |
From December 2014: On Tue, Dec 16, 2014 at 1:48 PM, mladenpetrovic88@gmail.com wrote:
On Wed, Dec 17, 2014 at 1:59 PM, mladenpetrovic88@gmail.com wrote:
From February 2015: On Sun, Feb 15, 2015 at 12:48 AM, Cesar Fernandes cesar.fa@gmail.com wrote:
On Sun, Mar 1, 2015 at 1:54 AM, COP chintan@trialx.com wrote:
|
What I am suspecting now is the following commit in the Android database classes: aosp-mirror/platform_external_sqlite@d4f30d0 It references the following sqlite fossil commit: http://www.sqlite.org/src/info/6c4c2b7dba |
I made a possible workaround in the branch |
@brodybits Thanks a lot for quick turn-around! this worked! |
Happy that it solves your problem. But it points to an issue with the Android sqlite library. My idea is to make this workaround an option for those who need it. |
…bject (preparation for workaround for Android db locking/closing issue [see #193]) Replace tabs with spaces
Fixes: - #193: workaround for Android db locking/closing issue - #144: convert array parameters to string to match Web SQL - #199: fix double-precision REAL values in result for iOS version - #150/#153: close Android db before removing from map - Fix truncation in iOS query result in case of UNICODE NULL (\0 or \u0000) (ref: PR #170) - Some fixes for error handling to be consistent with Web SQL (ref: PR #170) Testing ONLY: - #147: testing with UNICODE line separator - #195: Reproduce issue with double-precision REAL number on WP(8) ONLY
Fixes: - #193: workaround for Android db locking/closing issue - #144: convert array parameters to string to match Web SQL - #199: fix double-precision REAL values in result for iOS version - #150/#153: close Android db before removing from map - Fix truncation in iOS query result in case of UNICODE NULL (\0 or \u0000) (ref: PR #170) - Some fixes for error handling to be consistent with Web SQL (ref: PR #170) Testing ONLY: - #147: testing with UNICODE line separator - #195: Reproduce issue with double-precision REAL number on WP(8) ONLY
The workaround as proposed was validated by @chintanop and is now optional, as described in README.md. |
Related to the following fixes: - #193: workaround for Android db locking/closing issue - #144: convert array parameters to string to match Web SQL - #199: fix double-precision REAL values in result for iOS version - #150/#153: close Android db before removing from map - Fix truncation in iOS query result in case of UNICODE NULL (\0 or \u0000) (ref: PR #170) - Some fixes for error handling to be consistent with Web SQL (ref: PR #170)
What files should I overwrite from the workaround branch? I replaced only SQLitePlugin.java and SQLitePlugin.js , but seems to be still wrong |
The workaround branch is no longer supported. Please completely remove your app from the Android simulator or device, install the latest update from the |
Ok! thank you very much! I will play with that now... |
Also note that this is really a bug in the Android database libraries and not this project. Unfortunately I have not reproduced this issue myself. I have implemented a very crude workaround but this should really be fixed in the Android code itself! As I said before, I have a theory that the issue was introduced in the following commit in the Android database classes: android/platform_external_sqlite@d4f30d0, which references the following sqlite fossil commit: http://www.sqlite.org/src/info/6c4c2b7dba It would really help if someone could file a bug on the Android project itself at: https://code.google.com/p/android/issues/list |
I really appreciate your help. I will write to Android developers like you Tks again
|
Yeah, i think i ll have to write to android developers.. sorry because i I re-installed the plugin it is still not working.. i can see in the catlog I use a moto G android 4.4 ... When i emulate it in eclipse, it is working , but not on my device. On Fri, Mar 20, 2015 at 10:18 PM, a Cesar Fernandes cesar.fa@gmail.com
Café Hostel |
That would really help me. |
Does this issue occurs only when you use |
Unfortunately I have not reproduced this issue myself so far. The workaround is only implemented in the case of using |
I'm running into this issue also. Does it also occur when opening the database with androidDatabaseImplementation: 2? As it occurs occasionally, testing / debugging is quite a challenge. |
This should only be an issue if you open the database with As documented, there is an |
Ok, thanks. I'll look into it and open a new issue if I can't find a related item or solution. Edit: the example code at the 'Workaround for Android db locking issue' section is a little bit confusing: The 'androidDatabaseImplementation: 2 ' setting isn't set, so the example code doesn't make sense, right? |
@mdbw3 the README.md has been updated, thanks. |
I'm having this problem, but I don't use androidDatabaseImplementation: 2, and the data is lost without closing the app. Specifically, I insert a row and get back the inserted id, then the next insert to that table gets back the same insert id. One potential cause is that I'm opening the database read-only in some Android plugin code. My understanding was that read-only wouldn't affect a read-write connection, but maybe that's just for Sqlite itself and not for something that wraps it (Android code or this plugin). What info would be useful in tracking this down? Or is there already a workaround (can I use androidLockWorkaround: 1 without androidDatabaseImplementation: 2)? The docs seem to say that won't help. |
Hi @craig-at-rsg, That really sounds like a different problem. I suggest we discuss this in a new issue. Thanks! |
@brodybits Thanks for getting back to me so fast. I just opened #601 for this. |
I am writing through a translator. Hello, I will raise this problem again. It occurs when UPDATE records in the database. I would like to use the solution proposed in the documentation in the "Workaround for Android db locking issue" section, but the constructor lacks androidDatabaseProvider and androidLockWorkaround. Are there any other solutions to this problem? |
Please raise a new issue with some information about what is happening, how you open the database, how you store data, and what kind of devices you see the the issue on. I generally do not support discussions in closed issues. |
@brodybits Seems like a bunch of folks are facing this issue: on Android: https://groups.google.com/forum/#!topic/Cordova-SQLitePlugin/oq8wMDSH4M4
Cordova: 3.5.0
Android API Level: 19
Any idea?
The text was updated successfully, but these errors were encountered: