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 54163dc3
authored
Oct 30, 2012
by
Mick Hansen
Committed by
Jan Aagaard Meier
Oct 31, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
picking
1 parent
98cd40a2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
6 deletions
lib/dao-factory.js
lib/dao.js
lib/dialects/mysql/query.js
lib/query-interface.js
lib/dao-factory.js
View file @
54163dc
...
...
@@ -103,7 +103,7 @@ module.exports = (function() {
}.
bind
(
this
))
}
this
.
daoFactoryManager
.
sequelize
.
_metric
(
'
Model
.findAll'
,
tk
.
time
()
-
start
);
this
.
daoFactoryManager
.
sequelize
.
_metric
(
'
DAOFactory
.findAll'
,
tk
.
time
()
-
start
);
return
this
.
QueryInterface
.
select
(
this
,
this
.
tableName
,
options
)
}
...
...
@@ -150,7 +150,7 @@ module.exports = (function() {
options
.
limit
=
1
this
.
daoFactoryManager
.
sequelize
.
_metric
(
'
Model
.find'
,
tk
.
time
()
-
start
);
this
.
daoFactoryManager
.
sequelize
.
_metric
(
'
DAOFactory
.find'
,
tk
.
time
()
-
start
);
return
this
.
QueryInterface
.
select
(
this
,
this
.
tableName
,
options
,
{
plain
:
true
})
}
...
...
@@ -180,8 +180,10 @@ module.exports = (function() {
DAOFactory
.
prototype
.
build
=
function
(
values
,
options
)
{
var
start
=
tk
.
time
();
var
instance
=
new
DAO
(
values
,
Utils
.
_
.
extend
(
this
.
options
,
this
.
attributes
,
{
hasPrimaryKeys
:
this
.
hasPrimaryKey
s
}))
var
instance
=
new
DAO
(
values
,
Utils
.
_
.
extend
(
this
.
options
,
{
hasPrimaryKeys
:
this
.
hasPrimaryKeys
,
factory
:
thi
s
}))
,
self
=
this
this
.
daoFactoryManager
.
sequelize
.
_metric
(
'DAOFactory.newDAO'
,
tk
.
time
()
-
start
);
options
=
options
||
{}
instance
.
__factory
=
this
...
...
@@ -218,7 +220,7 @@ module.exports = (function() {
instance
.
isNewRecord
=
options
.
hasOwnProperty
(
'isNewRecord'
)
?
options
.
isNewRecord
:
true
instance
.
selectedValues
=
values
this
.
daoFactoryManager
.
sequelize
.
_metric
(
'
Model
.build'
,
tk
.
time
()
-
start
);
this
.
daoFactoryManager
.
sequelize
.
_metric
(
'
DAOFactory
.build'
,
tk
.
time
()
-
start
);
return
instance
}
...
...
lib/dao.js
View file @
54163dc
...
...
@@ -2,11 +2,14 @@ var Utils = require("./utils")
,
Mixin
=
require
(
"./associations/mixin"
)
,
Validator
=
require
(
"validator"
)
var
tk
=
require
(
'timekit'
);
module
.
exports
=
(
function
()
{
var
DAO
=
function
(
values
,
options
)
{
var
start
=
tk
.
time
();
this
.
attributes
=
[]
this
.
validators
=
{}
// holds validation settings for each attribute
this
.
__factory
=
null
// will be set in DAO.build
this
.
__factory
=
options
.
factory
||
null
// will be set by DAO.build if not present
this
.
__options
=
Utils
.
_
.
extend
({
underscored
:
false
,
hasPrimaryKeys
:
false
,
...
...
@@ -15,6 +18,8 @@ module.exports = (function() {
},
options
||
{})
initAttributes
.
call
(
this
,
values
)
this
.
sequelize
.
_metric
(
'DAO.construct'
,
tk
.
time
()
-
start
);
}
Utils
.
_
.
extend
(
DAO
.
prototype
,
Mixin
.
prototype
)
...
...
lib/dialects/mysql/query.js
View file @
54163dc
...
...
@@ -36,6 +36,7 @@ module.exports = (function() {
}
}.
bind
(
this
)).
setMaxListeners
(
100
)
this
.
sequelize
.
_metric
(
'Query.run'
,
tk
.
time
()
-
start
);
return
this
}
...
...
lib/query-interface.js
View file @
54163dc
...
...
@@ -287,7 +287,7 @@ module.exports = (function() {
})
query
.
on
(
'sql'
,
function
(
sql
)
{
emitter
.
emit
(
'sql'
,
sql
)
})
})
;
}).
run
()
}
...
...
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