-
Notifications
You must be signed in to change notification settings - Fork 40
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
Cordova sqlite plugin openDB changes #101
Comments
Could you use this plugin? |
This is a breaking change request. My first reaction is NO. There are other plugin as well. Breaking from WebSQL API is not going to happen. In this case, simply use an adaptor function to use the two library togather. |
Hi, Thanks for your quick response. Unfortunately, I cannot use the the enterprise version you linked to as it does not support Windows 10/UAP. I'm actually using this version here https://github.com/litehelpers/cordova-sqlite-ext which does support Windows 10/UAP and has the same issue with the openDatabase call change. Aside from the openDatabase call, the plugin still adheres to the WebSQL API. I suppose I can create a wrapper function that overwrite the window.sqlitePlugin.openDatabase function, but I thought it would be easier if ydn-db could also use the modified openDatabase call just for the sqlite mechanism with a way to pass in the open arguments to the sqlite plugin (i.e. Database location). I also tried to overwrite window.openDatabase to use that to call window.sqlite.openDatabase (and using "websql" instead of "sqlite" as the mechanism), but was ultimately unsuccessful because the sqlite plugin does not implement version change API for WebSQL. |
As you suggested I was able to write an adaptor function. For anyone else in my shoes, here's the code: if (window.sqlitePlugin) {
window.sqlitePlugin.__openDatabase = window.sqlitePlugin.openDatabase;
window.sqlitePlugin.openDatabase = function(arg) {
if (typeof(arg) == "object") {
return window.sqlitePlugin.__openDatabase(arg);
} else {
return window.sqlitePlugin.__openDatabase({
name: arg,
iosDatabaseLocation: "Documents"
});
}
}
} Thanks again for all the hard work with ydn-db and your helpful suggestions! |
@lwbdev 👍 thanks. |
Hi, it looks like the author of the cordova sqlite plugin (@brodybits) changed the arguments/parameters for the opendatabase call for the sqlite plugin. This means using sqlite as a mechanism no longer works with the latest version of the plugin since ydn-db uses the old openDatabase calls.
See https://github.com/litehelpers/Cordova-sqlite-storage.
The text was updated successfully, but these errors were encountered: