Fix longvarbinary (#3119)

* Handle LONGVARBINARY

* Add implementation and changelog

* Add type
This commit is contained in:
Tadgh 2021-10-28 11:42:47 -04:00 committed by GitHub
parent 5f672bc9e8
commit 8a1e8f4b2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
type: fix
issue: 3118
jira: SMILE-3254
title: "MySQL 5.7 maps BLOB columns to LONGVARBINARY and the migrator did not take this into account. This has been fixed."

View File

@ -189,10 +189,18 @@ public class JdbcUtils {
return new ColumnType(ColumnTypeEnum.DATE_TIMESTAMP, length);
case Types.BLOB:
return new ColumnType(ColumnTypeEnum.BLOB, length);
case Types.LONGVARBINARY:
if (DriverTypeEnum.MYSQL_5_7.equals(theConnectionProperties.getDriverType())) {
//See git
return new ColumnType(ColumnTypeEnum.BLOB, length);
} else {
throw new IllegalArgumentException("Don't know how to handle datatype " + dataType + " for column " + theColumnName + " on table " + theTableName);
}
case Types.VARBINARY:
if (DriverTypeEnum.MSSQL_2012.equals(theConnectionProperties.getDriverType())) {
// MS SQLServer seems to be mapping BLOB to VARBINARY under the covers, so we need to reverse that mapping
return new ColumnType(ColumnTypeEnum.BLOB, length);
} else {
throw new IllegalArgumentException("Don't know how to handle datatype " + dataType + " for column " + theColumnName + " on table " + theTableName);
}