DBZ-1773 Change test for null value

This commit is contained in:
Jiri Pechanec 2020-02-14 05:59:48 +01:00 committed by Gunnar Morling
parent a4d3c1e89a
commit f0cc055833
2 changed files with 5 additions and 2 deletions

View File

@ -163,7 +163,10 @@ else if (actualColumn.jdbcType() == Types.TIMESTAMP) {
// JDBC's rs.GetObject() will return a Boolean for all TINYINT(1) columns.
// TINYINT columns are reprtoed as SMALLINT by JDBC driver
else if (actualColumn.jdbcType() == Types.TINYINT || actualColumn.jdbcType() == Types.SMALLINT) {
return rs.wasNull() ? null : rs.getInt(fieldNo);
// It seems that rs.wasNull() returns false when default value is set and NULL is inserted
// We thus need to use getObject() to identify if the value was provided and if yes then
// read it again to get correct scale
return rs.getObject(fieldNo) == null ? null : rs.getInt(fieldNo);
}
else {
return rs.getObject(fieldNo);

View File

@ -89,6 +89,6 @@ private void assertChangeRecord() throws InterruptedException {
Assertions.assertThat(change.getInt16("ti")).isEqualTo((short) 100);
Assertions.assertThat(change.getInt16("ti1")).isEqualTo((short) 5);
Assertions.assertThat(change.getInt16("ti2")).isEqualTo((byte) 50);
Assertions.assertThat(change.getInt16("ti2")).isEqualTo((short) 50);
}
}