diff --git a/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/DMCatalog.java b/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/DMCatalog.java index f785f1a1b45..a02f4b095c8 100644 --- a/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/DMCatalog.java +++ b/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/DMCatalog.java @@ -18,7 +18,6 @@ package org.apache.seatunnel.connectors.seatunnel.jdbc.catalog; -import com.mysql.cj.MysqlType; import com.mysql.cj.jdbc.result.ResultSetImpl; import java.sql.Connection; import java.sql.DatabaseMetaData; @@ -29,7 +28,6 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.Collections; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -43,129 +41,117 @@ import org.apache.seatunnel.api.table.catalog.exception.CatalogException; import org.apache.seatunnel.api.table.catalog.exception.DatabaseNotExistException; import org.apache.seatunnel.api.table.catalog.exception.TableNotExistException; -import org.apache.seatunnel.api.table.type.BasicType; -import org.apache.seatunnel.api.table.type.DecimalType; -import org.apache.seatunnel.api.table.type.LocalTimeType; -import org.apache.seatunnel.api.table.type.PrimitiveByteArrayType; import org.apache.seatunnel.api.table.type.SeaTunnelDataType; -/** - * dm database - * - * @author Lager.Tang - * create: 2022-08-06 13:06 - **/ public class DMCatalog extends AbstractJdbcCatalog { - public DMCatalog(String catalogName, String defaultDatabase, String username, String pwd, String baseUrl) { - super(catalogName, defaultDatabase, username, pwd, baseUrl); - } - - public DMCatalog(String catalogName, String username, String pwd, String defaultUrl) { - super(catalogName, username, pwd, defaultUrl); - } - - private static final Set SYS_DATABASES = new HashSet<>(4); + private static final Set SYS_DATABASES = new HashSet<>(4); - static { - SYS_DATABASES.add("SYSSSO"); - SYS_DATABASES.add("CTISYS"); - SYS_DATABASES.add("SYS"); - SYS_DATABASES.add("SYSAUDITOR"); - } - - @Override - public List listDatabases() throws CatalogException { - try (Connection conn = DriverManager.getConnection(defaultUrl, username, pwd)) { + static { + SYS_DATABASES.add("SYSSSO"); + SYS_DATABASES.add("CTISYS"); + SYS_DATABASES.add("SYS"); + SYS_DATABASES.add("SYSAUDITOR"); + } - PreparedStatement ps = conn.prepareStatement("SELECT DISTINCT object_name FROM ALL_OBJECTS WHERE OBJECT_TYPE = 'SCH';"); + public DMCatalog(String catalogName, String defaultDatabase, String username, String pwd, String baseUrl) { + super(catalogName, defaultDatabase, username, pwd, baseUrl); + } - List databases = new ArrayList<>(); - ResultSet rs = ps.executeQuery(); + public DMCatalog(String catalogName, String username, String pwd, String defaultUrl) { + super(catalogName, username, pwd, defaultUrl); + } - while (rs.next()) { - String databaseName = rs.getString(1); - if (!SYS_DATABASES.contains(databaseName)) { - databases.add(rs.getString(1)); + @Override + public List listDatabases() throws CatalogException { + try (Connection conn = DriverManager.getConnection(defaultUrl, username, pwd)) { + + PreparedStatement ps = conn.prepareStatement("SELECT DISTINCT object_name FROM ALL_OBJECTS WHERE OBJECT_TYPE = 'SCH';"); + + List databases = new ArrayList<>(); + ResultSet rs = ps.executeQuery(); + + while (rs.next()) { + String databaseName = rs.getString(1); + if (!SYS_DATABASES.contains(databaseName)) { + databases.add(rs.getString(1)); + } + } + return databases; + } catch (Exception e) { + throw new CatalogException( + String.format("Failed listing database in catalog %s", this.catalogName), e); } - } - return databases; - } catch (Exception e) { - throw new CatalogException( - String.format("Failed listing database in catalog %s", this.catalogName), e); } - } - @Override - public List listTables(String databaseName) throws CatalogException, DatabaseNotExistException { - if (!databaseExists(databaseName)) { - throw new DatabaseNotExistException(this.catalogName, databaseName); - } + @Override + public List listTables(String databaseName) throws CatalogException, DatabaseNotExistException { + if (!databaseExists(databaseName)) { + throw new DatabaseNotExistException(this.catalogName, databaseName); + } - try (Connection conn = DriverManager.getConnection(baseUrl + databaseName, username, pwd)) { - PreparedStatement ps = - conn.prepareStatement(String.format("select * from all_tables where owner = '%s';", databaseName)); + try (Connection conn = DriverManager.getConnection(baseUrl + databaseName, username, pwd)) { + PreparedStatement ps = + conn.prepareStatement(String.format("select * from all_tables where owner = '%s';", databaseName)); - ResultSet rs = ps.executeQuery(); + ResultSet rs = ps.executeQuery(); - List tables = new ArrayList<>(); + List tables = new ArrayList<>(); - while (rs.next()) { - tables.add(rs.getString(1)); - } + while (rs.next()) { + tables.add(rs.getString(1)); + } - return tables; - } catch (Exception e) { - throw new CatalogException( - String.format("Failed listing database in catalog %s", catalogName), e); + return tables; + } catch (Exception e) { + throw new CatalogException( + String.format("Failed listing database in catalog %s", catalogName), e); + } } - } - @Override - public CatalogTable getTable(TablePath tablePath) throws CatalogException, TableNotExistException { - if (!tableExists(tablePath)) { - throw new TableNotExistException(catalogName, tablePath); - } + @Override + public CatalogTable getTable(TablePath tablePath) throws CatalogException, TableNotExistException { + if (!tableExists(tablePath)) { + throw new TableNotExistException(catalogName, tablePath); + } - String dbUrl = baseUrl + tablePath.getDatabaseName(); - try (Connection conn = DriverManager.getConnection(dbUrl, username, pwd)) { - DatabaseMetaData metaData = conn.getMetaData(); - Optional primaryKey = - getPrimaryKey(metaData, tablePath.getDatabaseName(), tablePath.getTableName()); + String dbUrl = baseUrl + tablePath.getDatabaseName(); + try (Connection conn = DriverManager.getConnection(dbUrl, username, pwd)) { + DatabaseMetaData metaData = conn.getMetaData(); + Optional primaryKey = + getPrimaryKey(metaData, tablePath.getDatabaseName(), tablePath.getTableName()); - PreparedStatement ps = - conn.prepareStatement(String.format("SELECT * FROM %s WHERE 1 = 0;", tablePath.getFullName())); + PreparedStatement ps = + conn.prepareStatement(String.format("SELECT * FROM %s WHERE 1 = 0;", tablePath.getFullName())); - ResultSetMetaData tableMetaData = ps.getMetaData(); + ResultSetMetaData tableMetaData = ps.getMetaData(); - TableSchema.Builder builder = TableSchema.builder(); - for (int i = 1; i <= tableMetaData.getColumnCount(); i++) { - SeaTunnelDataType type = fromJdbcType(tableMetaData, i); - builder.physicalColumn(tableMetaData.getColumnName(i), type); - } + TableSchema.Builder builder = TableSchema.builder(); + for (int i = 1; i <= tableMetaData.getColumnCount(); i++) { + SeaTunnelDataType type = fromJdbcType(tableMetaData, i); + builder.physicalColumn(tableMetaData.getColumnName(i), type); + } - primaryKey.ifPresent(builder::primaryKey); + primaryKey.ifPresent(builder::primaryKey); + + TableIdentifier tableIdentifier = TableIdentifier.of(catalogName, tablePath.getDatabaseName(), tablePath.getTableName()); + return CatalogTable.of(tableIdentifier, builder.build(), buildConnectorOptions(tablePath), Collections.emptyList(), ""); + } catch (Exception e) { + throw new CatalogException(String.format("Failed getting table %s", tablePath.getFullName()), e); + } + } + + + /** + * @see com.mysql.cj.MysqlType + * @see ResultSetImpl#getObjectStoredProc(int, int) + */ + private SeaTunnelDataType fromJdbcType(ResultSetMetaData metadata, int colIndex) throws SQLException { + return null; + } - TableIdentifier tableIdentifier = TableIdentifier.of(catalogName, tablePath.getDatabaseName(), tablePath.getTableName()); - return CatalogTable.of(tableIdentifier, builder.build(), buildConnectorOptions(tablePath), Collections.emptyList(), ""); - } catch (Exception e) { - throw new CatalogException(String.format("Failed getting table %s", tablePath.getFullName()), e); + @SuppressWarnings("MagicNumber") + private Map buildConnectorOptions(TablePath tablePath) { + return null; } - } - - - /** - * @see com.mysql.cj.MysqlType - * @see ResultSetImpl#getObjectStoredProc(int, int) - */ - private SeaTunnelDataType fromJdbcType(ResultSetMetaData metadata, int colIndex) throws SQLException { - // todo: - return null; - } - - @SuppressWarnings("MagicNumber") - private Map buildConnectorOptions(TablePath tablePath) { - // todo: - return null; - } } diff --git a/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/dm/DMDialectFactory.java b/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/dm/DMDialectFactory.java index eb3999ab59e..0956b596a1d 100644 --- a/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/dm/DMDialectFactory.java +++ b/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/dm/DMDialectFactory.java @@ -21,10 +21,13 @@ import org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.JdbcDialect; import org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.JdbcDialectFactory; -/** Factory for {@link DMDialect}. */ +/** + * Factory for {@link DMDialect}. + */ @AutoService(JdbcDialectFactory.class) public class DMDialectFactory implements JdbcDialectFactory { + @Override public boolean acceptsURL(String url) { return url.startsWith("jdbc:dm:"); diff --git a/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/dm/DMJdbcRowConverter.java b/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/dm/DMJdbcRowConverter.java index 428cc1a9471..f66e27647a6 100644 --- a/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/dm/DMJdbcRowConverter.java +++ b/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/dm/DMJdbcRowConverter.java @@ -25,6 +25,7 @@ import org.apache.seatunnel.connectors.seatunnel.jdbc.internal.converter.AbstractJdbcRowConverter; public class DMJdbcRowConverter extends AbstractJdbcRowConverter { + @Override public String converterName() { return "MySql"; diff --git a/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/dm/DMTypeMapper.java b/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/dm/DMTypeMapper.java index d0532b34863..97a0d5c0c6e 100644 --- a/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/dm/DMTypeMapper.java +++ b/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/dm/DMTypeMapper.java @@ -28,150 +28,150 @@ public class DMTypeMapper implements JdbcDialectTypeMapper { + // ============================data types===================== + private static final String DM_BIT = "BIT"; - // ============================data types===================== - public static final String DM_BIT = "BIT"; + // ----------------------------number------------------------- + private static final String DM_NUMERIC = "NUMERIC"; + private static final String DM_NUMBER = "NUMBER"; + private static final String DM_DECIMAL = "DECIMAL"; + /** + * same to DECIMAL + */ + private static final String DM_DEC = "DEC"; - // ----------------------------number------------------------- - public static final String DM_NUMERIC = "NUMERIC"; - public static final String DM_NUMBER = "NUMBER"; - public static final String DM_DECIMAL = "DECIMAL"; - /** - * same to DECIMAL - */ - public static final String DM_DEC = "DEC"; - // ----------------------------int----------------------------- - public static final String DM_INTEGER = "INTEGER"; - public static final String DM_INT = "INT"; - public static final String DM_BIGINT = "BIGINT"; - public static final String DM_TINYINT = "TINYINT"; - public static final String DM_BYTE = "BYTE"; - public static final String DM_SMALLINT = "SMALLINT"; - // dm float is double for Cpp. - public static final String DM_FLOAT = "FLOAT"; - public static final String DM_DOUBLE = "DOUBLE"; - public static final String DM_DOUBLE_PRECISION = "DOUBLE PRECISION"; - public static final String DM_REAL = "REAL"; - // DM_CHAR DM_CHARACTER DM_VARCHAR DM_VARCHAR2 max is 32767 - public static final String DM_CHAR = "CHAR"; - public static final String DM_CHARACTER = "CHARACTER"; - public static final String DM_VARCHAR = "VARCHAR"; - public static final String DM_VARCHAR2 = "VARCHAR2"; - public static final String DM_LONGVARCHAR = "LONGVARCHAR"; - public static final String DM_CLOB = "CLOB"; - public static final String DM_TEXT = "TEXT"; - public static final String DM_LONG = "LONG"; - // ------------------------------time------------------------- - public static final String DM_DATE = "DATE"; - public static final String DM_TIME = "TIME"; - public static final String DM_TIMESTAMP = "TIMESTAMP"; - // ---------------------------binary--------------------------- - public static final String DM_BINARY = "BINARY"; - public static final String DM_VARBINARY = "VARBINARY"; + // ----------------------------int----------------------------- + private static final String DM_INTEGER = "INTEGER"; + private static final String DM_INT = "INT"; + private static final String DM_BIGINT = "BIGINT"; + private static final String DM_TINYINT = "TINYINT"; + private static final String DM_BYTE = "BYTE"; + private static final String DM_SMALLINT = "SMALLINT"; - // time interval - public static final String DM_INTERVAL_YEAR_TO_MONTH = "INTERVAL YEAR TO MONTH"; - public static final String DM_INTERVAL_YEAR = "INTERVAL YEAR"; - public static final String DM_INTERVAL_MONTH = "INTERVAL MONTH"; - public static final String DM_INTERVAL_DAY = "INTERVAL DAY"; - public static final String DM_INTERVAL_DAY_TO_HOUR = "INTERVAL DAY TO HOUR"; - public static final String DM_INTERVAL_DAY_TO_MINUTE = "INTERVAL DAY TO MINUTE"; - public static final String DM_INTERVAL_DAY_TO_SECOND = "INTERVAL DAY TO SECOND"; - public static final String DM_INTERVAL_HOUR = "INTERVAL HOUR"; - public static final String DM_INTERVAL_HOUR_TO_MINUTE = "INTERVAL HOUR TO MINUTE"; - public static final String DM_INTERVAL_HOUR_TO_SECOND = "INTERVAL HOUR TO SECOND"; - public static final String DM_INTERVAL_MINUTE = "INTERVAL MINUTE"; - public static final String DM_INTERVAL_MINUTE_TO_SECOND = "INTERVAL MINUTE TO SECOND"; - public static final String DM_INTERVAL_SECOND = "INTERVAL SECOND"; - // time zone - public static final String DM_TIME_WITH_TIME_ZONE = "TIME WITH TIME ZONE"; - public static final String DM_TIMESTAMP_WITH_TIME_ZONE = "TIMESTAMP WITH TIME ZONE"; - public static final String TIMESTAMP_WITH_LOCAL_TIME_ZONE = "TIMESTAMP WITH LOCAL TIME ZONE"; + // dm float is double for Cpp. + private static final String DM_FLOAT = "FLOAT"; + private static final String DM_DOUBLE = "DOUBLE"; + private static final String DM_DOUBLE_PRECISION = "DOUBLE PRECISION"; + private static final String DM_REAL = "REAL"; - // ------------------------------blob------------------------- + // DM_CHAR DM_CHARACTER DM_VARCHAR DM_VARCHAR2 max is 32767 + private static final String DM_CHAR = "CHAR"; + private static final String DM_CHARACTER = "CHARACTER"; + private static final String DM_VARCHAR = "VARCHAR"; + private static final String DM_VARCHAR2 = "VARCHAR2"; + private static final String DM_LONGVARCHAR = "LONGVARCHAR"; + private static final String DM_CLOB = "CLOB"; + private static final String DM_TEXT = "TEXT"; + private static final String DM_LONG = "LONG"; + // ------------------------------time------------------------- + private static final String DM_DATE = "DATE"; + private static final String DM_TIME = "TIME"; + private static final String DM_TIMESTAMP = "TIMESTAMP"; - public static final String DM_BLOB = "BLOB"; - public static final String DM_BFILE = "BFILE"; - public static final String DM_IMAGE = "IMAGE"; - public static final String DM_LONGVARBINARY = "LONGVARBINARY"; + // ---------------------------binary--------------------------- + private static final String DM_BINARY = "BINARY"; + private static final String DM_VARBINARY = "VARBINARY"; - @Override - public SeaTunnelDataType mapping(ResultSetMetaData metadata, int colIndex) throws SQLException { - String mysqlType = metadata.getColumnTypeName(colIndex).toUpperCase(); + // -------------------------time interval----------------------- + private static final String DM_INTERVAL_YEAR_TO_MONTH = "INTERVAL YEAR TO MONTH"; + private static final String DM_INTERVAL_YEAR = "INTERVAL YEAR"; + private static final String DM_INTERVAL_MONTH = "INTERVAL MONTH"; + private static final String DM_INTERVAL_DAY = "INTERVAL DAY"; + private static final String DM_INTERVAL_DAY_TO_HOUR = "INTERVAL DAY TO HOUR"; + private static final String DM_INTERVAL_DAY_TO_MINUTE = "INTERVAL DAY TO MINUTE"; + private static final String DM_INTERVAL_DAY_TO_SECOND = "INTERVAL DAY TO SECOND"; + private static final String DM_INTERVAL_HOUR = "INTERVAL HOUR"; + private static final String DM_INTERVAL_HOUR_TO_MINUTE = "INTERVAL HOUR TO MINUTE"; + private static final String DM_INTERVAL_HOUR_TO_SECOND = "INTERVAL HOUR TO SECOND"; + private static final String DM_INTERVAL_MINUTE = "INTERVAL MINUTE"; + private static final String DM_INTERVAL_MINUTE_TO_SECOND = "INTERVAL MINUTE TO SECOND"; + private static final String DM_INTERVAL_SECOND = "INTERVAL SECOND"; + // time zone + private static final String DM_TIME_WITH_TIME_ZONE = "TIME WITH TIME ZONE"; + private static final String DM_TIMESTAMP_WITH_TIME_ZONE = "TIMESTAMP WITH TIME ZONE"; + private static final String TIMESTAMP_WITH_LOCAL_TIME_ZONE = "TIMESTAMP WITH LOCAL TIME ZONE"; + + // ------------------------------blob------------------------- + public static final String DM_BLOB = "BLOB"; + public static final String DM_BFILE = "BFILE"; + public static final String DM_IMAGE = "IMAGE"; + public static final String DM_LONGVARBINARY = "LONGVARBINARY"; + + @Override + public SeaTunnelDataType mapping(ResultSetMetaData metadata, int colIndex) throws SQLException { + String mysqlType = metadata.getColumnTypeName(colIndex).toUpperCase(); // String columnName = metadata.getColumnName(colIndex); - int precision = metadata.getPrecision(colIndex); - int scale = metadata.getScale(colIndex); - switch (mysqlType) { - case DM_BIT: - return BasicType.BOOLEAN_TYPE; - case DM_INT: - case DM_INTEGER: - case DM_TINYINT: - case DM_SMALLINT: - case DM_BYTE: - return BasicType.INT_TYPE; - case DM_BIGINT: - return BasicType.LONG_TYPE; - case DM_NUMERIC: - case DM_NUMBER: - case DM_DECIMAL: - case DM_DEC: - return new DecimalType(precision, scale); - case DM_REAL: - return BasicType.FLOAT_TYPE; - case DM_FLOAT: - case DM_DOUBLE_PRECISION: - case DM_DOUBLE: - return BasicType.DOUBLE_TYPE; - case DM_CHAR: - case DM_CHARACTER: - case DM_VARCHAR: - case DM_VARCHAR2: - // 100G-1 byte - case DM_TEXT: - case DM_LONG: - case DM_LONGVARCHAR: - case DM_CLOB: - return BasicType.STRING_TYPE; - case DM_TIMESTAMP: - return LocalTimeType.LOCAL_DATE_TIME_TYPE; - case DM_TIME: - return LocalTimeType.LOCAL_TIME_TYPE; - case DM_DATE: - return LocalTimeType.LOCAL_DATE_TYPE; - // 100G-1 byte - case DM_BLOB: - case DM_BINARY: - case DM_VARBINARY: - case DM_LONGVARBINARY: - case DM_IMAGE: - case DM_BFILE: - return PrimitiveByteArrayType.INSTANCE; + int precision = metadata.getPrecision(colIndex); + int scale = metadata.getScale(colIndex); + switch (mysqlType) { + case DM_BIT: + return BasicType.BOOLEAN_TYPE; + case DM_INT: + case DM_INTEGER: + case DM_TINYINT: + case DM_SMALLINT: + case DM_BYTE: + return BasicType.INT_TYPE; + case DM_BIGINT: + return BasicType.LONG_TYPE; + case DM_NUMERIC: + case DM_NUMBER: + case DM_DECIMAL: + case DM_DEC: + return new DecimalType(precision, scale); + case DM_REAL: + return BasicType.FLOAT_TYPE; + case DM_FLOAT: + case DM_DOUBLE_PRECISION: + case DM_DOUBLE: + return BasicType.DOUBLE_TYPE; + case DM_CHAR: + case DM_CHARACTER: + case DM_VARCHAR: + case DM_VARCHAR2: + // 100G-1 byte + case DM_TEXT: + case DM_LONG: + case DM_LONGVARCHAR: + case DM_CLOB: + return BasicType.STRING_TYPE; + case DM_TIMESTAMP: + return LocalTimeType.LOCAL_DATE_TIME_TYPE; + case DM_TIME: + return LocalTimeType.LOCAL_TIME_TYPE; + case DM_DATE: + return LocalTimeType.LOCAL_DATE_TYPE; + // 100G-1 byte + case DM_BLOB: + case DM_BINARY: + case DM_VARBINARY: + case DM_LONGVARBINARY: + case DM_IMAGE: + case DM_BFILE: + return PrimitiveByteArrayType.INSTANCE; - //Doesn't support yet - case DM_INTERVAL_YEAR_TO_MONTH: - case DM_INTERVAL_YEAR: - case DM_INTERVAL_MONTH: - case DM_INTERVAL_DAY: - case DM_INTERVAL_DAY_TO_HOUR: - case DM_INTERVAL_DAY_TO_MINUTE: - case DM_INTERVAL_DAY_TO_SECOND: - case DM_INTERVAL_HOUR: - case DM_INTERVAL_HOUR_TO_MINUTE: - case DM_INTERVAL_HOUR_TO_SECOND: - case DM_INTERVAL_MINUTE: - case DM_INTERVAL_MINUTE_TO_SECOND: - case DM_INTERVAL_SECOND: - case DM_TIME_WITH_TIME_ZONE: - case DM_TIMESTAMP_WITH_TIME_ZONE: - case TIMESTAMP_WITH_LOCAL_TIME_ZONE: - default: - final String jdbcColumnName = metadata.getColumnName(colIndex); - throw new UnsupportedOperationException( - String.format( - "Doesn't support MySQL type '%s' on column '%s' yet.", - mysqlType, jdbcColumnName)); + //Doesn't support yet + case DM_INTERVAL_YEAR_TO_MONTH: + case DM_INTERVAL_YEAR: + case DM_INTERVAL_MONTH: + case DM_INTERVAL_DAY: + case DM_INTERVAL_DAY_TO_HOUR: + case DM_INTERVAL_DAY_TO_MINUTE: + case DM_INTERVAL_DAY_TO_SECOND: + case DM_INTERVAL_HOUR: + case DM_INTERVAL_HOUR_TO_MINUTE: + case DM_INTERVAL_HOUR_TO_SECOND: + case DM_INTERVAL_MINUTE: + case DM_INTERVAL_MINUTE_TO_SECOND: + case DM_INTERVAL_SECOND: + case DM_TIME_WITH_TIME_ZONE: + case DM_TIMESTAMP_WITH_TIME_ZONE: + case TIMESTAMP_WITH_LOCAL_TIME_ZONE: + default: + final String jdbcColumnName = metadata.getColumnName(colIndex); + throw new UnsupportedOperationException( + String.format("Doesn't support MySQL type '%s' on column '%s' yet.", mysqlType, jdbcColumnName)); + } } - } }