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 cfdd50a8
authored
Feb 03, 2015
by
Jan Aagaard Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add toString before replacing special characters in query generator. Closes #3048
1 parent
d170b5da
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletions
lib/dialects/abstract/query-generator.js
test/integration/model/create.test.js
lib/dialects/abstract/query-generator.js
View file @
cfdd50a
...
@@ -243,7 +243,7 @@ module.exports = (function() {
...
@@ -243,7 +243,7 @@ module.exports = (function() {
value
=
this
.
escape
(
value
,
(
modelAttributeMap
&&
modelAttributeMap
[
key
])
||
undefined
);
value
=
this
.
escape
(
value
,
(
modelAttributeMap
&&
modelAttributeMap
[
key
])
||
undefined
);
if
(
options
.
exception
)
{
if
(
options
.
exception
)
{
// $ inside value strings are illegal when using $$ as literal strings/delimiters for function bodys
// $ inside value strings are illegal when using $$ as literal strings/delimiters for function bodys
value
=
value
.
replace
(
/
\$
/g
,
'\\$'
);
value
=
value
.
toString
().
replace
(
/
\$
/g
,
'\\$'
);
}
}
values
.
push
(
value
);
values
.
push
(
value
);
}
}
...
...
test/integration/model/create.test.js
View file @
cfdd50a
...
@@ -130,6 +130,27 @@ describe(Support.getTestDialectTeaser('Model'), function() {
...
@@ -130,6 +130,27 @@ describe(Support.getTestDialectTeaser('Model'), function() {
});
});
});
});
it
(
'should support bools in defaults'
,
function
()
{
var
User
=
this
.
sequelize
.
define
(
'user'
,
{
objectId
:
{
type
:
DataTypes
.
INTEGER
,
unique
:
true
},
bool
:
DataTypes
.
BOOLEAN
});
return
User
.
sync
({
force
:
true
}).
then
(
function
()
{
return
User
.
findOrCreate
({
where
:
{
objectId
:
1
},
defaults
:
{
bool
:
false
}
});
});
});
it
(
'returns instance if already existent. Single find field.'
,
function
(
done
)
{
it
(
'returns instance if already existent. Single find field.'
,
function
(
done
)
{
var
self
=
this
,
var
self
=
this
,
data
=
{
data
=
{
...
...
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