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 ab30bc64
authored
Jul 16, 2013
by
Daniel Durante
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SqlString.escape now accepts an object as an argument closes #760
1 parent
f3c7939e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletions
lib/sql-string.js
lib/sql-string.js
View file @
ab30bc6
...
@@ -9,6 +9,19 @@ SqlString.escapeId = function (val, forbidQualified) {
...
@@ -9,6 +9,19 @@ SqlString.escapeId = function (val, forbidQualified) {
};
};
SqlString
.
escape
=
function
(
val
,
stringifyObjects
,
timeZone
,
dialect
,
field
)
{
SqlString
.
escape
=
function
(
val
,
stringifyObjects
,
timeZone
,
dialect
,
field
)
{
if
(
arguments
.
length
===
1
&&
typeof
arguments
[
0
]
===
"object"
)
{
val
=
val
.
val
||
val
.
value
||
null
stringifyObjects
=
val
.
stringifyObjects
||
val
.
objects
||
undefined
timeZone
=
val
.
timeZone
||
val
.
zone
||
null
dialect
=
val
.
dialect
||
null
field
=
val
.
field
||
null
}
else
if
(
arguments
.
length
<
3
&&
typeof
arguments
[
1
]
===
"object"
)
{
timeZone
=
stringifyObjects
.
timeZone
||
stringifyObjects
.
zone
||
null
dialect
=
stringifyObjects
.
dialect
||
null
field
=
stringifyObjects
.
field
||
null
}
if
(
val
===
undefined
||
val
===
null
)
{
if
(
val
===
undefined
||
val
===
null
)
{
return
'NULL'
;
return
'NULL'
;
}
}
...
@@ -19,7 +32,8 @@ SqlString.escape = function(val, stringifyObjects, timeZone, dialect, field) {
...
@@ -19,7 +32,8 @@ SqlString.escape = function(val, stringifyObjects, timeZone, dialect, field) {
// for us. Postgres actually has a boolean type with true/false literals,
// for us. Postgres actually has a boolean type with true/false literals,
// but sequelize doesn't use it yet.
// but sequelize doesn't use it yet.
return
dialect
===
'sqlite'
?
+!!
val
:
(
''
+
!!
val
);
return
dialect
===
'sqlite'
?
+!!
val
:
(
''
+
!!
val
);
case
'number'
:
return
val
+
''
;
case
'number'
:
return
val
+
''
;
}
}
if
(
val
instanceof
Date
)
{
if
(
val
instanceof
Date
)
{
...
...
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