Skip to content

Commit

Permalink
Set transaction mode
Browse files Browse the repository at this point in the history
Added possibility to set transaction mode and isolation level
  • Loading branch information
artur-krueger authored and lalitkapoor committed Jan 6, 2014
1 parent 9037ed9 commit 2fd7548
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/index.js
@@ -1,4 +1,3 @@

/**
* Module dependencies
*/
Expand Down Expand Up @@ -36,10 +35,17 @@ Transaction.prototype.query = function(){

/**
* Start a transaction block
* @param {String} transaction mode [optional] mode of transaction
* @param {Function} callback
*/
Transaction.prototype.begin = function(callback){
this.query('BEGIN', callback);
Transaction.prototype.begin = function(mode,callback){
if(typeof(mode) === 'function'){
callback=mode;
mode=null;
}
var begin="BEGIN";
if (mode) { begin+=" "+mode; }
this.query(begin, callback);
};

/**
Expand Down

0 comments on commit 2fd7548

Please sign in to comment.