mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
Merge pull request #682 from nbqyqx/master
Fix #631 Boolean java type support
This commit is contained in:
@@ -96,13 +96,7 @@ public class AbstractCanalClientTest {
|
|||||||
if (!running) {
|
if (!running) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
running = false;
|
connector.stopRunning();
|
||||||
if (waiting) {
|
|
||||||
if (connector instanceof ClusterCanalConnector) {
|
|
||||||
((ClusterCanalConnector) connector).setRetryTimes(-1);
|
|
||||||
}
|
|
||||||
thread.interrupt();
|
|
||||||
}
|
|
||||||
if (thread != null) {
|
if (thread != null) {
|
||||||
try {
|
try {
|
||||||
thread.join();
|
thread.join();
|
||||||
|
|||||||
@@ -634,11 +634,14 @@ public class LogEventConvert extends AbstractCanalLifeCycle implements BinlogPar
|
|||||||
// fixed issue
|
// fixed issue
|
||||||
// https://github.com/alibaba/canal/issues/66,特殊处理binary/varbinary,不能做编码处理
|
// https://github.com/alibaba/canal/issues/66,特殊处理binary/varbinary,不能做编码处理
|
||||||
boolean isBinary = false;
|
boolean isBinary = false;
|
||||||
|
boolean isSingleBit = false;
|
||||||
if (fieldMeta != null) {
|
if (fieldMeta != null) {
|
||||||
if (StringUtils.containsIgnoreCase(fieldMeta.getColumnType(), "VARBINARY")) {
|
if (StringUtils.containsIgnoreCase(fieldMeta.getColumnType(), "VARBINARY")) {
|
||||||
isBinary = true;
|
isBinary = true;
|
||||||
} else if (StringUtils.containsIgnoreCase(fieldMeta.getColumnType(), "BINARY")) {
|
} else if (StringUtils.containsIgnoreCase(fieldMeta.getColumnType(), "BINARY")) {
|
||||||
isBinary = true;
|
isBinary = true;
|
||||||
|
} else if (StringUtils.containsIgnoreCase(fieldMeta.getColumnType(), "tinyint(1)")) {
|
||||||
|
isSingleBit = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
buffer.nextValue(info.type, info.meta, isBinary);
|
buffer.nextValue(info.type, info.meta, isBinary);
|
||||||
@@ -648,6 +651,9 @@ public class LogEventConvert extends AbstractCanalLifeCycle implements BinlogPar
|
|||||||
}
|
}
|
||||||
|
|
||||||
int javaType = buffer.getJavaType();
|
int javaType = buffer.getJavaType();
|
||||||
|
if (isSingleBit && javaType == Types.TINYINT) {
|
||||||
|
javaType = Types.BIT;
|
||||||
|
}
|
||||||
if (buffer.isNull()) {
|
if (buffer.isNull()) {
|
||||||
columnBuilder.setIsNull(true);
|
columnBuilder.setIsNull(true);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user