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 684c3528
authored
May 17, 2015
by
Mick Hansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove unused query generator code
1 parent
2bd542ac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
157 deletions
lib/dialects/abstract/query-generator.js
lib/dialects/mssql/query-generator.js
lib/dialects/abstract/query-generator.js
View file @
684c352
...
@@ -2028,147 +2028,6 @@ module.exports = (function() {
...
@@ -2028,147 +2028,6 @@ module.exports = (function() {
return
result
?
result
:
'1=1'
;
return
result
?
result
:
'1=1'
;
},
},
prependTableNameToHash
:
function
(
tableName
,
hash
)
{
if
(
tableName
)
{
var
_hash
=
{};
for
(
var
key
in
hash
)
{
if
(
key
.
indexOf
(
'.'
)
===
-
1
)
{
if
(
tableName
instanceof
Utils
.
literal
)
{
_hash
[
tableName
.
val
+
'.'
+
this
.
quoteIdentifier
(
key
)]
=
hash
[
key
];
}
else
{
_hash
[
this
.
quoteTable
(
tableName
)
+
'.'
+
this
.
quoteIdentifier
(
key
)]
=
hash
[
key
];
}
}
else
{
_hash
[
this
.
quoteIdentifiers
(
key
)]
=
hash
[
key
];
}
}
return
_hash
;
}
else
{
return
hash
;
}
},
findAssociation
:
function
(
attribute
,
model
)
{
var
associationToReturn
;
Object
.
keys
(
model
.
associations
).
forEach
(
function
(
key
)
{
if
(
!
model
.
associations
[
key
])
return
;
var
association
=
model
.
associations
[
key
]
,
associationName
;
associationName
=
association
.
as
;
if
(
associationName
===
attribute
)
{
associationToReturn
=
association
;
}
});
return
associationToReturn
;
},
getAssociationFilterDAO
:
function
(
filterStr
,
model
)
{
var
associationParts
=
filterStr
.
split
(
'.'
)
,
self
=
this
;
associationParts
.
pop
();
associationParts
.
forEach
(
function
(
attribute
)
{
model
=
self
.
findAssociation
(
attribute
,
model
).
target
;
});
return
model
;
},
isAssociationFilter
:
function
(
filterStr
,
model
)
{
if
(
!
model
)
{
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
,
model
);
if
(
!
association
)
return
false
;
model
=
association
.
target
;
return
!!
model
;
})
&&
model
.
rawAttributes
.
hasOwnProperty
(
attributePart
);
},
getAssociationFilterColumn
:
function
(
filterStr
,
model
,
options
)
{
var
associationParts
=
filterStr
.
split
(
'.'
)
,
attributePart
=
associationParts
.
pop
()
,
self
=
this
,
association
,
keyParts
=
[];
associationParts
.
forEach
(
function
(
attribute
)
{
association
=
self
.
findAssociation
(
attribute
,
model
);
model
=
association
.
target
;
if
(
options
.
include
)
{
keyParts
.
push
(
association
.
as
||
association
.
options
.
as
||
model
.
tableName
);
}
});
if
(
options
.
include
)
{
return
this
.
quoteIdentifier
(
keyParts
.
join
(
'.'
))
+
'.'
+
this
.
quoteIdentifiers
(
attributePart
);
}
return
this
.
quoteIdentifiers
(
model
.
tableName
+
'.'
+
attributePart
);
},
getConditionalJoins
:
function
(
options
,
originalDao
)
{
var
joins
=
''
,
self
=
this
,
joinedTables
=
{};
if
(
Utils
.
_
.
isPlainObject
(
options
.
where
))
{
Object
.
keys
(
options
.
where
).
forEach
(
function
(
filterStr
)
{
var
associationParts
=
filterStr
.
split
(
'.'
)
,
model
=
originalDao
;
if
(
self
.
isAssociationFilter
(
filterStr
,
model
))
{
associationParts
.
forEach
(
function
(
attribute
)
{
var
association
=
self
.
findAssociation
(
attribute
,
model
);
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
.
model
)
===
association
.
through
.
model
)
{
joinedTables
[
association
.
through
.
model
.
tableName
]
=
true
;
joins
+=
' LEFT JOIN '
+
self
.
quoteIdentifiers
(
association
.
through
.
model
.
tableName
);
joins
+=
' ON '
+
self
.
quoteIdentifiers
(
association
.
source
.
tableName
+
'.'
+
association
.
source
.
autoIncrementField
);
joins
+=
' = '
+
self
.
quoteIdentifiers
(
association
.
through
.
model
.
tableName
+
'.'
+
association
.
identifier
);
joins
+=
' LEFT JOIN '
+
self
.
quoteIdentifiers
(
association
.
target
.
tableName
);
joins
+=
' ON '
+
self
.
quoteIdentifiers
(
association
.
through
.
model
.
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
);
}
}
model
=
association
.
target
;
});
}
});
}
return
joins
;
},
booleanValue
:
function
(
value
)
{
booleanValue
:
function
(
value
)
{
return
value
;
return
value
;
}
}
...
...
lib/dialects/mssql/query-generator.js
View file @
684c352
...
@@ -585,22 +585,6 @@ module.exports = (function() {
...
@@ -585,22 +585,6 @@ module.exports = (function() {
return
fragment
;
return
fragment
;
},
},
findAssociation
:
function
()
{
throwMethodUndefined
(
'findAssociation'
);
},
getAssociationFilterDAO
:
function
()
{
throwMethodUndefined
(
'getAssociationFilterDAO'
);
},
getAssociationFilterColumn
:
function
()
{
throwMethodUndefined
(
'getAssociationFilterColumn'
);
},
getConditionalJoins
:
function
()
{
throwMethodUndefined
(
'getConditionalJoins'
);
},
booleanValue
:
function
(
value
)
{
booleanValue
:
function
(
value
)
{
return
!!
value
?
1
:
0
;
return
!!
value
?
1
:
0
;
}
}
...
...
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