lib/connection/statement.js
function invokeStatementComplete(statement, context)
{
  // find out if the result will be streamed;
  // if a value is not specified, get it from the connection
  var streamResult = context.streamResult;
  if (!Util.exists(streamResult))
  {
    streamResult = context.connectionConfig.getStreamResult();
  }

  // if the result will be streamed later,
  // invoke the complete callback right away
  if (streamResult)
  {
    context.complete(Errors.externalize(context.resultError), statement);
  }
  else
  {
    process.nextTick(function()
    {
      // aggregate all the rows into an array and pass this
      // array to the complete callback as the last argument
      var rows = [];
      statement.streamRows()
          .on('data', function(row)
          {
            rows.push(row);
          })
          .on('end', function()
          {
            context.complete(null, statement, rows);
          })
          .on('error', function(err)
          {
            context.complete(Errors.externalize(err), statement);
          });
    });
  }
}
function invokeStatementComplete(statement, context)
{
  // find out if the result will be streamed;
  // if a value is not specified, get it from the connection
  var streamResult = context.streamResult;
  if (!Util.exists(streamResult))
  {
    streamResult = context.connectionConfig.getStreamResult();
  }

  // if the result will be streamed later,
  // invoke the complete callback right away
  if (streamResult)
  {
    context.complete(Errors.externalize(context.resultError), statement);
  }
  else
  {
    process.nextTick(function()
    {
      // aggregate all the rows into an array and pass this
      // array to the complete callback as the last argument
      var rows = [];
      statement.streamRows()
          .on('data', function(row)
          {
            rows.push(row);
          })
          .on('end', function()
          {
            context.complete(null, statement, rows);
          })
          .on('error', function(err)
          {
            context.complete(Errors.externalize(err), statement);
          });
    });
  }
}
function invokeStatementComplete ( statement , context ) { // find out if the result will be streamed; // if a value is not specified, get it from the connection var streamResult = context . streamResult ; if ( ! Util . exists ( streamResult ) ) { streamResult = context . connectionConfig . getStreamResult ( ) ; } // if the result will be streamed later, // invoke the complete callback right away if ( streamResult ) { context . complete ( Errors . externalize ( context . resultError ) , statement ) ; } else { process . nextTick ( function ( ) { // aggregate all the rows into an array and pass this // array to the complete callback as the last argument var rows = [ ] ; statement . streamRows ( ) . on ( 'data' , function ( row ) { rows . push ( row ) ; } ) . on ( 'end' , function ( ) { context . complete ( null , statement , rows ) ; } ) . on ( 'error' , function ( err ) { context . complete ( Errors . externalize ( err ) , statement ) ; } ) ; } ) ; } }
Invokes the statement complete callback.

@param {Object} statement
@param {Object} context
Invokes the statement complete callback .