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 a663c549
authored
Mar 22, 2021
by
markvp
Committed by
GitHub
Mar 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(query-generator): use `AND` in sql for `not`/`between` (#13043)
1 parent
97ba2422
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletions
lib/dialects/abstract/query-generator.js
test/unit/sql/where.test.js
lib/dialects/abstract/query-generator.js
View file @
a663c54
...
...
@@ -2167,7 +2167,9 @@ class QueryGenerator {
model: factory
});
}
if (typeof value === 'boolean') {
if ([this.OperatorMap[Op.between], this.OperatorMap[Op.notBetween]].includes(smth.comparator)) {
value = `
$
{
this
.
escape
(
value
[
0
])}
AND
$
{
this
.
escape
(
value
[
1
])}
`;
} else if (typeof value === 'boolean') {
value = this.booleanValue(value);
} else {
value = this.escape(value);
...
...
test/unit/sql/where.test.js
View file @
a663c54
...
...
@@ -1263,5 +1263,13 @@ describe(Support.getTestDialectTeaser('SQL'), () => {
current
.
where
(
current
.
fn
(
'lower'
,
current
.
col
(
'name'
)),
null
)],
{
default
:
'(SUM([hours]) > 0 AND lower([name]) IS NULL)'
});
testsql
(
current
.
where
(
current
.
col
(
'hours'
),
Op
.
between
,
[
0
,
5
]),
{
default
:
'[hours] BETWEEN 0 AND 5'
});
testsql
(
current
.
where
(
current
.
col
(
'hours'
),
Op
.
notBetween
,
[
0
,
5
]),
{
default
:
'[hours] NOT BETWEEN 0 AND 5'
});
});
});
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