protected final Field unpackField(Buffer packet,boolean extractDefaultValues) throws SQLException {
  if (this.use41Extensions) {
    if (this.has41NewNewProt) {
      int catalogNameStart=packet.getPosition() + 1;
      int catalogNameLength=packet.fastSkipLenString();
      catalogNameStart=adjustStartForFieldLength(catalogNameStart,catalogNameLength);
    }
    int databaseNameStart=packet.getPosition() + 1;
    int databaseNameLength=packet.fastSkipLenString();
    databaseNameStart=adjustStartForFieldLength(databaseNameStart,databaseNameLength);
    int tableNameStart=packet.getPosition() + 1;
    int tableNameLength=packet.fastSkipLenString();
    tableNameStart=adjustStartForFieldLength(tableNameStart,tableNameLength);
    int originalTableNameStart=packet.getPosition() + 1;
    int originalTableNameLength=packet.fastSkipLenString();
    originalTableNameStart=adjustStartForFieldLength(originalTableNameStart,originalTableNameLength);
    int nameStart=packet.getPosition() + 1;
    int nameLength=packet.fastSkipLenString();
    nameStart=adjustStartForFieldLength(nameStart,nameLength);
    int originalColumnNameStart=packet.getPosition() + 1;
    int originalColumnNameLength=packet.fastSkipLenString();
    originalColumnNameStart=adjustStartForFieldLength(originalColumnNameStart,originalColumnNameLength);
    packet.readByte();
    short charSetNumber=(short)packet.readInt();
    long colLength=0;
    if (this.has41NewNewProt) {
      colLength=packet.readLong();
    }
 else {
      colLength=packet.readLongInt();
    }
    int colType=packet.readByte() & 0xff;
    short colFlag=0;
    if (this.hasLongColumnInfo) {
      colFlag=(short)packet.readInt();
    }
 else {
      colFlag=(short)(packet.readByte() & 0xff);
    }
    int colDecimals=packet.readByte() & 0xff;
    int defaultValueStart=-1;
    int defaultValueLength=-1;
    if (extractDefaultValues) {
      defaultValueStart=packet.getPosition() + 1;
      defaultValueLength=packet.fastSkipLenString();
    }
    Field field=new Field(this.connection,packet.getByteBuffer(),databaseNameStart,databaseNameLength,tableNameStart,tableNameLength,originalTableNameStart,originalTableNameLength,nameStart,nameLength,originalColumnNameStart,originalColumnNameLength,colLength,colType,colFlag,colDecimals,defaultValueStart,defaultValueLength,charSetNumber);
    return field;
  }
  int tableNameStart=packet.getPosition() + 1;
  int tableNameLength=packet.fastSkipLenString();
  tableNameStart=adjustStartForFieldLength(tableNameStart,tableNameLength);
  int nameStart=packet.getPosition() + 1;
  int nameLength=packet.fastSkipLenString();
  nameStart=adjustStartForFieldLength(nameStart,nameLength);
  int colLength=packet.readnBytes();
  int colType=packet.readnBytes();
  packet.readByte();
  short colFlag=0;
  if (this.hasLongColumnInfo) {
    colFlag=(short)(packet.readInt());
  }
 else {
    colFlag=(short)(packet.readByte() & 0xff);
  }
  int colDecimals=(packet.readByte() & 0xff);
  if (this.colDecimalNeedsBump) {
    colDecimals++;
  }
  Field field=new Field(this.connection,packet.getByteBuffer(),nameStart,nameLength,tableNameStart,tableNameLength,colLength,colType,colFlag,colDecimals);
  return field;
}

protected final Field unpackField ( Buffer packet , boolean extractDefaultValues ) throws SQLException { if ( this . use41Extensions ) { if ( this . has41NewNewProt ) { int catalogNameStart = packet . getPosition ( ) + 1 ; int catalogNameLength = packet . fastSkipLenString ( ) ; catalogNameStart = adjustStartForFieldLength ( catalogNameStart , catalogNameLength ) ; } int databaseNameStart = packet . getPosition ( ) + 1 ; int databaseNameLength = packet . fastSkipLenString ( ) ; databaseNameStart = adjustStartForFieldLength ( databaseNameStart , databaseNameLength ) ; int tableNameStart = packet . getPosition ( ) + 1 ; int tableNameLength = packet . fastSkipLenString ( ) ; tableNameStart = adjustStartForFieldLength ( tableNameStart , tableNameLength ) ; int originalTableNameStart = packet . getPosition ( ) + 1 ; int originalTableNameLength = packet . fastSkipLenString ( ) ; originalTableNameStart = adjustStartForFieldLength ( originalTableNameStart , originalTableNameLength ) ; int nameStart = packet . getPosition ( ) + 1 ; int nameLength = packet . fastSkipLenString ( ) ; nameStart = adjustStartForFieldLength ( nameStart , nameLength ) ; int originalColumnNameStart = packet . getPosition ( ) + 1 ; int originalColumnNameLength = packet . fastSkipLenString ( ) ; originalColumnNameStart = adjustStartForFieldLength ( originalColumnNameStart , originalColumnNameLength ) ; packet . readByte ( ) ; short charSetNumber = ( short ) packet . readInt ( ) ; long colLength = 0 ; if ( this . has41NewNewProt ) { colLength = packet . readLong ( ) ; } else { colLength = packet . readLongInt ( ) ; } int colType = packet . readByte ( ) & 0xff ; short colFlag = 0 ; if ( this . hasLongColumnInfo ) { colFlag = ( short ) packet . readInt ( ) ; } else { colFlag = ( short ) ( packet . readByte ( ) & 0xff ) ; } int colDecimals = packet . readByte ( ) & 0xff ; int defaultValueStart = - 1 ; int defaultValueLength = - 1 ; if ( extractDefaultValues ) { defaultValueStart = packet . getPosition ( ) + 1 ; defaultValueLength = packet . fastSkipLenString ( ) ; } Field field = new Field ( this . connection , packet . getByteBuffer ( ) , databaseNameStart , databaseNameLength , tableNameStart , tableNameLength , originalTableNameStart , originalTableNameLength , nameStart , nameLength , originalColumnNameStart , originalColumnNameLength , colLength , colType , colFlag , colDecimals , defaultValueStart , defaultValueLength , charSetNumber ) ; return field ; } int tableNameStart = packet . getPosition ( ) + 1 ; int tableNameLength = packet . fastSkipLenString ( ) ; tableNameStart = adjustStartForFieldLength ( tableNameStart , tableNameLength ) ; int nameStart = packet . getPosition ( ) + 1 ; int nameLength = packet . fastSkipLenString ( ) ; nameStart = adjustStartForFieldLength ( nameStart , nameLength ) ; int colLength = packet . readnBytes ( ) ; int colType = packet . readnBytes ( ) ; packet . readByte ( ) ; short colFlag = 0 ; if ( this . hasLongColumnInfo ) { colFlag = ( short ) ( packet . readInt ( ) ) ; } else { colFlag = ( short ) ( packet . readByte ( ) & 0xff ) ; } int colDecimals = ( packet . readByte ( ) & 0xff ) ; if ( this . colDecimalNeedsBump ) { colDecimals ++ ; } Field field = new Field ( this . connection , packet . getByteBuffer ( ) , nameStart , nameLength , tableNameStart , tableNameLength , colLength , colType , colFlag , colDecimals ) ; return field ; }
unpacks the field information from the given packet . understands pre 4 . 1 and post 4 . 1 server version field packet structures .
