不要怂,就是干,撸起袖子干!

Commit 39dfbe3b by Eugene Korbut

sqlite: fix BOOLEAN type bug

1 parent 1513d4b4
Showing with 6 additions and 10 deletions
......@@ -3,11 +3,13 @@ var Utils = require("../../utils")
var escape = function(str) {
if (typeof str === 'string') {
return "'" + str.replace(/'/g, "''") + "'"
} else if(str === null || str === undefined) {
return 'NULL'
return "'" + str.replace(/'/g, "''") + "'";
} else if (typeof str === 'boolean') {
return str ? 1 : 0; // SQLite has no type boolean
} else if (str === null || str === undefined) {
return 'NULL';
} else {
return str
return str;
}
};
......@@ -46,12 +48,6 @@ module.exports = (function() {
table: Utils.addTicks(tableName),
attributes: Utils._.keys(attrValueHash).map(function(attr){return Utils.addTicks(attr)}).join(","),
values: Utils._.values(attrValueHash).map(function(value){
//SQLite has no type boolean :
if (typeof value === "boolean") {
value = value ? 1 : 0;
}
return escape((value instanceof Date) ? Utils.toSqlDate(value) : value)
}).join(",")
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!