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 30b59964
authored
Feb 08, 2014
by
Mick Hansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove unused query generator methods
1 parent
add75a67
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
129 deletions
lib/dialects/abstract/query-generator.js
lib/dialects/abstract/query-generator.js
View file @
30b5996
...
@@ -935,131 +935,6 @@ module.exports = (function() {
...
@@ -935,131 +935,6 @@ module.exports = (function() {
return
result
?
result
:
'1=1'
return
result
?
result
:
'1=1'
},
},
findAssociation
:
function
(
attribute
,
dao
){
var
associationToReturn
;
Object
.
keys
(
dao
.
associations
).
forEach
(
function
(
key
){
if
(
!
dao
.
associations
[
key
])
return
;
var
association
=
dao
.
associations
[
key
]
,
associationName
if
(
association
.
associationType
===
'BelongsTo'
)
{
associationName
=
Utils
.
singularize
(
association
.
associationAccessor
[
0
].
toLowerCase
()
+
association
.
associationAccessor
.
slice
(
1
));
}
else
{
associationName
=
association
.
accessors
.
get
.
replace
(
'get'
,
''
)
associationName
=
associationName
[
0
].
toLowerCase
()
+
associationName
.
slice
(
1
);
}
if
(
associationName
===
attribute
){
associationToReturn
=
association
;
}
});
return
associationToReturn
;
},
getAssociationFilterDAO
:
function
(
filterStr
,
dao
){
var
associationParts
=
filterStr
.
split
(
'.'
)
,
self
=
this
associationParts
.
pop
()
associationParts
.
forEach
(
function
(
attribute
)
{
dao
=
self
.
findAssociation
(
attribute
,
dao
).
target
;
});
return
dao
;
},
isAssociationFilter
:
function
(
filterStr
,
dao
,
options
){
if
(
!
dao
){
return
false
;
}
var
pattern
=
/^
[
a-z
][
a-zA-Z0-9
]
+
(\.[
a-z
][
a-zA-Z0-9
]
+
)
+$/
;
if
(
!
pattern
.
test
(
filterStr
))
return
false
;
var
associationParts
=
filterStr
.
split
(
'.'
)
,
attributePart
=
associationParts
.
pop
()
,
self
=
this
return
associationParts
.
every
(
function
(
attribute
)
{
var
association
=
self
.
findAssociation
(
attribute
,
dao
);
if
(
!
association
)
return
false
;
dao
=
association
.
target
;
return
!!
dao
;
})
&&
dao
.
rawAttributes
.
hasOwnProperty
(
attributePart
);
},
getAssociationFilterColumn
:
function
(
filterStr
,
dao
,
options
){
var
associationParts
=
filterStr
.
split
(
'.'
)
,
attributePart
=
associationParts
.
pop
()
,
self
=
this
,
association
,
keyParts
=
[]
associationParts
.
forEach
(
function
(
attribute
)
{
association
=
self
.
findAssociation
(
attribute
,
dao
)
dao
=
association
.
target
;
if
(
options
.
include
)
{
keyParts
.
push
(
association
.
as
||
association
.
options
.
as
||
dao
.
tableName
)
}
})
if
(
options
.
include
)
{
return
this
.
quoteIdentifier
(
keyParts
.
join
(
'.'
))
+
'.'
+
this
.
quoteIdentifiers
(
attributePart
)
}
return
this
.
quoteIdentifiers
(
dao
.
tableName
+
'.'
+
attributePart
)
},
getConditionalJoins
:
function
(
options
,
originalDao
){
var
joins
=
''
,
self
=
this
,
joinedTables
=
{}
if
(
Utils
.
isHash
(
options
.
where
))
{
Object
.
keys
(
options
.
where
).
forEach
(
function
(
filterStr
){
var
associationParts
=
filterStr
.
split
(
'.'
)
,
attributePart
=
associationParts
.
pop
()
,
dao
=
originalDao
if
(
self
.
isAssociationFilter
(
filterStr
,
dao
,
options
))
{
associationParts
.
forEach
(
function
(
attribute
)
{
var
association
=
self
.
findAssociation
(
attribute
,
dao
);
if
(
!
joinedTables
[
association
.
target
.
tableName
]){
joinedTables
[
association
.
target
.
tableName
]
=
true
;
if
(
association
.
associationType
===
'BelongsTo'
){
joins
+=
' LEFT JOIN '
+
self
.
quoteIdentifiers
(
association
.
target
.
tableName
)
joins
+=
' ON '
+
self
.
quoteIdentifiers
(
association
.
source
.
tableName
+
'.'
+
association
.
identifier
)
joins
+=
' = '
+
self
.
quoteIdentifiers
(
association
.
target
.
tableName
+
'.'
+
association
.
target
.
autoIncrementField
)
}
else
if
(
Object
(
association
.
through
)
===
association
.
through
)
{
joinedTables
[
association
.
through
.
tableName
]
=
true
;
joins
+=
' LEFT JOIN '
+
self
.
quoteIdentifiers
(
association
.
through
.
tableName
)
joins
+=
' ON '
+
self
.
quoteIdentifiers
(
association
.
source
.
tableName
+
'.'
+
association
.
source
.
autoIncrementField
)
joins
+=
' = '
+
self
.
quoteIdentifiers
(
association
.
through
.
tableName
+
'.'
+
association
.
identifier
)
joins
+=
' LEFT JOIN '
+
self
.
quoteIdentifiers
(
association
.
target
.
tableName
)
joins
+=
' ON '
+
self
.
quoteIdentifiers
(
association
.
through
.
tableName
+
'.'
+
association
.
foreignIdentifier
)
joins
+=
' = '
+
self
.
quoteIdentifiers
(
association
.
target
.
tableName
+
'.'
+
association
.
target
.
autoIncrementField
)
}
else
{
joins
+=
' LEFT JOIN '
+
self
.
quoteIdentifiers
(
association
.
target
.
tableName
)
joins
+=
' ON '
+
self
.
quoteIdentifiers
(
association
.
source
.
tableName
+
'.'
+
association
.
source
.
autoIncrementField
)
joins
+=
' = '
+
self
.
quoteIdentifiers
(
association
.
target
.
tableName
+
'.'
+
association
.
identifier
)
}
}
dao
=
association
.
target
;
});
}
});
}
return
joins
;
},
arrayValue
:
function
(
value
,
key
,
_key
,
factory
,
logicResult
){
arrayValue
:
function
(
value
,
key
,
_key
,
factory
,
logicResult
){
var
_value
=
null
;
var
_value
=
null
;
...
@@ -1090,12 +965,8 @@ module.exports = (function() {
...
@@ -1090,12 +965,8 @@ module.exports = (function() {
if
(
options
.
keysEscaped
)
{
if
(
options
.
keysEscaped
)
{
_key
=
key
_key
=
key
}
else
{
}
else
{
if
(
this
.
isAssociationFilter
(
key
,
dao
,
options
)){
_key
=
key
=
this
.
getAssociationFilterColumn
(
key
,
dao
,
options
);
}
else
{
_key
=
this
.
quoteIdentifiers
(
key
)
_key
=
this
.
quoteIdentifiers
(
key
)
}
}
}
if
(
Array
.
isArray
(
value
))
{
if
(
Array
.
isArray
(
value
))
{
result
.
push
(
this
.
arrayValue
(
value
,
key
,
_key
,
dao
,
"IN"
))
result
.
push
(
this
.
arrayValue
(
value
,
key
,
_key
,
dao
,
"IN"
))
...
...
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