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 872f66ef
authored
Mar 08, 2014
by
Mick Hansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more use of quoteTable
1 parent
027d914e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
7 deletions
lib/dialects/abstract/query-generator.js
test/associations/belongs-to.test.js
lib/dialects/abstract/query-generator.js
View file @
872f66e
...
@@ -701,7 +701,7 @@ module.exports = (function() {
...
@@ -701,7 +701,7 @@ module.exports = (function() {
joinQueryItem
+=
sourceJoinOn
joinQueryItem
+=
sourceJoinOn
// Generate join SQL for right side of through
// Generate join SQL for right side of through
joinQueryItem
+=
joinType
+
self
.
quote
Identifier
(
table
)
+
" AS "
+
self
.
quoteIdentifier
(
as
)
+
" ON "
joinQueryItem
+=
joinType
+
self
.
quote
Table
(
table
)
+
" AS "
+
self
.
quoteIdentifier
(
as
)
+
" ON "
joinQueryItem
+=
targetJoinOn
joinQueryItem
+=
targetJoinOn
...
@@ -714,7 +714,7 @@ module.exports = (function() {
...
@@ -714,7 +714,7 @@ module.exports = (function() {
// Creating the as-is where for the subQuery, checks that the required association exists
// Creating the as-is where for the subQuery, checks that the required association exists
var
_where
=
"("
;
var
_where
=
"("
;
_where
+=
"SELECT "
+
self
.
quoteIdentifier
(
identSource
)
+
" FROM "
+
self
.
quoteIdentifier
(
throughTable
)
+
" AS "
+
self
.
quoteIdentifier
(
throughAs
);
_where
+=
"SELECT "
+
self
.
quoteIdentifier
(
identSource
)
+
" FROM "
+
self
.
quoteIdentifier
(
throughTable
)
+
" AS "
+
self
.
quoteIdentifier
(
throughAs
);
_where
+=
joinType
+
self
.
quote
Identifier
(
table
)
+
" AS "
+
self
.
quoteIdentifier
(
as
)
+
" ON "
+
targetJoinOn
;
_where
+=
joinType
+
self
.
quote
Table
(
table
)
+
" AS "
+
self
.
quoteIdentifier
(
as
)
+
" ON "
+
targetJoinOn
;
_where
+=
" WHERE "
+
sourceJoinOn
+
" AND "
+
targetWhere
+
" LIMIT 1"
_where
+=
" WHERE "
+
sourceJoinOn
+
" AND "
+
targetWhere
+
" LIMIT 1"
_where
+=
")"
;
_where
+=
")"
;
_where
+=
" IS NOT NULL"
_where
+=
" IS NOT NULL"
...
@@ -736,12 +736,12 @@ module.exports = (function() {
...
@@ -736,12 +736,12 @@ module.exports = (function() {
if
(
subQuery
&&
!
include
.
subQuery
&&
include
.
parent
.
subQuery
)
{
if
(
subQuery
&&
!
include
.
subQuery
&&
include
.
parent
.
subQuery
)
{
where
=
self
.
quoteIdentifier
(
tableLeft
+
"."
+
attrLeft
)
+
" = "
where
=
self
.
quoteIdentifier
(
tableLeft
+
"."
+
attrLeft
)
+
" = "
}
else
{
}
else
{
where
=
self
.
quote
Identifier
(
tableLeft
)
+
"."
+
self
.
quoteIdentifier
(
attrLeft
)
+
" = "
where
=
self
.
quote
Table
(
tableLeft
)
+
"."
+
self
.
quoteIdentifier
(
attrLeft
)
+
" = "
}
}
where
+=
self
.
quote
Identifier
(
tableRight
)
+
"."
+
self
.
quoteIdentifier
(
attrRight
)
where
+=
self
.
quote
Table
(
tableRight
)
+
"."
+
self
.
quoteIdentifier
(
attrRight
)
// Generate join SQL
// Generate join SQL
joinQueryItem
+=
joinType
+
self
.
quote
Identifier
(
table
)
+
" AS "
+
self
.
quoteIdentifier
(
as
)
+
" ON "
joinQueryItem
+=
joinType
+
self
.
quote
Table
(
table
)
+
" AS "
+
self
.
quoteIdentifier
(
as
)
+
" ON "
joinQueryItem
+=
where
joinQueryItem
+=
where
if
(
include
.
where
)
{
if
(
include
.
where
)
{
...
...
test/associations/belongs-to.test.js
View file @
872f66e
...
@@ -92,8 +92,6 @@ describe(Support.getTestDialectTeaser("BelongsTo"), function() {
...
@@ -92,8 +92,6 @@ describe(Support.getTestDialectTeaser("BelongsTo"), function() {
task
.
getUserXYZ
().
success
(
function
(
user
)
{
task
.
getUserXYZ
().
success
(
function
(
user
)
{
expect
(
user
).
to
.
be
.
ok
expect
(
user
).
to
.
be
.
ok
done
()
done
()
}).
on
(
'sql'
,
function
(
sql
)
{
console
.
log
(
sql
)
})
})
})
})
})
})
...
...
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