-
Notifications
You must be signed in to change notification settings - Fork 8
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 #5
Comments
Hi, thank you a lot for contribution Agree on adding callback for device or document ready. However in future releases I'm planning to remove angular dependency and make library stand alone. For angular there will be a plugin. Anyway, I will add something for this in next release. |
I'm not comfortable with Git and Github, so I publish here for now ;) Tested OK for websql desktop (chrome), websql & sqlite mobile (android cordova plugin sqlcipher) For SQLite mobile: .factory('wSQL', function (W_SQL_CONFIG, $q) {
TO
.factory('wSQL', function (W_SQL_CONFIG, $q, $ionicPlatform, $cordovaSQLite) { And var Db = (function () {
var db, db_set = false;
return {
get: function () {
return db;
},
set: function (db_params) {
db = window.openDatabase(db_params.name, db_params.version, db_params.sub_name, db_params.size);
db_set = true;
return db;
}
}
}
TO
var Db = (function () {
var db = false;
return {
get: function () {
return db;
},
set: function (db_params) {
if (window.cordova) {
$ionicPlatform.ready(function () {
db = $cordovaSQLite.openDB(db_params);
// websql mobile
// db = window.openDatabase(db_params.name, db_params.version, db_params.sub_name, db_params.size);
});
} else {
db = window.openDatabase(db_params.name, db_params.version, db_params.sub_name, db_params.size);
}
return db;
}
}
} To have multiple insertions with the same order as array: InsertQuery.prototype.batch_insert_query = function(table, data, ignore){
...
sql += ' UNION SELECT '+row_sql.query;
...
};
To
InsertQuery.prototype.batch_insert_query = function(table, data, ignore){
...
sql += ' UNION ALL SELECT '+row_sql.query;
...
}; |
Right, good suggestion. However this means that library will require ionic as dependency. Do u think it will work the same fine if using just device.ready instead of $ionicPlatform.ready ? |
Hey this plugin is not working with the below mentioned code in android app. var Db = (function () { |
To use with websql or sqlite (ionic, cordova plugin)
line 88:
To (not fully tested):
Passing a open params (object) I can use https://github.com/litehelpers/Cordova-sqlcipher-adapter
with customs options
And to finish 😏 line 82:
db_set is a dead variable ?
The text was updated successfully, but these errors were encountered: