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 92d191d5
authored
Oct 30, 2012
by
Jan Aagaard Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
type flag on select
1 parent
6cc05eaf
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
lib/dao-factory.js
lib/dialects/abstract/query.js
lib/dao-factory.js
View file @
92d191d
...
...
@@ -104,7 +104,7 @@ module.exports = (function() {
}
this
.
daoFactoryManager
.
sequelize
.
_metric
(
'DAOFactory.findAll'
,
tk
.
time
()
-
start
);
return
this
.
QueryInterface
.
select
(
this
,
this
.
tableName
,
options
)
return
this
.
QueryInterface
.
select
(
this
,
this
.
tableName
,
options
,
{
type
:
'SELECT'
}
)
}
//right now, the caller (has-many-double-linked) is in charge of the where clause
...
...
@@ -112,11 +112,16 @@ module.exports = (function() {
var
optcpy
=
Utils
.
_
.
clone
(
options
)
optcpy
.
attributes
=
optcpy
.
attributes
||
[
Utils
.
addTicks
(
this
.
tableName
)
+
".*"
]
return
this
.
QueryInterface
.
select
(
this
,
[
this
.
tableName
,
joinTableName
],
optcpy
)
return
this
.
QueryInterface
.
select
(
this
,
[
this
.
tableName
,
joinTableName
],
optcpy
,
{
type
:
'SELECT'
}
)
}
DAOFactory
.
prototype
.
find
=
function
(
options
)
{
var
start
=
tk
.
time
();
var
queryOptions
=
{
plain
:
true
,
type
:
'SELECT'
};
// no options defined?
// return an emitter which emits null
if
([
null
,
undefined
].
indexOf
(
options
)
!==
-
1
)
{
...
...
@@ -143,6 +148,7 @@ module.exports = (function() {
options
=
{
where
:
where
}
}
else
if
((
typeof
options
===
'object'
)
&&
(
options
.
hasOwnProperty
(
'include'
)))
{
var
includes
=
options
.
include
queryOptions
.
hasJoin
=
true
;
options
.
include
=
{}
...
...
@@ -154,7 +160,7 @@ module.exports = (function() {
options
.
limit
=
1
this
.
daoFactoryManager
.
sequelize
.
_metric
(
'DAOFactory.find'
,
tk
.
time
()
-
start
);
return
this
.
QueryInterface
.
select
(
this
,
this
.
tableName
,
options
,
{
plain
:
true
}
)
return
this
.
QueryInterface
.
select
(
this
,
this
.
tableName
,
options
,
queryOptions
)
}
DAOFactory
.
prototype
.
count
=
function
(
options
)
{
...
...
@@ -180,7 +186,6 @@ module.exports = (function() {
return
this
.
QueryInterface
.
rawSelect
(
this
.
tableName
,
options
,
'min'
)
}
DAOFactory
.
prototype
.
build
=
function
(
values
,
options
)
{
var
start
=
tk
.
time
();
var
instance
=
new
DAO
(
values
,
Utils
.
_
.
extend
(
this
.
options
,
{
hasPrimaryKeys
:
this
.
hasPrimaryKeys
,
factory
:
this
}))
...
...
lib/dialects/abstract/query.js
View file @
92d191d
...
...
@@ -199,7 +199,7 @@ module.exports = (function() {
}
var
isSelectQuery
=
function
()
{
return
(
this
.
sql
.
toLowerCase
().
indexOf
(
'select'
)
===
0
)
return
this
.
options
.
type
===
'SELECT'
;
}
var
isUpdateQuery
=
function
()
{
...
...
@@ -207,12 +207,12 @@ module.exports = (function() {
}
var
handleSelectQuery
=
function
(
results
)
{
var
start
=
tk
.
time
()
,
_start
;
var
start
=
tk
.
time
();
var
result
=
null
,
self
=
this
;
if
(
this
.
options
.
raw
)
{
result
=
results
}
else
if
(
queryResultHasJoin
.
call
(
this
,
results
))
{
}
else
if
(
this
.
options
.
hasJoin
===
true
&&
queryResultHasJoin
.
call
(
this
,
results
))
{
result
=
prepareJoinData
.
call
(
this
,
results
)
result
=
groupDataByCalleeFactory
.
call
(
this
,
result
).
map
(
function
(
result
)
{
// let's build the actual dao instance first...
...
...
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