Search in sources :

Example 1 with MemoryTableMeta

use of com.alibaba.otter.canal.parse.inbound.mysql.tsdb.MemoryTableMeta in project canal by alibaba.

the class TableMetaCache method parseTableMeta.

public static List<FieldMeta> parseTableMeta(String schema, String table, ResultSetPacket packet) {
    if (packet.getFieldValues().size() > 1) {
        String createDDL = packet.getFieldValues().get(1);
        MemoryTableMeta memoryTableMeta = new MemoryTableMeta();
        memoryTableMeta.apply(DatabaseTableMeta.INIT_POSITION, schema, createDDL, null);
        TableMeta tableMeta = memoryTableMeta.find(schema, table);
        return tableMeta.getFields();
    } else {
        return new ArrayList<>();
    }
}
Also used : MemoryTableMeta(com.alibaba.otter.canal.parse.inbound.mysql.tsdb.MemoryTableMeta) ArrayList(java.util.ArrayList) DatabaseTableMeta(com.alibaba.otter.canal.parse.inbound.mysql.tsdb.DatabaseTableMeta) TableMeta(com.alibaba.otter.canal.parse.inbound.TableMeta) MemoryTableMeta(com.alibaba.otter.canal.parse.inbound.mysql.tsdb.MemoryTableMeta)

Aggregations

TableMeta (com.alibaba.otter.canal.parse.inbound.TableMeta)1 DatabaseTableMeta (com.alibaba.otter.canal.parse.inbound.mysql.tsdb.DatabaseTableMeta)1 MemoryTableMeta (com.alibaba.otter.canal.parse.inbound.mysql.tsdb.MemoryTableMeta)1 ArrayList (java.util.ArrayList)1