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

Transaction object is getting lost #160

Closed
ghost opened this issue Nov 18, 2014 · 5 comments
Closed

Transaction object is getting lost #160

ghost opened this issue Nov 18, 2014 · 5 comments
Labels

Comments

@ghost
Copy link

ghost commented Nov 18, 2014

I am using this plugin for one of my phonegap project. I am facing issue with the database transaction object. I am calling one android activity from javascript and after finishing that activity, i am trying to access database using "db.transaction" call, but it is unable to call the transaction and it is not giving any error also. After debugging, when i commented line 1 & 2, it started to work but now sometimes transaction call is behaving randomly.

SQLitePlugin.prototype.addTransaction = function(t) {
this.txQ.push(t);
if (this.txQ.length === 1) { ----->Line 1
t.start();
} ------>Line 2
};

Kindly suggest me what exactly this code is doing.

@nolanlawson
Copy link
Contributor

This plugin does not currently work with multi-page architecture or with multi-activity Android apps. Sorry about that; it's a big TODO that we never got around to.

Just FYI, you do know that the native Web SQL database is supported in every WebView back to Android 2.2, yes? You can just follow these steps to enable it, and then you don't even need this plugin. In fact on Android, this plugin is slower than the native Web SQL database and offers no advantages that I'm aware of.

@nolanlawson
Copy link
Contributor

Also on PhoneGap, I believe it does those steps by default, so you can just call window.openDatabase() and you're done.

@brodycj
Copy link
Contributor

brodycj commented Mar 4, 2015

FYI there are two major advantages of this plugin on the Android platform: database will be in a known location (always) and there is no practical limitation to the database file size.

@brodycj brodycj closed this as completed Mar 4, 2015
@nolanlawson
Copy link
Contributor

@brodybits You're right; I'm sorry for being so glib. The known location thing is incredibly useful; pre-Android 4.4. you could actually tell the WebView where to store WebSQL databases, but post-4.4 that's not an option anymore.

@brodycj
Copy link
Contributor

brodycj commented Mar 4, 2015

A less buggy sqlite plugin would be nice, though.

I suspect the issue #193 (Android not saving the inserts upon abnormal exit) is due to changes in android / platform_external_sqlite - I am thinking in commit d4f30d0. The workaround to close and reopen the db for every transaction (which I am planning to support in an openDatabase option) is pretty bad. Hopefully the Android team will fix it someday 😄

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

No branches or pull requests

2 participants