mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
Update LogEventConvert.java (#4653)
fixed issue #4652, 解决mysql中类型为MEDIUMTEXT的字段的javaType在不同场景的解析不一致的问题
This commit is contained in:
@@ -754,6 +754,23 @@ public class LogEventConvert extends AbstractCanalLifeCycle implements BinlogPar
|
|||||||
int javaType = buffer.getJavaType();
|
int javaType = buffer.getJavaType();
|
||||||
if (buffer.isNull()) {
|
if (buffer.isNull()) {
|
||||||
columnBuilder.setIsNull(true);
|
columnBuilder.setIsNull(true);
|
||||||
|
|
||||||
|
// 处理各种类型
|
||||||
|
switch (javaType) {
|
||||||
|
case Types.BINARY:
|
||||||
|
case Types.VARBINARY:
|
||||||
|
case Types.LONGVARBINARY:
|
||||||
|
|
||||||
|
// https://github.com/alibaba/canal/issues/4652
|
||||||
|
// mysql binlog中blob/text都处理为blob类型,需要反查table
|
||||||
|
// meta,按编码解析text
|
||||||
|
if (fieldMeta != null && isText(fieldMeta.getColumnType())) {
|
||||||
|
javaType = Types.CLOB;
|
||||||
|
} else {
|
||||||
|
javaType = Types.BLOB;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
final Serializable value = buffer.getValue();
|
final Serializable value = buffer.getValue();
|
||||||
// 处理各种类型
|
// 处理各种类型
|
||||||
|
|||||||
Reference in New Issue
Block a user