lib/connection/result/row_stream.js
function init()
  {
    // the stream has now been initialized
    initialized = true;

    // if we have a result
    if (context.result)
    {
      // if no value was specified for the start index or if the specified start
      // index is negative, default to 0, otherwise truncate the fractional part
      start = (!Util.isNumber(start) || (start < 0)) ? 0 : Math.floor(start);

      // if no value was specified for the end index or if the end index is
      // larger than the row index of the last row, default to the index of the
      // last row, otherwise truncate the fractional part
      var returnedRows = context.result.getReturnedRows();
      end = (!Util.isNumber(end) || (end >= returnedRows)) ? returnedRows - 1 :
          Math.floor(end);

      // find all the chunks that overlap with the specified range
      var overlappingChunks = context.result.findOverlappingChunks(start, end);

      // if no chunks overlap or start is greater than end, we're done
      if ((overlappingChunks.length === 0) || (start > end))
      {
        process.nextTick(close);
      }
      else
      {
        // create a result stream from the overlapping chunks
        resultStream = new ResultStream(
        {
          chunks       : overlappingChunks,
          prefetchSize : context.connectionConfig.getResultPrefetch()
        });

        readNextRow();
      }
    }
    else
    {
      close(context.resultError);
    }
  }
function init()
  {
    // the stream has now been initialized
    initialized = true;

    // if we have a result
    if (context.result)
    {
      // if no value was specified for the start index or if the specified start
      // index is negative, default to 0, otherwise truncate the fractional part
      start = (!Util.isNumber(start) || (start < 0)) ? 0 : Math.floor(start);

      // if no value was specified for the end index or if the end index is
      // larger than the row index of the last row, default to the index of the
      // last row, otherwise truncate the fractional part
      var returnedRows = context.result.getReturnedRows();
      end = (!Util.isNumber(end) || (end >= returnedRows)) ? returnedRows - 1 :
          Math.floor(end);

      // find all the chunks that overlap with the specified range
      var overlappingChunks = context.result.findOverlappingChunks(start, end);

      // if no chunks overlap or start is greater than end, we're done
      if ((overlappingChunks.length === 0) || (start > end))
      {
        process.nextTick(close);
      }
      else
      {
        // create a result stream from the overlapping chunks
        resultStream = new ResultStream(
        {
          chunks       : overlappingChunks,
          prefetchSize : context.connectionConfig.getResultPrefetch()
        });

        readNextRow();
      }
    }
    else
    {
      close(context.resultError);
    }
  }
function init ( ) { // the stream has now been initialized initialized = true ; // if we have a result if ( context . result ) { // if no value was specified for the start index or if the specified start // index is negative, default to 0, otherwise truncate the fractional part start = ( ! Util . isNumber ( start ) || ( start < 0 ) ) ? 0 : Math . floor ( start ) ; // if no value was specified for the end index or if the end index is // larger than the row index of the last row, default to the index of the // last row, otherwise truncate the fractional part var returnedRows = context . result . getReturnedRows ( ) ; end = ( ! Util . isNumber ( end ) || ( end >= returnedRows ) ) ? returnedRows - 1 : Math . floor ( end ) ; // find all the chunks that overlap with the specified range var overlappingChunks = context . result . findOverlappingChunks ( start , end ) ; // if no chunks overlap or start is greater than end, we're done if ( ( overlappingChunks . length === 0 ) || ( start > end ) ) { process . nextTick ( close ) ; } else { // create a result stream from the overlapping chunks resultStream = new ResultStream ( { chunks : overlappingChunks , prefetchSize : context . connectionConfig . getResultPrefetch ( ) } ) ; readNextRow ( ) ; } } else { close ( context . resultError ) ; } }
Initializes this stream.
Initializes this stream .