lib/chain.js
function chainQueryRun (safeCon, arg, currentObj) {
  
  objAdder(safeCon, currentObj);
  
  var stream;
  try {
    stream = safeCon.query.apply(safeCon, arg);
  } catch(e) {
    return currentObj.rollback(e);
  }
  
  autoErrorRollback(currentObj);
  onewayEventConnect(stream, currentObj);
  
  if (currentObj._autoCommit) {
    autoCommitReady(safeCon, currentObj);
  }
  
  stream.on('error', function(e){
    safeCon._errorState = true;
  });
  
  currentObj.on('end', function(){
    safeCon._count -= 1;
  });
  
  safeCon._count += 1;
  currentObj.stream = stream;
  currentObj.emit('nextChain', safeCon);
}
function chainQueryRun (safeCon, arg, currentObj) {
  
  objAdder(safeCon, currentObj);
  
  var stream;
  try {
    stream = safeCon.query.apply(safeCon, arg);
  } catch(e) {
    return currentObj.rollback(e);
  }
  
  autoErrorRollback(currentObj);
  onewayEventConnect(stream, currentObj);
  
  if (currentObj._autoCommit) {
    autoCommitReady(safeCon, currentObj);
  }
  
  stream.on('error', function(e){
    safeCon._errorState = true;
  });
  
  currentObj.on('end', function(){
    safeCon._count -= 1;
  });
  
  safeCon._count += 1;
  currentObj.stream = stream;
  currentObj.emit('nextChain', safeCon);
}
function chainQueryRun ( safeCon , arg , currentObj ) { objAdder ( safeCon , currentObj ) ; var stream ; try { stream = safeCon . query . apply ( safeCon , arg ) ; } catch ( e ) { return currentObj . rollback ( e ) ; } autoErrorRollback ( currentObj ) ; onewayEventConnect ( stream , currentObj ) ; if ( currentObj . _autoCommit ) { autoCommitReady ( safeCon , currentObj ) ; } stream . on ( 'error' , function ( e ) { safeCon . _errorState = true ; } ) ; currentObj . on ( 'end' , function ( ) { safeCon . _count -= 1 ; } ) ; safeCon . _count += 1 ; currentObj . stream = stream ; currentObj . emit ( 'nextChain' , safeCon ) ; }
main procedure function
main procedure function