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 bf36239a
authored
Aug 20, 2014
by
ThePoloQ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update query-generator.js
1 parent
1d104c1d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
5 deletions
lib/dialects/abstract/query-generator.js
lib/dialects/abstract/query-generator.js
View file @
bf36239
...
...
@@ -407,6 +407,38 @@ module.exports = (function() {
}
},
getTableNameOrder
:
function
(
obj
){
if
(
Utils
.
_
.
isString
(
obj
))
{
return
obj
}
else
if
(
Array
.
isArray
(
obj
))
{
return
this
.
getTableNameOrder
(
obj
[
0
])
}
else
if
(
obj
instanceof
Utils
.
fn
)
{
return
this
.
getTableNameOrder
(
obj
.
args
)
}
else
if
(
obj
instanceof
Utils
.
col
)
{
return
obj
.
col
.
split
(
'.'
)[
0
]
}
else
if
(
'raw'
in
obj
){
return
obj
.
raw
}
else
{
return
''
}
},
getSpecificQuoteOrder
:
function
(
obj
){
if
(
Utils
.
_
.
isString
(
obj
))
{
return
this
.
quoteIdentifier
(
obj
)
}
else
if
(
Array
.
isArray
(
obj
))
{
return
this
.
getSpecificQuoteOrder
(
obj
[
0
])
+
(
obj
.
length
>
1
?
' '
+
obj
[
1
]
:
''
)
}
else
if
(
obj
instanceof
Utils
.
fn
)
{
return
obj
.
fn
+
'('
+
this
.
getSpecificQuoteOrder
(
obj
.
args
)
+
')'
}
else
if
(
obj
instanceof
Utils
.
col
)
{
return
this
.
quoteIdentifier
(
obj
.
col
)
}
else
if
(
'raw'
in
obj
){
return
obj
.
raw
}
else
{
return
''
}
},
/*
Create a trigger
*/
...
...
@@ -802,16 +834,15 @@ module.exports = (function() {
if
(
Array
.
isArray
(
options
.
order
))
{
options
.
order
.
forEach
(
function
(
t
)
{
var
strOrder
=
this
.
quote
(
t
,
factory
)
var
asName
=
strOrder
.
match
(
/`
(
.*
)
`
\.
/
)
var
tableName
=
this
.
getTableNameOrder
(
t
)
if
(
subQuery
&&
!
(
t
[
0
]
instanceof
daoFactory
)
&&
!
(
t
[
0
].
model
instanceof
daoFactory
))
{
if
(
asName
&&
subQueryAs
.
indexOf
(
asName
[
1
]
)
>
-
1
){
if
(
tableName
&&
subQueryAs
.
indexOf
(
tableName
)
>
-
1
){
subQueryOrder
.
push
(
strOrder
)
}
}
if
(
subQuery
&&
asName
&&
asName
[
1
]
!=
subQueryAs
[
0
]
&&
subQueryAs
.
indexOf
(
asName
[
1
]
)
>
-
1
){
mainQueryOrder
.
push
(
strOrder
.
replace
(
/`
\.
`/
,
'.'
))
if
(
subQuery
&&
tableName
!==
subQueryAs
[
0
]
&&
subQueryAs
.
indexOf
(
tableName
)
>
-
1
){
mainQueryOrder
.
push
(
this
.
getSpecificQuoteOrder
(
t
))
}
else
{
mainQueryOrder
.
push
(
strOrder
)
}
...
...
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