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 20563ff0
authored
Nov 15, 2013
by
Sascha Depold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
transaction support for update
1 parent
e9dc214a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletions
lib/query-interface.js
test/dao-factory.test.js
lib/query-interface.js
View file @
20563ff
...
@@ -502,7 +502,7 @@ module.exports = (function() {
...
@@ -502,7 +502,7 @@ module.exports = (function() {
return
new
Utils
.
CustomEventEmitter
(
function
(
emitter
)
{
return
new
Utils
.
CustomEventEmitter
(
function
(
emitter
)
{
var
chainer
=
new
Utils
.
QueryChainer
()
var
chainer
=
new
Utils
.
QueryChainer
()
chainer
.
add
(
self
,
'queryAndEmit'
,
[
sql
,
'bulkUpdate'
])
chainer
.
add
(
self
,
'queryAndEmit'
,
[
[
sql
,
null
,
options
]
,
'bulkUpdate'
])
return
chainer
.
runSerially
()
return
chainer
.
runSerially
()
.
success
(
function
(
results
){
.
success
(
function
(
results
){
...
...
test/dao-factory.test.js
View file @
20563ff
...
@@ -1254,6 +1254,28 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -1254,6 +1254,28 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
})
})
describe
(
'update'
,
function
()
{
describe
(
'update'
,
function
()
{
it
(
'supports transactions'
,
function
(
done
)
{
Support
.
prepareTransactionTest
(
dialect
,
this
.
sequelize
,
function
(
sequelize
)
{
var
User
=
sequelize
.
define
(
'User'
,
{
username
:
Sequelize
.
STRING
})
User
.
sync
({
force
:
true
}).
success
(
function
()
{
User
.
create
({
username
:
'foo'
}).
success
(
function
()
{
sequelize
.
transaction
(
function
(
t
)
{
User
.
update
({
username
:
'bar'
},
{},
{
transaction
:
t
}).
success
(
function
()
{
User
.
all
().
success
(
function
(
users1
)
{
User
.
all
({
transaction
:
t
}).
success
(
function
(
users2
)
{
expect
(
users1
[
0
].
username
).
to
.
equal
(
'foo'
)
expect
(
users2
[
0
].
username
).
to
.
equal
(
'bar'
)
t
.
rollback
().
success
(
done
)
})
})
})
})
})
})
})
})
it
(
'updates the attributes that we select only without updating createdAt'
,
function
(
done
)
{
it
(
'updates the attributes that we select only without updating createdAt'
,
function
(
done
)
{
var
User
=
this
.
sequelize
.
define
(
'User1'
,
{
var
User
=
this
.
sequelize
.
define
(
'User1'
,
{
username
:
Sequelize
.
STRING
,
username
:
Sequelize
.
STRING
,
...
...
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