예제 #1
0
 /*
  * (non-Javadoc)
  *
  * @see
  * com.dianping.puma.parser.mysql.event.AbstractBinlogEvent#doParse(java
  * .nio.ByteBuffer, com.dianping.puma.common.bo.PumaContext)
  */
 @Override
 public void doParse(ByteBuffer buf, PumaContext context) throws IOException {
   binlogFormatVersion = PacketUtils.readInt(buf, 2);
   serverVersion = PacketUtils.readFixedLengthString(buf, 50);
   createTimestamp = PacketUtils.readLong(buf, 4);
   headerLength = buf.get();
   eventTypes = PacketUtils.readBytes(buf, buf.remaining());
 }
예제 #2
0
  /*
   * (non-Javadoc)
   *
   * @see com.dianping.puma.parser.mysql.event.AbstractBinlogEvent#doParse(java .nio.ByteBuffer,
   * com.dianping.puma.common.bo.PumaContext)
   */
  @Override
  public void doParse(ByteBuffer buf, PumaContext context) throws IOException {
    tableId = PacketUtils.readLong(buf, 6);
    reserved = PacketUtils.readInt(buf, 2);
    databaseNameLength = buf.get();
    databaseName = PacketUtils.readNullTerminatedString(buf);
    tableNameLength = buf.get();
    tableName = PacketUtils.readNullTerminatedString(buf);
    columnCount = PacketUtils.readLengthCodedUnsignedLong(buf);
    columnTypes = PacketUtils.readBytes(buf, columnCount.intValue());
    columnMetadataCount = PacketUtils.readLengthCodedUnsignedLong(buf);

    columnMetadata =
        Metadata.valueOf(columnTypes, PacketUtils.readBytes(buf, columnMetadataCount.intValue()));
    columnNullabilities = PacketUtils.readBitSet(buf, columnCount.intValue());

    context.getTableMaps().put(tableId, this);
  }