Java Code Examples for com.taobao.tddl.dbsync.binlog.event.TableMapLogEvent#getColumnInfo()

The following examples show how to use com.taobao.tddl.dbsync.binlog.event.TableMapLogEvent#getColumnInfo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MysqlBinlogParsePerformanceTest.java    From canal-1.1.3 with Apache License 2.0 6 votes vote down vote up
public static void parseOneRow(RowsLogEvent event, RowsLogBuffer buffer, BitSet cols, boolean isAfter)
                                                                                                      throws UnsupportedEncodingException {
    TableMapLogEvent map = event.getTable();
    if (map == null) {
        throw new RuntimeException("not found TableMap with tid=" + event.getTableId());
    }

    final int columnCnt = map.getColumnCnt();
    final ColumnInfo[] columnInfo = map.getColumnInfo();
    for (int i = 0; i < columnCnt; i++) {
        if (!cols.get(i)) {
            continue;
        }

        ColumnInfo info = columnInfo[i];
        buffer.nextValue(null, i, info.type, info.meta);
        if (buffer.isNull()) {
        } else {
            buffer.getValue();
        }
    }
}
 
Example 2
Source File: MysqlBinlogParsePerformanceTest.java    From canal with Apache License 2.0 6 votes vote down vote up
public static void parseOneRow(RowsLogEvent event, RowsLogBuffer buffer, BitSet cols, boolean isAfter)
                                                                                                      throws UnsupportedEncodingException {
    TableMapLogEvent map = event.getTable();
    if (map == null) {
        throw new RuntimeException("not found TableMap with tid=" + event.getTableId());
    }

    final int columnCnt = map.getColumnCnt();
    final ColumnInfo[] columnInfo = map.getColumnInfo();
    for (int i = 0; i < columnCnt; i++) {
        if (!cols.get(i)) {
            continue;
        }

        ColumnInfo info = columnInfo[i];
        buffer.nextValue(null, i, info.type, info.meta);
        if (buffer.isNull()) {
        } else {
            buffer.getValue();
        }
    }
}
 
Example 3
Source File: BaseLogFetcherTest.java    From canal-1.1.3 with Apache License 2.0 5 votes vote down vote up
protected void parseOneRow(RowsLogEvent event, RowsLogBuffer buffer, BitSet cols, boolean isAfter)
                                                                                                  throws UnsupportedEncodingException {
    TableMapLogEvent map = event.getTable();
    if (map == null) {
        throw new RuntimeException("not found TableMap with tid=" + event.getTableId());
    }

    final int columnCnt = map.getColumnCnt();
    final ColumnInfo[] columnInfo = map.getColumnInfo();

    for (int i = 0; i < columnCnt; i++) {
        if (!cols.get(i)) {
            continue;
        }

        ColumnInfo info = columnInfo[i];
        buffer.nextValue(null , i ,info.type, info.meta);

        if (buffer.isNull()) {
            //
        } else {
            final Serializable value = buffer.getValue();
            if (value instanceof byte[]) {
                System.out.println(new String((byte[]) value));
            } else {
                System.out.println(value);
            }
        }
    }

}
 
Example 4
Source File: DirectLogFetcherTest.java    From canal-1.1.3 with Apache License 2.0 5 votes vote down vote up
protected void parseOneRow(RowsLogEvent event, RowsLogBuffer buffer, BitSet cols, boolean isAfter)
                                                                                                  throws UnsupportedEncodingException {
    TableMapLogEvent map = event.getTable();
    if (map == null) {
        throw new RuntimeException("not found TableMap with tid=" + event.getTableId());
    }

    final int columnCnt = map.getColumnCnt();
    final ColumnInfo[] columnInfo = map.getColumnInfo();

    for (int i = 0; i < columnCnt; i++) {
        if (!cols.get(i)) {
            continue;
        }

        ColumnInfo info = columnInfo[i];
        buffer.nextValue(null, i, info.type, info.meta);

        if (buffer.isNull()) {
            //
        } else {
            final Serializable value = buffer.getValue();
            if (value instanceof byte[]) {
                System.out.println(new String((byte[]) value));
            } else {
                System.out.println(value);
            }
        }
    }

}
 
Example 5
Source File: BaseLogFetcherTest.java    From canal with Apache License 2.0 5 votes vote down vote up
protected void parseOneRow(RowsLogEvent event, RowsLogBuffer buffer, BitSet cols, boolean isAfter)
                                                                                                  throws UnsupportedEncodingException {
    TableMapLogEvent map = event.getTable();
    if (map == null) {
        throw new RuntimeException("not found TableMap with tid=" + event.getTableId());
    }

    final int columnCnt = map.getColumnCnt();
    final ColumnInfo[] columnInfo = map.getColumnInfo();

    for (int i = 0; i < columnCnt; i++) {
        if (!cols.get(i)) {
            continue;
        }

        ColumnInfo info = columnInfo[i];
        buffer.nextValue(null , i ,info.type, info.meta);

        if (buffer.isNull()) {
            //
        } else {
            final Serializable value = buffer.getValue();
            if (value instanceof byte[]) {
                System.out.println(new String((byte[]) value));
            } else {
                System.out.println(value);
            }
        }
    }

}
 
Example 6
Source File: DirectLogFetcherTest.java    From canal with Apache License 2.0 5 votes vote down vote up
protected void parseOneRow(RowsLogEvent event, RowsLogBuffer buffer, BitSet cols, boolean isAfter)
                                                                                                  throws UnsupportedEncodingException {
    TableMapLogEvent map = event.getTable();
    if (map == null) {
        throw new RuntimeException("not found TableMap with tid=" + event.getTableId());
    }

    final int columnCnt = map.getColumnCnt();
    final ColumnInfo[] columnInfo = map.getColumnInfo();

    for (int i = 0; i < columnCnt; i++) {
        if (!cols.get(i)) {
            continue;
        }

        ColumnInfo info = columnInfo[i];
        buffer.nextValue(null, i, info.type, info.meta);

        if (buffer.isNull()) {
            //
        } else {
            final Serializable value = buffer.getValue();
            if (value instanceof byte[]) {
                System.out.println(new String((byte[]) value));
            } else {
                System.out.println(value);
            }
        }
    }

}