@@ -306,7 +306,7 @@ SqlStore._getSearchBlock = function(filter) {
306
306
SqlStore . prototype . _dealWithTransaction = function ( done , callback ) {
307
307
var self = this ;
308
308
var transactionOptions = {
309
- isolationLevel : Sequelize . Transaction . ISOLATION_LEVELS . READ_UNCOMMITTED ,
309
+ isolationLevel : Sequelize . Transaction . ISOLATION_LEVELS . READ_COMMITTED ,
310
310
autocommit : false
311
311
} ;
312
312
self . sequelize . transaction ( transactionOptions ) . asCallback ( function ( err1 , transaction ) {
@@ -495,29 +495,31 @@ SqlStore.prototype.create = function(request, newResource, finishedCallback) {
495
495
/**
496
496
Delete a resource, given a resource type and and id.
497
497
*/
498
- SqlStore . prototype . delete = function ( request , callback ) {
498
+ SqlStore . prototype . delete = function ( request , finishedCallback ) {
499
499
var self = this ;
500
500
501
- self . baseModel . findAll ( {
502
- where : { id : request . params . id } ,
503
- include : self . relationArray
504
- } ) . asCallback ( function ( findErr , results ) {
505
- if ( findErr ) return self . _errorHandler ( findErr , callback ) ;
501
+ self . _dealWithTransaction ( finishedCallback , function ( t , finishTransaction ) {
502
+ self . baseModel . findAll ( {
503
+ where : { id : request . params . id } ,
504
+ include : self . relationArray
505
+ } ) . asCallback ( function ( findErr , results ) {
506
+ if ( findErr ) return finishTransaction ( findErr ) ;
506
507
507
- var theResource = results [ 0 ] ;
508
+ var theResource = results [ 0 ] ;
508
509
509
- // If the resource doesn't exist, error
510
- if ( ! theResource ) {
511
- return callback ( {
512
- status : "404" ,
513
- code : "ENOTFOUND" ,
514
- title : "Requested resource does not exist" ,
515
- detail : "There is no " + request . params . type + " with id " + request . params . id
516
- } ) ;
517
- }
510
+ // If the resource doesn't exist, error
511
+ if ( ! theResource ) {
512
+ return finishTransaction ( {
513
+ status : "404" ,
514
+ code : "ENOTFOUND" ,
515
+ title : "Requested resource does not exist" ,
516
+ detail : "There is no " + request . params . type + " with id " + request . params . id
517
+ } ) ;
518
+ }
518
519
519
- theResource . destroy ( ) . asCallback ( function ( deleteErr ) {
520
- return callback ( deleteErr ) ;
520
+ theResource . destroy ( t ) . asCallback ( function ( deleteErr ) {
521
+ return finishTransaction ( deleteErr ) ;
522
+ } ) ;
521
523
} ) ;
522
524
} ) ;
523
525
} ;
0 commit comments