final ResultSetRow nextRow(Field[] fields,int columnCount,boolean isBinaryEncoded,int resultSetConcurrency,boolean useBufferRowIfPossible,boolean useBufferRowExplicit,boolean canReuseRowPacketForBufferRow,Buffer existingRowPacket) throws SQLException {
  if (this.useDirectRowUnpack && existingRowPacket == null && !isBinaryEncoded && !useBufferRowIfPossible && !useBufferRowExplicit) {
    return nextRowFast(fields,columnCount,isBinaryEncoded,resultSetConcurrency,useBufferRowIfPossible,useBufferRowExplicit,canReuseRowPacketForBufferRow);
  }
  Buffer rowPacket=null;
  if (existingRowPacket == null) {
    rowPacket=checkErrorPacket();
    if (!useBufferRowExplicit && useBufferRowIfPossible) {
      if (rowPacket.getBufLength() > this.useBufferRowSizeThreshold) {
        useBufferRowExplicit=true;
      }
    }
  }
 else {
    rowPacket=existingRowPacket;
    checkErrorPacket(existingRowPacket);
  }
  if (!isBinaryEncoded) {
    rowPacket.setPosition(rowPacket.getPosition() - 1);
    if (!(!isEOFDeprecated() && rowPacket.isEOFPacket() || isEOFDeprecated() && rowPacket.isResultSetOKPacket())) {
      if (resultSetConcurrency == ResultSet.CONCUR_UPDATABLE || (!useBufferRowIfPossible && !useBufferRowExplicit)) {
        byte[][] rowData=new byte[columnCount][];
        for (int i=0; i < columnCount; i++) {
          rowData[i]=rowPacket.readLenByteArray(0);
        }
        return new ByteArrayRow(rowData,getExceptionInterceptor());
      }
      if (!canReuseRowPacketForBufferRow) {
        this.reusablePacket=new Buffer(rowPacket.getBufLength());
      }
      return new BufferRow(rowPacket,fields,false,getExceptionInterceptor());
    }
    readServerStatusForResultSets(rowPacket);
    return null;
  }
  if (!(!isEOFDeprecated() && rowPacket.isEOFPacket() || isEOFDeprecated() && rowPacket.isResultSetOKPacket())) {
    if (resultSetConcurrency == ResultSet.CONCUR_UPDATABLE || (!useBufferRowIfPossible && !useBufferRowExplicit)) {
      return unpackBinaryResultSetRow(fields,rowPacket,resultSetConcurrency);
    }
    if (!canReuseRowPacketForBufferRow) {
      this.reusablePacket=new Buffer(rowPacket.getBufLength());
    }
    return new BufferRow(rowPacket,fields,true,getExceptionInterceptor());
  }
  rowPacket.setPosition(rowPacket.getPosition() - 1);
  readServerStatusForResultSets(rowPacket);
  return null;
}

final ResultSetRow nextRow ( Field [ ] fields , int columnCount , boolean isBinaryEncoded , int resultSetConcurrency , boolean useBufferRowIfPossible , boolean useBufferRowExplicit , boolean canReuseRowPacketForBufferRow , Buffer existingRowPacket ) throws SQLException { if ( this . useDirectRowUnpack && existingRowPacket == null && ! isBinaryEncoded && ! useBufferRowIfPossible && ! useBufferRowExplicit ) { return nextRowFast ( fields , columnCount , isBinaryEncoded , resultSetConcurrency , useBufferRowIfPossible , useBufferRowExplicit , canReuseRowPacketForBufferRow ) ; } Buffer rowPacket = null ; if ( existingRowPacket == null ) { rowPacket = checkErrorPacket ( ) ; if ( ! useBufferRowExplicit && useBufferRowIfPossible ) { if ( rowPacket . getBufLength ( ) > this . useBufferRowSizeThreshold ) { useBufferRowExplicit = true ; } } } else { rowPacket = existingRowPacket ; checkErrorPacket ( existingRowPacket ) ; } if ( ! isBinaryEncoded ) { rowPacket . setPosition ( rowPacket . getPosition ( ) - 1 ) ; if ( ! ( ! isEOFDeprecated ( ) && rowPacket . isEOFPacket ( ) || isEOFDeprecated ( ) && rowPacket . isResultSetOKPacket ( ) ) ) { if ( resultSetConcurrency == ResultSet . CONCUR_UPDATABLE || ( ! useBufferRowIfPossible && ! useBufferRowExplicit ) ) { byte [ ] [ ] rowData = new byte [ columnCount ] [ ] ; for ( int i = 0 ; i < columnCount ; i ++ ) { rowData [ i ] = rowPacket . readLenByteArray ( 0 ) ; } return new ByteArrayRow ( rowData , getExceptionInterceptor ( ) ) ; } if ( ! canReuseRowPacketForBufferRow ) { this . reusablePacket = new Buffer ( rowPacket . getBufLength ( ) ) ; } return new BufferRow ( rowPacket , fields , false , getExceptionInterceptor ( ) ) ; } readServerStatusForResultSets ( rowPacket ) ; return null ; } if ( ! ( ! isEOFDeprecated ( ) && rowPacket . isEOFPacket ( ) || isEOFDeprecated ( ) && rowPacket . isResultSetOKPacket ( ) ) ) { if ( resultSetConcurrency == ResultSet . CONCUR_UPDATABLE || ( ! useBufferRowIfPossible && ! useBufferRowExplicit ) ) { return unpackBinaryResultSetRow ( fields , rowPacket , resultSetConcurrency ) ; } if ( ! canReuseRowPacketForBufferRow ) { this . reusablePacket = new Buffer ( rowPacket . getBufLength ( ) ) ; } return new BufferRow ( rowPacket , fields , true , getExceptionInterceptor ( ) ) ; } rowPacket . setPosition ( rowPacket . getPosition ( ) - 1 ) ; readServerStatusForResultSets ( rowPacket ) ; return null ; }
retrieve one row from the mysql server . note : this method is not thread - safe , but it is only called from methods that are guarded by synchronizing on this object .
