Skip to content

Commit d69c3a3

Browse files
anativandpor
authored andcommitted
Support boolean type in params array (#61)
Boolean params are now converted to 0 or 1
1 parent 75309ce commit d69c3a3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/sqlite.core.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,11 @@ SQLitePluginTransaction.prototype.addStatement = function(sql, values, success,
420420
t = typeof v;
421421
if (v === null || v === void 0 || t === 'number' || t === 'string'){
422422
params.push(v);
423-
} else if (t !== 'function') {
423+
} else if (t === 'boolean') {
424+
//Convert true -> 1 / false -> 0
425+
params.push(~~v);
426+
}
427+
else if (t !== 'function') {
424428
params.push(v.toString());
425429
console.warn('addStatement - parameter of type <'+t+'> converted to string using toString()')
426430
} else {
@@ -738,7 +742,7 @@ SQLiteFactory.prototype.deleteDatabase = function(first,success, error) {
738742
console.log("deleteDatabase error handler not provided: ",e);
739743
}
740744
};
741-
745+
742746
plugin.exec("delete",args,mysuccess,myerror);
743747
};
744748

0 commit comments

Comments
 (0)