-
Notifications
You must be signed in to change notification settings - Fork 714
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
How to make an asynchronous transaction? #343
Comments
This idea is in consideration for the future. Here is a workaround that you can try, to take some extra control over the transaction mechanism. Make the following change to SQLitePlugin.js: --- a/www/SQLitePlugin.js
+++ b/www/SQLitePlugin.js
@@ -110,15 +110,15 @@
};
SQLitePlugin.prototype.transaction = function(fn, error, success) {
if (!this.openDBs[this.dbname]) {
error(newSQLError('database not open'));
return;
}
- this.addTransaction(new SQLitePluginTransaction(this, fn, error, success, true, false));
+ this.addTransaction(new SQLitePluginTransaction(this, fn, error, success, false, false));
};
SQLitePlugin.prototype.readTransaction = function(fn, error, success) {
if (!this.openDBs[this.dbname]) {
error(newSQLError('database not open'));
return;
} This will cause the plugin to stop using BEGIN/COMMIT/ROLLBACK. Then you have to do something like Please let me know if this works for you. |
Thank you for the workaround. I will try it out. |
Unfortunately I really cannot promise anything for free right now, due to some changing priorities. |
All right. Should we close this issue or leave it open until this feature is implemented? |
Let's leave it open. I do want to add this when I get a chance. |
👍 |
@brodybits hi. You wrote:
Is any progress on it? Thanks |
Will not be done in this plugin version. Similar functionality may be possible in case of a redesign (#548). |
@brodybits, I have written solution for So question https://stackoverflow.com/a/50486135/5677886. This plugin used in Ionic 3. What do you think about it? It’s ok? |
Please ask in https://github.com/litehelpers/Cordova-sqlite-help/issues. I would like to suggest you consider using https://github.com/brodybits/sql-promise-helper which provides a clean Promise-based API and can be used on browser platform as discussed in brodycj/sql-promise-helper#4. Private support is also available, please contact sales@litehelpers.net for more details. |
I have a really large blob of JSON data that can't be handled in memory at once. So I use Oboe.js to process this JSON data as a stream. Unfortunately your library handles transaction in one big transaction function:
Is there a way to make a database transaction that can manage asynchronous code? I thought something like that:
The text was updated successfully, but these errors were encountered: