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 48e3b6b9
authored
Jan 10, 2014
by
Steffen Persch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better check if 'IS NOT' or '!=' should be used
1 parent
b3186857
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
lib/utils.js
test/mysql/query-generator.test.js
lib/utils.js
View file @
48e3b6b
...
@@ -299,7 +299,7 @@ var Utils = module.exports = {
...
@@ -299,7 +299,7 @@ var Utils = module.exports = {
case
'eq'
:
case
'eq'
:
return
'='
return
'='
case
'ne'
:
case
'ne'
:
return
val
?
'!='
:
'IS NOT
'
return
val
===
null
?
'IS NOT'
:
'!=
'
case
'between'
:
case
'between'
:
case
'..'
:
case
'..'
:
return
'BETWEEN'
return
'BETWEEN'
...
@@ -451,7 +451,7 @@ var Utils = module.exports = {
...
@@ -451,7 +451,7 @@ var Utils = module.exports = {
for
(
var
key
in
hash
)
{
for
(
var
key
in
hash
)
{
if
(
key
instanceof
Utils
.
literal
)
{
if
(
key
instanceof
Utils
.
literal
)
{
_hash
[
key
]
=
hash
[
key
]
_hash
[
key
]
=
hash
[
key
]
}
else
if
(
key
.
indexOf
(
'.'
)
===
-
1
)
{
}
else
if
(
key
.
indexOf
(
'.'
)
===
-
1
)
{
_hash
[
tableName
+
'.'
+
key
]
=
hash
[
key
]
_hash
[
tableName
+
'.'
+
key
]
=
hash
[
key
]
}
else
{
}
else
{
...
...
test/mysql/query-generator.test.js
View file @
48e3b6b
...
@@ -273,6 +273,16 @@ if (Support.dialectIsMySQL()) {
...
@@ -273,6 +273,16 @@ if (Support.dialectIsMySQL()) {
arguments
:
[
'myTable'
,
{
where
:
{
field
:
new
Buffer
(
"Sequelize"
)}}],
arguments
:
[
'myTable'
,
{
where
:
{
field
:
new
Buffer
(
"Sequelize"
)}}],
expectation
:
"SELECT * FROM `myTable` WHERE `myTable`.`field`=X'53657175656c697a65';"
,
expectation
:
"SELECT * FROM `myTable` WHERE `myTable`.`field`=X'53657175656c697a65';"
,
context
:
QueryGenerator
context
:
QueryGenerator
},
{
title
:
'use != if ne !== null'
,
arguments
:
[
'myTable'
,
{
where
:
{
field
:
{
ne
:
0
}}}],
expectation
:
"SELECT * FROM `myTable` WHERE `myTable`.`field` != 0;"
,
context
:
QueryGenerator
},
{
title
:
'use IS NOT if ne === null'
,
arguments
:
[
'myTable'
,
{
where
:
{
field
:
{
ne
:
null
}}}],
expectation
:
"SELECT * FROM `myTable` WHERE `myTable`.`field` IS NOT NULL;"
,
context
:
QueryGenerator
}
}
],
],
...
...
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