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 7cf8e14b
authored
Jun 30, 2012
by
sdepold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use error event instead of failure
1 parent
74a0ef95
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
73 additions
and
74 deletions
lib/associations/has-many-double-linked.js
lib/associations/has-many-single-linked.js
lib/associations/has-many.js
lib/associations/has-one.js
lib/dao-factory.js
lib/dialects/mysql/connector-manager.js
lib/dialects/mysql/query.js
lib/dialects/postgres/query.js
lib/dialects/query.js
lib/dialects/sqlite/query.js
lib/emitters/custom-event-emitter.js
lib/emitters/null-emitter.js
lib/migrator.js
lib/query-chainer.js
lib/query-interface.js
lib/sequelize.js
spec-jasmine/config/factories.js
spec-jasmine/config/helpers.js
spec-jasmine/sqlite/dao-factory.spec.js
spec/config/factories.js
spec/config/helpers.js
lib/associations/has-many-double-linked.js
View file @
7cf8e14
...
@@ -20,7 +20,7 @@ module.exports = (function() {
...
@@ -20,7 +20,7 @@ module.exports = (function() {
where
[
self
.
__factory
.
connectorDAO
.
tableName
+
"."
+
foreignKey
]
=
{
join
:
self
.
__factory
.
target
.
tableName
+
".id"
}
where
[
self
.
__factory
.
connectorDAO
.
tableName
+
"."
+
foreignKey
]
=
{
join
:
self
.
__factory
.
target
.
tableName
+
".id"
}
self
.
__factory
.
target
.
findAllJoin
(
self
.
__factory
.
connectorDAO
.
tableName
,
{
where
:
where
})
self
.
__factory
.
target
.
findAllJoin
(
self
.
__factory
.
connectorDAO
.
tableName
,
{
where
:
where
})
.
on
(
'success'
,
function
(
objects
)
{
customEventEmitter
.
emit
(
'success'
,
objects
)
})
.
on
(
'success'
,
function
(
objects
)
{
customEventEmitter
.
emit
(
'success'
,
objects
)
})
.
on
(
'
failure'
,
function
(
err
){
customEventEmitter
.
emit
(
'failure
'
,
err
)
})
.
on
(
'
error'
,
function
(
err
){
customEventEmitter
.
emit
(
'error
'
,
err
)
})
.
on
(
'sql'
,
function
(
sql
)
{
customEventEmitter
.
emit
(
'sql'
,
sql
)})
.
on
(
'sql'
,
function
(
sql
)
{
customEventEmitter
.
emit
(
'sql'
,
sql
)})
})
})
...
@@ -31,7 +31,7 @@ module.exports = (function() {
...
@@ -31,7 +31,7 @@ module.exports = (function() {
var
self
=
this
var
self
=
this
destroyObsoleteAssociations
.
call
(
this
,
oldAssociations
,
newAssociations
)
destroyObsoleteAssociations
.
call
(
this
,
oldAssociations
,
newAssociations
)
.
error
(
function
(
err
)
{
emitter
.
emit
(
'
failure
'
,
err
)
})
.
error
(
function
(
err
)
{
emitter
.
emit
(
'
error
'
,
err
)
})
.
on
(
'sql'
,
function
(
sql
)
{
emitter
.
emit
(
'sql'
,
sql
)
})
.
on
(
'sql'
,
function
(
sql
)
{
emitter
.
emit
(
'sql'
,
sql
)
})
.
success
(
function
()
{
.
success
(
function
()
{
var
chainer
=
new
Utils
.
QueryChainer
var
chainer
=
new
Utils
.
QueryChainer
...
@@ -50,7 +50,7 @@ module.exports = (function() {
...
@@ -50,7 +50,7 @@ module.exports = (function() {
chainer
chainer
.
run
()
.
run
()
.
success
(
function
()
{
emitter
.
emit
(
'success'
,
newAssociations
)
})
.
success
(
function
()
{
emitter
.
emit
(
'success'
,
newAssociations
)
})
.
error
(
function
(
err
)
{
emitter
.
emit
(
'
failure
'
,
err
)
})
.
error
(
function
(
err
)
{
emitter
.
emit
(
'
error
'
,
err
)
})
.
on
(
'sql'
,
function
(
sql
)
{
emitter
.
emit
(
'sql'
,
sql
)
})
.
on
(
'sql'
,
function
(
sql
)
{
emitter
.
emit
(
'sql'
,
sql
)
})
})
})
}
}
...
@@ -84,7 +84,7 @@ module.exports = (function() {
...
@@ -84,7 +84,7 @@ module.exports = (function() {
chainer
chainer
.
run
()
.
run
()
.
success
(
function
()
{
emitter
.
emit
(
'success'
,
null
)
})
.
success
(
function
()
{
emitter
.
emit
(
'success'
,
null
)
})
.
error
(
function
(
err
)
{
emitter
.
emit
(
'
failure
'
,
err
)
})
.
error
(
function
(
err
)
{
emitter
.
emit
(
'
error
'
,
err
)
})
.
on
(
'sql'
,
function
(
sql
)
{
emitter
.
emit
(
'sql'
,
sql
)
})
.
on
(
'sql'
,
function
(
sql
)
{
emitter
.
emit
(
'sql'
,
sql
)
})
}
}
})
})
...
...
lib/associations/has-many-single-linked.js
View file @
7cf8e14
...
@@ -31,7 +31,7 @@ module.exports = (function() {
...
@@ -31,7 +31,7 @@ module.exports = (function() {
chainer
chainer
.
run
()
.
run
()
.
success
(
function
()
{
emitter
.
emit
(
'success'
,
newAssociations
)
})
.
success
(
function
()
{
emitter
.
emit
(
'success'
,
newAssociations
)
})
.
error
(
function
(
err
)
{
emitter
.
emit
(
'
failure
'
,
err
)
})
.
error
(
function
(
err
)
{
emitter
.
emit
(
'
error
'
,
err
)
})
}
}
return
HasManySingleLinked
return
HasManySingleLinked
...
...
lib/associations/has-many.js
View file @
7cf8e14
...
@@ -24,8 +24,8 @@ module.exports = (function() {
...
@@ -24,8 +24,8 @@ module.exports = (function() {
set
:
Utils
.
_
.
camelize
(
'set_'
+
as
),
set
:
Utils
.
_
.
camelize
(
'set_'
+
as
),
add
:
Utils
.
_
.
camelize
(
Utils
.
singularize
(
'add_'
+
as
)),
add
:
Utils
.
_
.
camelize
(
Utils
.
singularize
(
'add_'
+
as
)),
remove
:
Utils
.
_
.
camelize
(
Utils
.
singularize
(
'remove_'
+
as
)),
remove
:
Utils
.
_
.
camelize
(
Utils
.
singularize
(
'remove_'
+
as
)),
hasSingle
:
Utils
.
_
.
camelize
(
Utils
.
singularize
(
'has_'
+
as
)),
hasSingle
:
Utils
.
_
.
camelize
(
Utils
.
singularize
(
'has_'
+
as
)),
hasAll
:
Utils
.
_
.
camelize
(
'has_'
+
as
)
hasAll
:
Utils
.
_
.
camelize
(
'has_'
+
as
)
}
}
}
}
...
@@ -73,44 +73,44 @@ module.exports = (function() {
...
@@ -73,44 +73,44 @@ module.exports = (function() {
var
Class
=
self
.
connectorDAO
?
HasManyMultiLinked
:
HasManySingleLinked
var
Class
=
self
.
connectorDAO
?
HasManyMultiLinked
:
HasManySingleLinked
return
new
Class
(
self
,
this
).
injectGetter
()
return
new
Class
(
self
,
this
).
injectGetter
()
}
}
obj
[
this
.
accessors
.
hasAll
]
=
function
(
objects
)
{
obj
[
this
.
accessors
.
hasAll
]
=
function
(
objects
)
{
var
instance
=
this
;
var
instance
=
this
;
var
customEventEmitter
=
new
Utils
.
CustomEventEmitter
(
function
()
{
var
customEventEmitter
=
new
Utils
.
CustomEventEmitter
(
function
()
{
instance
[
self
.
accessors
.
get
]()
instance
[
self
.
accessors
.
get
]()
.
error
(
function
(
err
){
customEventEmitter
.
emit
(
'failure
'
,
err
)})
.
error
(
function
(
err
){
customEventEmitter
.
emit
(
'error
'
,
err
)})
.
success
(
function
(
associatedObjects
)
{
.
success
(
function
(
associatedObjects
)
{
customEventEmitter
.
emit
(
'success'
,
customEventEmitter
.
emit
(
'success'
,
Utils
.
_
.
all
(
objects
,
function
(
o
)
{
Utils
.
_
.
all
(
objects
,
function
(
o
)
{
return
Utils
.
_
.
any
(
associatedObjects
,
function
(
associatedObject
)
{
return
Utils
.
_
.
any
(
associatedObjects
,
function
(
associatedObject
)
{
return
Utils
.
_
.
all
(
associatedObject
.
identifiers
,
function
(
key
,
identifier
)
{
return
Utils
.
_
.
all
(
associatedObject
.
identifiers
,
function
(
key
,
identifier
)
{
return
o
[
identifier
]
==
associatedObject
[
identifier
];
return
o
[
identifier
]
==
associatedObject
[
identifier
];
});
});
})
})
})
})
)
)
})
})
})
})
return
customEventEmitter
.
run
()
return
customEventEmitter
.
run
()
}
}
obj
[
this
.
accessors
.
hasSingle
]
=
function
(
o
)
{
obj
[
this
.
accessors
.
hasSingle
]
=
function
(
o
)
{
var
instance
=
this
;
var
instance
=
this
;
var
customEventEmitter
=
new
Utils
.
CustomEventEmitter
(
function
()
{
var
customEventEmitter
=
new
Utils
.
CustomEventEmitter
(
function
()
{
instance
[
self
.
accessors
.
get
]()
instance
[
self
.
accessors
.
get
]()
.
error
(
function
(
err
){
customEventEmitter
.
emit
(
'failure
'
,
err
)})
.
error
(
function
(
err
){
customEventEmitter
.
emit
(
'error
'
,
err
)})
.
success
(
function
(
associatedObjects
)
{
.
success
(
function
(
associatedObjects
)
{
customEventEmitter
.
emit
(
'success'
,
customEventEmitter
.
emit
(
'success'
,
Utils
.
_
.
any
(
associatedObjects
,
function
(
associatedObject
)
{
Utils
.
_
.
any
(
associatedObjects
,
function
(
associatedObject
)
{
return
Utils
.
_
.
all
(
associatedObject
.
identifiers
,
function
(
key
,
identifier
)
{
return
Utils
.
_
.
all
(
associatedObject
.
identifiers
,
function
(
key
,
identifier
)
{
return
o
[
identifier
]
==
associatedObject
[
identifier
];
return
o
[
identifier
]
==
associatedObject
[
identifier
];
});
});
})
})
)
)
})
})
})
})
return
customEventEmitter
.
run
()
return
customEventEmitter
.
run
()
}
}
return
this
return
this
}
}
...
@@ -134,14 +134,14 @@ module.exports = (function() {
...
@@ -134,14 +134,14 @@ module.exports = (function() {
var
instance
=
this
var
instance
=
this
var
customEventEmitter
=
new
Utils
.
CustomEventEmitter
(
function
()
{
var
customEventEmitter
=
new
Utils
.
CustomEventEmitter
(
function
()
{
instance
[
self
.
accessors
.
get
]()
instance
[
self
.
accessors
.
get
]()
.
error
(
function
(
err
){
customEventEmitter
.
emit
(
'
failure
'
,
err
)})
.
error
(
function
(
err
){
customEventEmitter
.
emit
(
'
error
'
,
err
)})
.
success
(
function
(
currentAssociatedObjects
)
{
.
success
(
function
(
currentAssociatedObjects
)
{
if
(
!
newAssociatedObject
.
equalsOneOf
(
currentAssociatedObjects
))
if
(
!
newAssociatedObject
.
equalsOneOf
(
currentAssociatedObjects
))
currentAssociatedObjects
.
push
(
newAssociatedObject
)
currentAssociatedObjects
.
push
(
newAssociatedObject
)
instance
[
self
.
accessors
.
set
](
currentAssociatedObjects
)
instance
[
self
.
accessors
.
set
](
currentAssociatedObjects
)
.
success
(
function
(
instances
)
{
customEventEmitter
.
emit
(
'success'
,
instances
)
})
.
success
(
function
(
instances
)
{
customEventEmitter
.
emit
(
'success'
,
instances
)
})
.
error
(
function
(
err
)
{
customEventEmitter
.
emit
(
'
failure
'
,
err
)
})
.
error
(
function
(
err
)
{
customEventEmitter
.
emit
(
'
error
'
,
err
)
})
})
})
})
})
return
customEventEmitter
.
run
()
return
customEventEmitter
.
run
()
...
@@ -160,7 +160,7 @@ module.exports = (function() {
...
@@ -160,7 +160,7 @@ module.exports = (function() {
instance
[
self
.
accessors
.
set
](
newAssociations
)
instance
[
self
.
accessors
.
set
](
newAssociations
)
.
success
(
function
()
{
customEventEmitter
.
emit
(
'success'
,
null
)
})
.
success
(
function
()
{
customEventEmitter
.
emit
(
'success'
,
null
)
})
.
error
(
function
(
err
)
{
customEventEmitter
.
emit
(
'
failure
'
,
err
)
})
.
error
(
function
(
err
)
{
customEventEmitter
.
emit
(
'
error
'
,
err
)
})
})
})
})
})
return
customEventEmitter
.
run
()
return
customEventEmitter
.
run
()
...
...
lib/associations/has-one.js
View file @
7cf8e14
...
@@ -60,7 +60,7 @@ module.exports = (function() {
...
@@ -60,7 +60,7 @@ module.exports = (function() {
associatedObject
[
self
.
identifier
]
=
obj
.
id
associatedObject
[
self
.
identifier
]
=
obj
.
id
associatedObject
.
save
()
associatedObject
.
save
()
.
success
(
function
()
{
customEventEmitter
.
emit
(
'success'
,
associatedObject
)
})
.
success
(
function
()
{
customEventEmitter
.
emit
(
'success'
,
associatedObject
)
})
.
error
(
function
(
err
)
{
customEventEmitter
.
emit
(
'
failure
'
,
err
)
})
.
error
(
function
(
err
)
{
customEventEmitter
.
emit
(
'
error
'
,
err
)
})
})
})
})
})
return
customEventEmitter
.
run
()
return
customEventEmitter
.
run
()
...
@@ -70,4 +70,4 @@ module.exports = (function() {
...
@@ -70,4 +70,4 @@ module.exports = (function() {
}
}
return
HasOne
return
HasOne
})()
})()
\ No newline at end of file
lib/dao-factory.js
View file @
7cf8e14
...
@@ -68,12 +68,12 @@ module.exports = (function() {
...
@@ -68,12 +68,12 @@ module.exports = (function() {
self
.
QueryInterface
self
.
QueryInterface
.
createTable
(
self
.
tableName
,
self
.
attributes
,
options
)
.
createTable
(
self
.
tableName
,
self
.
attributes
,
options
)
.
success
(
function
()
{
emitter
.
emit
(
'success'
,
self
)
})
.
success
(
function
()
{
emitter
.
emit
(
'success'
,
self
)
})
.
error
(
function
(
err
)
{
emitter
.
emit
(
'
failure
'
,
err
)
})
.
error
(
function
(
err
)
{
emitter
.
emit
(
'
error
'
,
err
)
})
.
on
(
'sql'
,
function
(
sql
)
{
emitter
.
emit
(
'sql'
,
sql
)
})
.
on
(
'sql'
,
function
(
sql
)
{
emitter
.
emit
(
'sql'
,
sql
)
})
}
}
if
(
options
.
force
)
if
(
options
.
force
)
self
.
drop
().
success
(
doQuery
).
error
(
function
(
err
)
{
emitter
.
emit
(
'
failure
'
,
err
)
})
self
.
drop
().
success
(
doQuery
).
error
(
function
(
err
)
{
emitter
.
emit
(
'
error
'
,
err
)
})
else
else
doQuery
()
doQuery
()
...
...
lib/dialects/mysql/connector-manager.js
View file @
7cf8e14
...
@@ -127,7 +127,7 @@ module.exports = (function() {
...
@@ -127,7 +127,7 @@ module.exports = (function() {
var
self
=
this
var
self
=
this
this
.
pool
.
acquire
(
function
(
err
,
client
)
{
this
.
pool
.
acquire
(
function
(
err
,
client
)
{
if
(
err
)
{
if
(
err
)
{
queueItem
.
query
.
emit
(
'
failure
'
,
err
)
queueItem
.
query
.
emit
(
'
error
'
,
err
)
return
return
}
}
//we set the client here, asynchronously, when getting a pooled connection
//we set the client here, asynchronously, when getting a pooled connection
...
...
lib/dialects/mysql/query.js
View file @
7cf8e14
...
@@ -90,7 +90,7 @@ module.exports = (function() {
...
@@ -90,7 +90,7 @@ module.exports = (function() {
var
onFailure
=
function
(
err
)
{
var
onFailure
=
function
(
err
)
{
unbindClient
.
call
(
this
)
unbindClient
.
call
(
this
)
this
.
emit
(
'
failure
'
,
err
,
this
.
callee
)
this
.
emit
(
'
error
'
,
err
,
this
.
callee
)
}
}
return
Query
return
Query
...
...
lib/dialects/postgres/query.js
View file @
7cf8e14
...
@@ -85,7 +85,7 @@ module.exports = (function() {
...
@@ -85,7 +85,7 @@ module.exports = (function() {
query
.
on
(
'error'
,
function
(
err
)
{
query
.
on
(
'error'
,
function
(
err
)
{
receivedError
=
true
receivedError
=
true
self
.
emit
(
'
failure
'
,
err
,
self
.
callee
)
self
.
emit
(
'
error
'
,
err
,
self
.
callee
)
});
});
return
this
return
this
...
...
lib/dialects/query.js
View file @
7cf8e14
...
@@ -16,7 +16,7 @@ module.exports = (function() {
...
@@ -16,7 +16,7 @@ module.exports = (function() {
}
}
Query
.
prototype
.
failure
=
Query
.
prototype
.
fail
=
Query
.
prototype
.
error
=
function
(
fct
)
{
Query
.
prototype
.
failure
=
Query
.
prototype
.
fail
=
Query
.
prototype
.
error
=
function
(
fct
)
{
this
.
on
(
'
failure
'
,
fct
)
this
.
on
(
'
error
'
,
fct
)
return
this
return
this
}
}
...
...
lib/dialects/sqlite/query.js
View file @
7cf8e14
...
@@ -108,7 +108,7 @@ module.exports = (function() {
...
@@ -108,7 +108,7 @@ module.exports = (function() {
}
}
var
onFailure
=
function
(
err
)
{
var
onFailure
=
function
(
err
)
{
this
.
emit
(
'
failure
'
,
err
,
this
.
callee
)
this
.
emit
(
'
error
'
,
err
,
this
.
callee
)
}
}
return
Query
return
Query
...
...
lib/emitters/custom-event-emitter.js
View file @
7cf8e14
...
@@ -29,14 +29,14 @@ module.exports = (function() {
...
@@ -29,14 +29,14 @@ module.exports = (function() {
CustomEventEmitter
.
prototype
.
fail
=
CustomEventEmitter
.
prototype
.
fail
=
CustomEventEmitter
.
prototype
.
error
=
CustomEventEmitter
.
prototype
.
error
=
function
(
fct
)
{
function
(
fct
)
{
this
.
on
(
'
failure
'
,
fct
)
this
.
on
(
'
error
'
,
fct
)
return
this
return
this
}
}
CustomEventEmitter
.
prototype
.
done
=
CustomEventEmitter
.
prototype
.
done
=
CustomEventEmitter
.
prototype
.
complete
=
CustomEventEmitter
.
prototype
.
complete
=
function
(
fct
)
{
function
(
fct
)
{
this
.
on
(
'
failure
'
,
function
(
err
)
{
fct
(
err
,
null
)
})
this
.
on
(
'
error
'
,
function
(
err
)
{
fct
(
err
,
null
)
})
.
on
(
'success'
,
function
(
result
)
{
fct
(
null
,
result
)
})
.
on
(
'success'
,
function
(
result
)
{
fct
(
null
,
result
)
})
return
this
return
this
}
}
...
...
lib/emitters/null-emitter.js
View file @
7cf8e14
...
@@ -11,7 +11,7 @@ module.exports = (function(){
...
@@ -11,7 +11,7 @@ module.exports = (function(){
NullEmitter
.
prototype
.
emitNull
=
function
()
{
NullEmitter
.
prototype
.
emitNull
=
function
()
{
this
.
emit
(
'success'
,
null
)
this
.
emit
(
'success'
,
null
)
this
.
emit
(
'
failure
'
,
null
)
this
.
emit
(
'
error
'
,
null
)
}
}
return
NullEmitter
return
NullEmitter
...
...
lib/migrator.js
View file @
7cf8e14
...
@@ -43,7 +43,7 @@ module.exports = (function() {
...
@@ -43,7 +43,7 @@ module.exports = (function() {
return
new
Utils
.
CustomEventEmitter
(
function
(
emitter
)
{
return
new
Utils
.
CustomEventEmitter
(
function
(
emitter
)
{
self
.
getUndoneMigrations
(
function
(
err
,
migrations
)
{
self
.
getUndoneMigrations
(
function
(
err
,
migrations
)
{
if
(
err
)
{
if
(
err
)
{
emitter
.
emit
(
'
failure
'
,
err
)
emitter
.
emit
(
'
error
'
,
err
)
}
else
{
}
else
{
var
chainer
=
new
Utils
.
QueryChainer
var
chainer
=
new
Utils
.
QueryChainer
,
from
=
migrations
[
0
]
,
from
=
migrations
[
0
]
...
@@ -75,7 +75,7 @@ module.exports = (function() {
...
@@ -75,7 +75,7 @@ module.exports = (function() {
chainer
chainer
.
runSerially
({
skipOnError
:
true
})
.
runSerially
({
skipOnError
:
true
})
.
success
(
function
()
{
emitter
.
emit
(
'success'
,
null
)
})
.
success
(
function
()
{
emitter
.
emit
(
'success'
,
null
)
})
.
error
(
function
(
err
)
{
emitter
.
emit
(
'
failure
'
,
err
)
})
.
error
(
function
(
err
)
{
emitter
.
emit
(
'
error
'
,
err
)
})
}
}
})
})
}).
run
()
}).
run
()
...
@@ -152,7 +152,7 @@ module.exports = (function() {
...
@@ -152,7 +152,7 @@ module.exports = (function() {
SequelizeMeta
SequelizeMeta
.
sync
(
syncOptions
||
{})
.
sync
(
syncOptions
||
{})
.
success
(
function
()
{
emitter
.
emit
(
'success'
,
SequelizeMeta
)
})
.
success
(
function
()
{
emitter
.
emit
(
'success'
,
SequelizeMeta
)
})
.
error
(
function
(
err
)
{
emitter
.
emit
(
'
failure
'
,
err
)
})
.
error
(
function
(
err
)
{
emitter
.
emit
(
'
error
'
,
err
)
})
}
else
{
}
else
{
emitter
.
emit
(
'success'
,
SequelizeMeta
)
emitter
.
emit
(
'success'
,
SequelizeMeta
)
}
}
...
@@ -168,7 +168,7 @@ module.exports = (function() {
...
@@ -168,7 +168,7 @@ module.exports = (function() {
self
.
findOrCreateSequelizeMetaDAO
().
success
(
function
(
SequelizeMeta
)
{
self
.
findOrCreateSequelizeMetaDAO
().
success
(
function
(
SequelizeMeta
)
{
SequelizeMeta
.
find
({
order
:
'id DESC'
}).
success
(
function
(
meta
)
{
SequelizeMeta
.
find
({
order
:
'id DESC'
}).
success
(
function
(
meta
)
{
emitter
.
emit
(
'success'
,
meta
?
meta
:
null
)
emitter
.
emit
(
'success'
,
meta
?
meta
:
null
)
}).
error
(
function
(
err
)
{
emitter
.
emit
(
'
failure
'
,
err
)
})
}).
error
(
function
(
err
)
{
emitter
.
emit
(
'
error
'
,
err
)
})
}).
error
(
function
(
err
)
{
emitter
.
emit
(
err
)
})
}).
error
(
function
(
err
)
{
emitter
.
emit
(
err
)
})
}).
run
()
}).
run
()
}
}
...
@@ -182,7 +182,7 @@ module.exports = (function() {
...
@@ -182,7 +182,7 @@ module.exports = (function() {
emitter
.
emit
(
'success'
,
meta
?
meta
.
to
:
null
)
emitter
.
emit
(
'success'
,
meta
?
meta
.
to
:
null
)
})
})
.
error
(
function
(
err
)
{
.
error
(
function
(
err
)
{
emitter
.
emit
(
'
failure
'
,
err
)
emitter
.
emit
(
'
error
'
,
err
)
})
})
}).
run
()
}).
run
()
}
}
...
...
lib/query-chainer.js
View file @
7cf8e14
...
@@ -116,7 +116,7 @@ module.exports = (function() {
...
@@ -116,7 +116,7 @@ module.exports = (function() {
this
.
finished
=
(
this
.
finishedEmits
==
this
.
serials
.
length
)
this
.
finished
=
(
this
.
finishedEmits
==
this
.
serials
.
length
)
if
(
this
.
finished
&&
this
.
wasRunning
)
{
if
(
this
.
finished
&&
this
.
wasRunning
)
{
var
status
=
(
this
.
fails
.
length
==
0
?
'success'
:
'
failure
'
)
var
status
=
(
this
.
fails
.
length
==
0
?
'success'
:
'
error
'
)
,
result
=
(
this
.
fails
.
length
==
0
?
result
:
this
.
fails
)
,
result
=
(
this
.
fails
.
length
==
0
?
result
:
this
.
fails
)
this
.
eventEmitter
.
emit
(
status
,
result
)
this
.
eventEmitter
.
emit
(
status
,
result
)
...
...
lib/query-interface.js
View file @
7cf8e14
...
@@ -48,11 +48,11 @@ module.exports = (function() {
...
@@ -48,11 +48,11 @@ module.exports = (function() {
})
})
.
error
(
function
(
err
)
{
.
error
(
function
(
err
)
{
self
.
emit
(
'dropAllTables'
,
err
)
self
.
emit
(
'dropAllTables'
,
err
)
emitter
.
emit
(
'
failure
'
,
err
)
emitter
.
emit
(
'
error
'
,
err
)
})
})
}).
error
(
function
(
err
)
{
}).
error
(
function
(
err
)
{
self
.
emit
(
'dropAllTables'
,
err
)
self
.
emit
(
'dropAllTables'
,
err
)
emitter
.
emit
(
'
failure
'
,
err
)
emitter
.
emit
(
'
error
'
,
err
)
})
})
}).
run
()
}).
run
()
}
}
...
@@ -72,7 +72,7 @@ module.exports = (function() {
...
@@ -72,7 +72,7 @@ module.exports = (function() {
emitter
.
emit
(
'success'
,
Utils
.
_
.
flatten
(
tableNames
))
emitter
.
emit
(
'success'
,
Utils
.
_
.
flatten
(
tableNames
))
}).
error
(
function
(
err
)
{
}).
error
(
function
(
err
)
{
self
.
emit
(
'showAllTables'
,
err
)
self
.
emit
(
'showAllTables'
,
err
)
emitter
.
emit
(
'
failure
'
,
err
)
emitter
.
emit
(
'
error
'
,
err
)
})
})
}).
run
()
}).
run
()
}
}
...
@@ -90,7 +90,7 @@ module.exports = (function() {
...
@@ -90,7 +90,7 @@ module.exports = (function() {
self
.
sequelize
.
query
(
sql
,
null
,
{
raw
:
true
}).
success
(
function
(
data
)
{
self
.
sequelize
.
query
(
sql
,
null
,
{
raw
:
true
}).
success
(
function
(
data
)
{
emitter
.
emit
(
'success'
,
data
)
emitter
.
emit
(
'success'
,
data
)
}).
error
(
function
(
err
)
{
}).
error
(
function
(
err
)
{
emitter
.
emit
(
'
failure
'
,
err
)
emitter
.
emit
(
'
error
'
,
err
)
})
})
}).
run
()
}).
run
()
}
}
...
@@ -153,11 +153,11 @@ module.exports = (function() {
...
@@ -153,11 +153,11 @@ module.exports = (function() {
emitter
.
emit
(
'success'
,
null
)
emitter
.
emit
(
'success'
,
null
)
}).
error
(
function
(
err
)
{
}).
error
(
function
(
err
)
{
self
.
emit
(
'renameColumn'
,
err
)
self
.
emit
(
'renameColumn'
,
err
)
emitter
.
emit
(
'
failure
'
,
err
)
emitter
.
emit
(
'
error
'
,
err
)
})
})
}).
error
(
function
(
err
)
{
}).
error
(
function
(
err
)
{
self
.
emit
(
'renameColumn'
,
err
)
self
.
emit
(
'renameColumn'
,
err
)
emitter
.
emit
(
'
failure
'
,
err
)
emitter
.
emit
(
'
error
'
,
err
)
})
})
}).
run
()
}).
run
()
}
}
...
@@ -217,7 +217,7 @@ module.exports = (function() {
...
@@ -217,7 +217,7 @@ module.exports = (function() {
})
})
.
error
(
function
(
err
)
{
.
error
(
function
(
err
)
{
self
.
emit
(
'rawSelect'
,
err
)
self
.
emit
(
'rawSelect'
,
err
)
emitter
.
emit
(
'
failure
'
,
err
)
emitter
.
emit
(
'
error
'
,
err
)
})
})
qry
.
on
(
'sql'
,
function
(
sql
)
{
qry
.
on
(
'sql'
,
function
(
sql
)
{
emitter
.
emit
(
'sql'
,
sql
)
emitter
.
emit
(
'sql'
,
sql
)
...
@@ -253,7 +253,7 @@ module.exports = (function() {
...
@@ -253,7 +253,7 @@ module.exports = (function() {
}).
error
(
function
(
err
)
{
}).
error
(
function
(
err
)
{
options
.
error
&&
options
.
error
(
err
)
options
.
error
&&
options
.
error
(
err
)
self
.
emit
(
methodName
,
err
)
self
.
emit
(
methodName
,
err
)
emitter
.
emit
(
'
failure
'
,
err
)
emitter
.
emit
(
'
error
'
,
err
)
})
})
query
.
on
(
'sql'
,
function
(
sql
)
{
query
.
on
(
'sql'
,
function
(
sql
)
{
emitter
.
emit
(
'sql'
,
sql
)
emitter
.
emit
(
'sql'
,
sql
)
...
...
lib/sequelize.js
View file @
7cf8e14
...
@@ -115,7 +115,7 @@ module.exports = (function() {
...
@@ -115,7 +115,7 @@ module.exports = (function() {
chainer
chainer
.
run
()
.
run
()
.
success
(
function
()
{
emitter
.
emit
(
'success'
,
null
)
})
.
success
(
function
()
{
emitter
.
emit
(
'success'
,
null
)
})
.
error
(
function
(
err
)
{
emitter
.
emit
(
'
failure
'
,
err
)
})
.
error
(
function
(
err
)
{
emitter
.
emit
(
'
error
'
,
err
)
})
}).
run
()
}).
run
()
}
}
...
@@ -130,7 +130,7 @@ module.exports = (function() {
...
@@ -130,7 +130,7 @@ module.exports = (function() {
chainer
chainer
.
run
()
.
run
()
.
success
(
function
()
{
emitter
.
emit
(
'success'
,
null
)
})
.
success
(
function
()
{
emitter
.
emit
(
'success'
,
null
)
})
.
error
(
function
(
err
)
{
emitter
.
emit
(
'
failure
'
,
err
)
})
.
error
(
function
(
err
)
{
emitter
.
emit
(
'
error
'
,
err
)
})
}).
run
()
}).
run
()
}
}
...
...
spec-jasmine/config/factories.js
View file @
7cf8e14
...
@@ -16,7 +16,7 @@ Factories.prototype.DAO = function(daoName, options, callback, count) {
...
@@ -16,7 +16,7 @@ Factories.prototype.DAO = function(daoName, options, callback, count) {
DAO
.
create
(
options
).
on
(
'success'
,
function
(
dao
)
{
DAO
.
create
(
options
).
on
(
'success'
,
function
(
dao
)
{
daos
.
push
(
dao
)
daos
.
push
(
dao
)
cb
&&
cb
()
cb
&&
cb
()
}).
on
(
'
failure
'
,
function
(
err
)
{
}).
on
(
'
error
'
,
function
(
err
)
{
console
.
log
(
err
)
console
.
log
(
err
)
done
()
done
()
})
})
...
...
spec-jasmine/config/helpers.js
View file @
7cf8e14
...
@@ -21,7 +21,7 @@ Helpers.prototype.drop = function() {
...
@@ -21,7 +21,7 @@ Helpers.prototype.drop = function() {
self
.
sequelize
self
.
sequelize
.
drop
()
.
drop
()
.
on
(
'success'
,
done
)
.
on
(
'success'
,
done
)
.
on
(
'
failure
'
,
function
(
err
)
{
console
.
log
(
err
)
})
.
on
(
'
error
'
,
function
(
err
)
{
console
.
log
(
err
)
})
})
})
}
}
...
...
spec-jasmine/sqlite/dao-factory.spec.js
View file @
7cf8e14
...
@@ -161,7 +161,7 @@ describe('DAOFactory', function() {
...
@@ -161,7 +161,7 @@ describe('DAOFactory', function() {
User
.
all
().
on
(
'success'
,
function
(
users
)
{
User
.
all
().
on
(
'success'
,
function
(
users
)
{
done
()
done
()
expect
(
users
.
length
).
toEqual
(
2
)
expect
(
users
.
length
).
toEqual
(
2
)
}).
on
(
'
failure
'
,
function
(
err
)
{
console
.
log
(
err
)
})
}).
on
(
'
error
'
,
function
(
err
)
{
console
.
log
(
err
)
})
})
})
})
})
})
})
...
...
spec/config/factories.js
View file @
7cf8e14
...
@@ -16,7 +16,7 @@ Factories.prototype.DAO = function(daoName, options, callback, count) {
...
@@ -16,7 +16,7 @@ Factories.prototype.DAO = function(daoName, options, callback, count) {
DAO
.
create
(
options
).
on
(
'success'
,
function
(
dao
)
{
DAO
.
create
(
options
).
on
(
'success'
,
function
(
dao
)
{
daos
.
push
(
dao
)
daos
.
push
(
dao
)
cb
&&
cb
()
cb
&&
cb
()
}).
on
(
'
failure
'
,
function
(
err
)
{
}).
on
(
'
error
'
,
function
(
err
)
{
console
.
log
(
err
)
console
.
log
(
err
)
done
()
done
()
})
})
...
...
spec/config/helpers.js
View file @
7cf8e14
...
@@ -21,7 +21,7 @@ Helpers.prototype.drop = function() {
...
@@ -21,7 +21,7 @@ Helpers.prototype.drop = function() {
self
.
sequelize
self
.
sequelize
.
drop
()
.
drop
()
.
on
(
'success'
,
done
)
.
on
(
'success'
,
done
)
.
on
(
'
failure
'
,
function
(
err
)
{
console
.
log
(
err
)
})
.
on
(
'
error
'
,
function
(
err
)
{
console
.
log
(
err
)
})
})
})
}
}
...
...
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