Open Steffan-Ennis opened 8 years ago
Hi, can you see if this works? I had added this code (executeSql) to ng-cordova.js to not use transaction that causes the problem.
return {
openDB: function (options, background) {
if (angular.isObject(options) && !angular.isString(options)) {
if (typeof background !== 'undefined') {
options.bgType = background;
}
return $window.sqlitePlugin.openDatabase(options);
}
return $window.sqlitePlugin.openDatabase({
name: options,
bgType: background
});
},
executeSql: function (db, query, binding) {
var q = $q.defer();
db.executeSql(query, binding
, function (tx, result) {
q.resolve(result);
},
function (transaction, error) {
error.query = query;
error.binding = binding;
q.reject(error);
});
return q.promise;
},
execute: function (db, query, binding) {
var q = $q.defer();
db.transaction(function (tx) {
tx.executeSql(query, binding
, function (tx, result) {
q.resolve(result);
},
function (transaction, error) {
error.query = query;
error.binding = binding;
q.reject(error);
});
});
return q.promise;
},
I had a issue when using the $cordovaSqlite service to create my tables. It was ignoring the foreign_keys PRAGMA. I had to run the statements on db.executeSql to get the required results.
Original Code
New Code