private final void decodeFields ( LogBuffer buffer , final int len ) { final int limit = buffer . limit ( ) ; buffer . limit ( len + buffer . position ( ) ) ; for ( int i = 0 ; i < columnCnt ; i ++ ) { ColumnInfo info = columnInfo [ i ] ; switch ( info . type ) { case MYSQL_TYPE_TINY_BLOB : case MYSQL_TYPE_BLOB : case MYSQL_TYPE_MEDIUM_BLOB : case MYSQL_TYPE_LONG_BLOB : case MYSQL_TYPE_DOUBLE : case MYSQL_TYPE_FLOAT : case MYSQL_TYPE_GEOMETRY : case MYSQL_TYPE_JSON : /* * These types store a single byte. */ info . meta = buffer . getUint8 ( ) ; break ; case MYSQL_TYPE_SET : case MYSQL_TYPE_ENUM : /* * log_event.h : MYSQL_TYPE_SET & MYSQL_TYPE_ENUM : This * enumeration value is only used internally and cannot * exist in a binlog. */ logger . warn ( "This enumeration value is only used internally " + "and cannot exist in a binlog: type=" + info . type ) ; break ; case MYSQL_TYPE_STRING : { /* * log_event.h : The first byte is always * MYSQL_TYPE_VAR_STRING (i.e., 253). The second byte is the * field size, i.e., the number of bytes in the * representation of size of the string: 3 or 4. */ int x = ( buffer . getUint8 ( ) << 8 ) ; // real_type x += buffer . getUint8 ( ) ; // pack or field length info . meta = x ; break ; } case MYSQL_TYPE_BIT : info . meta = buffer . getUint16 ( ) ; break ; case MYSQL_TYPE_VARCHAR : /* * These types store two bytes. */ info . meta = buffer . getUint16 ( ) ; break ; case MYSQL_TYPE_NEWDECIMAL : { int x = buffer . getUint8 ( ) << 8 ; // precision x += buffer . getUint8 ( ) ; // decimals info . meta = x ; break ; } case MYSQL_TYPE_TIME2 : case MYSQL_TYPE_DATETIME2 : case MYSQL_TYPE_TIMESTAMP2 : { info . meta = buffer . getUint8 ( ) ; break ; } default : info . meta = 0 ; break ; } } buffer . limit ( limit ) ; }
Decode field metadata by column types .