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 7dd01aa0
authored
Jan 08, 2014
by
Sascha Gehlich
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bugfix/find-transaction-option' into feature/create-relation-objects
2 parents
c53c2f2e
b859ca44
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
3 deletions
lib/associations/belongs-to.js
lib/dao-factory.js
test/dao-factory.test.js
lib/associations/belongs-to.js
View file @
7dd01aa
...
@@ -58,7 +58,6 @@ module.exports = (function() {
...
@@ -58,7 +58,6 @@ module.exports = (function() {
obj
[
this
.
accessors
.
get
]
=
function
(
params
)
{
obj
[
this
.
accessors
.
get
]
=
function
(
params
)
{
var
id
=
this
[
self
.
identifier
]
var
id
=
this
[
self
.
identifier
]
,
where
=
{}
,
where
=
{}
,
options
=
Utils
.
_
.
pick
(
params
||
{},
'transaction'
)
where
[
primaryKey
]
=
id
where
[
primaryKey
]
=
id
...
@@ -72,7 +71,7 @@ module.exports = (function() {
...
@@ -72,7 +71,7 @@ module.exports = (function() {
params
=
id
params
=
id
}
}
return
self
.
target
.
find
(
params
,
options
)
return
self
.
target
.
find
(
params
)
}
}
return
this
return
this
...
...
lib/dao-factory.js
View file @
7dd01aa
...
@@ -536,7 +536,7 @@ module.exports = (function() {
...
@@ -536,7 +536,7 @@ module.exports = (function() {
plain
:
true
,
plain
:
true
,
type
:
'SELECT'
,
type
:
'SELECT'
,
hasJoin
:
hasJoin
hasJoin
:
hasJoin
},
queryOptions
))
},
queryOptions
,
{
transaction
:
(
options
||
{}).
transaction
}
))
}
}
DAOFactory
.
prototype
.
aggregate
=
function
(
field
,
aggregateFunction
,
options
)
{
DAOFactory
.
prototype
.
aggregate
=
function
(
field
,
aggregateFunction
,
options
)
{
...
...
test/dao-factory.test.js
View file @
7dd01aa
...
@@ -466,6 +466,25 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -466,6 +466,25 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
})
})
})
})
describe
(
'find'
,
function
()
{
it
(
'supports the transaction option in the first parameter'
,
function
(
done
)
{
Support
.
prepareTransactionTest
(
this
.
sequelize
,
function
(
sequelize
)
{
var
User
=
sequelize
.
define
(
'User'
,
{
username
:
Sequelize
.
STRING
,
foo
:
Sequelize
.
STRING
})
User
.
sync
({
force
:
true
}).
success
(
function
()
{
sequelize
.
transaction
(
function
(
t
)
{
User
.
create
({
username
:
'foo'
},
{
transaction
:
t
}).
success
(
function
()
{
User
.
find
({
where
:
{
username
:
'foo'
},
transaction
:
t
}).
success
(
function
(
user
)
{
expect
(
user
).
to
.
not
.
be
.
null
t
.
rollback
().
success
(
function
()
{
done
()
})
})
})
})
})
})
})
})
describe
(
'findOrInitialize'
,
function
()
{
describe
(
'findOrInitialize'
,
function
()
{
it
(
'supports transactions'
,
function
(
done
)
{
it
(
'supports transactions'
,
function
(
done
)
{
Support
.
prepareTransactionTest
(
this
.
sequelize
,
function
(
sequelize
)
{
Support
.
prepareTransactionTest
(
this
.
sequelize
,
function
(
sequelize
)
{
...
...
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