Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 9b89f62a
authored
Dec 15, 2015
by
zapatek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prefix quoted string vals with N in mssql
1 parent
54c57a74
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletions
lib/sql-string.js
lib/sql-string.js
View file @
9b89f62
...
...
@@ -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
)
{
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment