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

Commit 9b89f62a by zapatek

Prefix quoted string vals with N in mssql

1 parent 54c57a74
Showing with 7 additions and 1 deletions
......@@ -13,6 +13,7 @@ SqlString.escapeId = function(val, forbidQualified) {
};
SqlString.escape = function(val, timeZone, dialect, format) {
var prependN = false;
if (val === undefined || val === null) {
return 'NULL';
}
......@@ -27,6 +28,11 @@ SqlString.escape = function(val, timeZone, dialect, format) {
return '' + !!val;
case 'number':
return val + '';
case 'string':
// In mssql, prepend N to all quoted vals which are originally a string (for
// unicode compatibility)
prependN = dialect === 'mssql';
break;
}
if (val instanceof Date) {
......@@ -66,7 +72,7 @@ SqlString.escape = function(val, timeZone, dialect, format) {
}
});
}
return "'" + val + "'";
return (prependN ? "N'" : "'") + val + "'";
};
SqlString.format = function(sql, values, timeZone, dialect) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!