bugfix: convert value to string

This commit is contained in:
AJ ONeal 2016-01-02 21:24:17 -08:00
parent 1807763a6b
commit e726c24a83
1 changed files with 8 additions and 2 deletions

View File

@ -10,7 +10,7 @@ function wrap(db, dir) {
var debug = false;
db.escape = function (str) {
return (str||'').replace(/'/g, "''");
return (str||'').toString().replace(/'/g, "''");
};
function lowerFirst(str) {
@ -421,6 +421,12 @@ function wrap(db, dir) {
sql = cb(fieldable);
if (debug) {
console.log('[masterquest-sqlite3] dbwrap.js');
console.log(sql);
console.log(vals);
}
while (vals.length) {
sql = sql.replace(/\?/, "'" + db.escape(vals.shift()) + "'");
}