Class MySQL8DateTimeResultSetMetaData
- java.lang.Object
-
- com.alibaba.druid.filter.mysql8datetime.MySQL8DateTimeResultSetMetaData
-
- All Implemented Interfaces:
ResultSetMetaData,Wrapper
public class MySQL8DateTimeResultSetMetaData extends Object implements ResultSetMetaData
针对mysql jdbc 8.0.23及以上版本,通过该方法控制将对象类型转换成原来的类型- Author:
- lizongbo
- See Also:
- ...
-
-
Field Summary
-
Fields inherited from interface java.sql.ResultSetMetaData
columnNoNulls, columnNullable, columnNullableUnknown
-
-
Constructor Summary
Constructors Constructor Description MySQL8DateTimeResultSetMetaData(ResultSetMetaData resultSetMetaData)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetCatalogName(int column)StringgetColumnClassName(int column)针对8.0.24版本开始,如果把mysql DATETIME映射回Timestamp,就需要把javaClass的类型也改回去 相关类在com.mysql.cj.MysqlType 中 旧版本jdbc为 DATETIME("DATETIME", Types.TIMESTAMP, Timestamp.class, 0, MysqlType.IS_NOT_DECIMAL, 26L, "[(fsp)]"), 8.0.24及以上版本jdbc实现改为 DATETIME("DATETIME", Types.TIMESTAMP, LocalDateTime.class, 0, MysqlType.IS_NOT_DECIMAL, 26L, "[(fsp)]"),intgetColumnCount()intgetColumnDisplaySize(int column)StringgetColumnLabel(int column)StringgetColumnName(int column)intgetColumnType(int column)StringgetColumnTypeName(int column)intgetPrecision(int column)intgetScale(int column)StringgetSchemaName(int column)StringgetTableName(int column)booleanisAutoIncrement(int column)booleanisCaseSensitive(int column)booleanisCurrency(int column)booleanisDefinitelyWritable(int column)intisNullable(int column)booleanisReadOnly(int column)booleanisSearchable(int column)booleanisSigned(int column)booleanisWrapperFor(Class<?> iface)booleanisWritable(int column)<T> Tunwrap(Class<T> iface)
-
-
-
Constructor Detail
-
MySQL8DateTimeResultSetMetaData
public MySQL8DateTimeResultSetMetaData(ResultSetMetaData resultSetMetaData)
-
-
Method Detail
-
unwrap
public <T> T unwrap(Class<T> iface) throws SQLException
- Specified by:
unwrapin interfaceWrapper- Throws:
SQLException
-
getColumnCount
public int getColumnCount() throws SQLException- Specified by:
getColumnCountin interfaceResultSetMetaData- Throws:
SQLException
-
isAutoIncrement
public boolean isAutoIncrement(int column) throws SQLException- Specified by:
isAutoIncrementin interfaceResultSetMetaData- Throws:
SQLException
-
isCaseSensitive
public boolean isCaseSensitive(int column) throws SQLException- Specified by:
isCaseSensitivein interfaceResultSetMetaData- Throws:
SQLException
-
isSearchable
public boolean isSearchable(int column) throws SQLException- Specified by:
isSearchablein interfaceResultSetMetaData- Throws:
SQLException
-
isWrapperFor
public boolean isWrapperFor(Class<?> iface) throws SQLException
- Specified by:
isWrapperForin interfaceWrapper- Throws:
SQLException
-
isCurrency
public boolean isCurrency(int column) throws SQLException- Specified by:
isCurrencyin interfaceResultSetMetaData- Throws:
SQLException
-
isNullable
public int isNullable(int column) throws SQLException- Specified by:
isNullablein interfaceResultSetMetaData- Throws:
SQLException
-
isSigned
public boolean isSigned(int column) throws SQLException- Specified by:
isSignedin interfaceResultSetMetaData- Throws:
SQLException
-
getColumnDisplaySize
public int getColumnDisplaySize(int column) throws SQLException- Specified by:
getColumnDisplaySizein interfaceResultSetMetaData- Throws:
SQLException
-
getColumnLabel
public String getColumnLabel(int column) throws SQLException
- Specified by:
getColumnLabelin interfaceResultSetMetaData- Throws:
SQLException
-
getColumnName
public String getColumnName(int column) throws SQLException
- Specified by:
getColumnNamein interfaceResultSetMetaData- Throws:
SQLException
-
getSchemaName
public String getSchemaName(int column) throws SQLException
- Specified by:
getSchemaNamein interfaceResultSetMetaData- Throws:
SQLException
-
getPrecision
public int getPrecision(int column) throws SQLException- Specified by:
getPrecisionin interfaceResultSetMetaData- Throws:
SQLException
-
getScale
public int getScale(int column) throws SQLException- Specified by:
getScalein interfaceResultSetMetaData- Throws:
SQLException
-
getTableName
public String getTableName(int column) throws SQLException
- Specified by:
getTableNamein interfaceResultSetMetaData- Throws:
SQLException
-
getCatalogName
public String getCatalogName(int column) throws SQLException
- Specified by:
getCatalogNamein interfaceResultSetMetaData- Throws:
SQLException
-
getColumnType
public int getColumnType(int column) throws SQLException- Specified by:
getColumnTypein interfaceResultSetMetaData- Throws:
SQLException
-
getColumnTypeName
public String getColumnTypeName(int column) throws SQLException
- Specified by:
getColumnTypeNamein interfaceResultSetMetaData- Throws:
SQLException
-
isReadOnly
public boolean isReadOnly(int column) throws SQLException- Specified by:
isReadOnlyin interfaceResultSetMetaData- Throws:
SQLException
-
isWritable
public boolean isWritable(int column) throws SQLException- Specified by:
isWritablein interfaceResultSetMetaData- Throws:
SQLException
-
isDefinitelyWritable
public boolean isDefinitelyWritable(int column) throws SQLException- Specified by:
isDefinitelyWritablein interfaceResultSetMetaData- Throws:
SQLException
-
getColumnClassName
public String getColumnClassName(int column) throws SQLException
针对8.0.24版本开始,如果把mysql DATETIME映射回Timestamp,就需要把javaClass的类型也改回去 相关类在com.mysql.cj.MysqlType 中 旧版本jdbc为 DATETIME("DATETIME", Types.TIMESTAMP, Timestamp.class, 0, MysqlType.IS_NOT_DECIMAL, 26L, "[(fsp)]"), 8.0.24及以上版本jdbc实现改为 DATETIME("DATETIME", Types.TIMESTAMP, LocalDateTime.class, 0, MysqlType.IS_NOT_DECIMAL, 26L, "[(fsp)]"),- Specified by:
getColumnClassNamein interfaceResultSetMetaData- Parameters:
column- 列的索引位- Returns:
- 列名称
- Throws:
SQLException- 如果发生数据库访问错误- See Also:
ResultSetMetaData.getColumnClassName(int)
-
-