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 5a4bf2fa
authored
Jan 06, 2014
by
Mick Hansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Comments on comments on comments
1 parent
ffb5fcba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
lib/dialects/abstract/query-generator.js
lib/dialects/abstract/query-generator.js
View file @
5a4bf2f
...
@@ -462,6 +462,8 @@ module.exports = (function() {
...
@@ -462,6 +462,8 @@ module.exports = (function() {
*/
*/
selectQuery
:
function
(
tableName
,
options
,
factory
)
{
selectQuery
:
function
(
tableName
,
options
,
factory
)
{
// Enter and change at your own peril -- Mick Hansen
options
=
options
||
{}
options
=
options
||
{}
var
table
=
null
var
table
=
null
...
@@ -583,15 +585,21 @@ module.exports = (function() {
...
@@ -583,15 +585,21 @@ module.exports = (function() {
mainAttributes
=
mainAttributes
.
concat
(
throughAttributes
)
mainAttributes
=
mainAttributes
.
concat
(
throughAttributes
)
}
}
// Filter statement for left side of through
// Used by both join and subquery where
sourceJoinOn
=
self
.
quoteIdentifier
(
tableSource
)
+
"."
+
self
.
quoteIdentifier
(
attrSource
)
+
" = "
sourceJoinOn
=
self
.
quoteIdentifier
(
tableSource
)
+
"."
+
self
.
quoteIdentifier
(
attrSource
)
+
" = "
sourceJoinOn
+=
self
.
quoteIdentifier
(
throughAs
)
+
"."
+
self
.
quoteIdentifier
(
identSource
)
sourceJoinOn
+=
self
.
quoteIdentifier
(
throughAs
)
+
"."
+
self
.
quoteIdentifier
(
identSource
)
// Filter statement for right side of through
// Used by both join and subquery where
targetJoinOn
=
self
.
quoteIdentifier
(
tableTarget
)
+
"."
+
self
.
quoteIdentifier
(
attrTarget
)
+
" = "
targetJoinOn
=
self
.
quoteIdentifier
(
tableTarget
)
+
"."
+
self
.
quoteIdentifier
(
attrTarget
)
+
" = "
targetJoinOn
+=
self
.
quoteIdentifier
(
throughAs
)
+
"."
+
self
.
quoteIdentifier
(
identTarget
)
targetJoinOn
+=
self
.
quoteIdentifier
(
throughAs
)
+
"."
+
self
.
quoteIdentifier
(
identTarget
)
// Generate join SQL for left side of through
joinQueryItem
+=
joinType
+
self
.
quoteIdentifier
(
throughTable
)
+
" AS "
+
self
.
quoteIdentifier
(
throughAs
)
+
" ON "
joinQueryItem
+=
joinType
+
self
.
quoteIdentifier
(
throughTable
)
+
" AS "
+
self
.
quoteIdentifier
(
throughAs
)
+
" ON "
joinQueryItem
+=
sourceJoinOn
joinQueryItem
+=
sourceJoinOn
// Generate join SQL for right side of through
joinQueryItem
+=
joinType
+
self
.
quoteIdentifier
(
table
)
+
" AS "
+
self
.
quoteIdentifier
(
as
)
+
" ON "
joinQueryItem
+=
joinType
+
self
.
quoteIdentifier
(
table
)
+
" AS "
+
self
.
quoteIdentifier
(
as
)
+
" ON "
joinQueryItem
+=
targetJoinOn
joinQueryItem
+=
targetJoinOn
...
@@ -621,9 +629,12 @@ module.exports = (function() {
...
@@ -621,9 +629,12 @@ module.exports = (function() {
,
attrRight
=
association
.
identifier
,
attrRight
=
association
.
identifier
,
where
,
where
// Filter statement
// Used by both join and subquery where
where
=
self
.
quoteIdentifier
(
tableLeft
)
+
"."
+
self
.
quoteIdentifier
(
attrLeft
)
+
" = "
where
=
self
.
quoteIdentifier
(
tableLeft
)
+
"."
+
self
.
quoteIdentifier
(
attrLeft
)
+
" = "
where
+=
self
.
quoteIdentifier
(
tableRight
)
+
"."
+
self
.
quoteIdentifier
(
attrRight
)
where
+=
self
.
quoteIdentifier
(
tableRight
)
+
"."
+
self
.
quoteIdentifier
(
attrRight
)
// Generate join SQL
joinQueryItem
+=
joinType
+
self
.
quoteIdentifier
(
table
)
+
" AS "
+
self
.
quoteIdentifier
(
as
)
+
" ON "
joinQueryItem
+=
joinType
+
self
.
quoteIdentifier
(
table
)
+
" AS "
+
self
.
quoteIdentifier
(
as
)
+
" ON "
joinQueryItem
+=
where
joinQueryItem
+=
where
...
...
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