Skip to content

Commit

Permalink
update in java mysql connector
Browse files Browse the repository at this point in the history
  • Loading branch information
hash-data committed Mar 19, 2024
1 parent 858e7a9 commit 78e23ba
Show file tree
Hide file tree
Showing 6 changed files with 654 additions and 674 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,6 @@ void testDiscover() throws Exception {
.collect(Collectors.toList()));
}

@Test
public void newTableSnapshotTest() throws Exception {
final AutoCloseableIterator<AirbyteMessage> firstBatchIterator = getSource()
.read(getConfig(), CONFIGURED_CATALOG, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,24 +78,7 @@ public void copyToJsonField(final ResultSet resultSet, final int colIndex, final

// https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-type-conversions.html
switch (columnType) {
case BIT -> {
if (field.getLength() == 1L) {
// BIT(1) is boolean
putBoolean(json, columnName, resultSet, colIndex);
} else {
putBinary(json, columnName, resultSet, colIndex);
}
}
case BOOLEAN -> putBoolean(json, columnName, resultSet, colIndex);
case TINYINT -> {
if (field.getLength() == 1L) {
// TINYINT(1) is boolean
putBoolean(json, columnName, resultSet, colIndex);
} else {
putShortInt(json, columnName, resultSet, colIndex);
}
}
case TINYINT_UNSIGNED, YEAR -> putShortInt(json, columnName, resultSet, colIndex);
case BIT, BOOLEAN, TINYINT, TINYINT_UNSIGNED, YEAR -> putShortInt(json, columnName, resultSet, colIndex);
case SMALLINT, SMALLINT_UNSIGNED, MEDIUMINT, MEDIUMINT_UNSIGNED -> putInteger(json, columnName, resultSet, colIndex);
case INT, INT_UNSIGNED -> {
if (field.isUnsigned()) {
Expand Down Expand Up @@ -172,7 +155,7 @@ public MysqlType getDatabaseFieldType(final JsonNode field) {
// BIT(1) and TINYINT(1) are interpreted as boolean
case BIT, TINYINT -> {
if (columnSize == 1) {
return MysqlType.BOOLEAN;
return SMALLINT;
}
}
case YEAR -> {
Expand Down
Loading

0 comments on commit 78e23ba

Please sign in to comment.