HHH-14667 Remove extraction of TypeInfo from the Database JDBC metadata as it's unused
This commit is contained in:
parent
8002b188bb
commit
f8da005f3a
|
@ -9,10 +9,8 @@ package org.hibernate.engine.jdbc.env.internal;
|
|||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -21,8 +19,6 @@ import org.hibernate.engine.jdbc.cursor.internal.StandardRefCursorSupport;
|
|||
import org.hibernate.engine.jdbc.env.spi.ExtractedDatabaseMetaData;
|
||||
import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
|
||||
import org.hibernate.engine.jdbc.env.spi.SQLStateType;
|
||||
import org.hibernate.engine.jdbc.spi.TypeInfo;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.tool.schema.extract.spi.SequenceInformation;
|
||||
|
||||
/**
|
||||
|
@ -47,7 +43,6 @@ public class ExtractedDatabaseMetaDataImpl implements ExtractedDatabaseMetaData
|
|||
private final boolean lobLocatorUpdateCopy;
|
||||
|
||||
private final Set<String> extraKeywords;
|
||||
private final LinkedHashSet<TypeInfo> typeInfoSet;
|
||||
private final List<SequenceInformation> sequenceInformationList;
|
||||
|
||||
private ExtractedDatabaseMetaDataImpl(
|
||||
|
@ -55,7 +50,6 @@ public class ExtractedDatabaseMetaDataImpl implements ExtractedDatabaseMetaData
|
|||
String connectionCatalogName,
|
||||
String connectionSchemaName,
|
||||
Set<String> extraKeywords,
|
||||
LinkedHashSet<TypeInfo> typeInfoSet,
|
||||
boolean supportsRefCursors,
|
||||
boolean supportsNamedParameters,
|
||||
boolean supportsScrollableResults,
|
||||
|
@ -74,9 +68,6 @@ public class ExtractedDatabaseMetaDataImpl implements ExtractedDatabaseMetaData
|
|||
this.extraKeywords = extraKeywords != null
|
||||
? extraKeywords
|
||||
: Collections.<String>emptySet();
|
||||
this.typeInfoSet = typeInfoSet != null
|
||||
? typeInfoSet
|
||||
: new LinkedHashSet<TypeInfo>();
|
||||
|
||||
this.supportsRefCursors = supportsRefCursors;
|
||||
this.supportsNamedParameters = supportsNamedParameters;
|
||||
|
@ -155,11 +146,6 @@ public class ExtractedDatabaseMetaDataImpl implements ExtractedDatabaseMetaData
|
|||
return connectionSchemaName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkedHashSet<TypeInfo> getTypeInfoSet() {
|
||||
return typeInfoSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SequenceInformation> getSequenceInformationList() {
|
||||
return sequenceInformationList;
|
||||
|
@ -172,7 +158,6 @@ public class ExtractedDatabaseMetaDataImpl implements ExtractedDatabaseMetaData
|
|||
private String connectionCatalogName;
|
||||
|
||||
private Set<String> extraKeywords;
|
||||
private LinkedHashSet<TypeInfo> typeInfoSet;
|
||||
|
||||
private boolean supportsRefCursors;
|
||||
private boolean supportsNamedParameters;
|
||||
|
@ -202,8 +187,6 @@ public class ExtractedDatabaseMetaDataImpl implements ExtractedDatabaseMetaData
|
|||
extraKeywords = parseKeywords( databaseMetaData.getSQLKeywords() );
|
||||
sqlStateType = SQLStateType.interpretReportedSQLStateType( databaseMetaData.getSQLStateType() );
|
||||
lobLocatorUpdateCopy = databaseMetaData.locatorsUpdateCopy();
|
||||
typeInfoSet = new LinkedHashSet<TypeInfo>();
|
||||
typeInfoSet.addAll( TypeInfo.extractTypeInfo( databaseMetaData ) );
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -239,24 +222,6 @@ public class ExtractedDatabaseMetaDataImpl implements ExtractedDatabaseMetaData
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder setTypeInfoSet(LinkedHashSet<TypeInfo> typeInfoSet) {
|
||||
if ( this.typeInfoSet == null ) {
|
||||
this.typeInfoSet = typeInfoSet;
|
||||
}
|
||||
else {
|
||||
this.typeInfoSet.addAll( typeInfoSet );
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addTypeInfo(TypeInfo typeInfo) {
|
||||
if ( this.typeInfoSet == null ) {
|
||||
this.typeInfoSet = new LinkedHashSet<TypeInfo>();
|
||||
}
|
||||
typeInfoSet.add( typeInfo );
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setSupportsRefCursors(boolean supportsRefCursors) {
|
||||
this.supportsRefCursors = supportsRefCursors;
|
||||
return this;
|
||||
|
@ -313,7 +278,6 @@ public class ExtractedDatabaseMetaDataImpl implements ExtractedDatabaseMetaData
|
|||
connectionCatalogName,
|
||||
connectionSchemaName,
|
||||
extraKeywords,
|
||||
typeInfoSet,
|
||||
supportsRefCursors,
|
||||
supportsNamedParameters,
|
||||
supportsScrollableResults,
|
||||
|
|
|
@ -60,7 +60,6 @@ public class JdbcEnvironmentImpl implements JdbcEnvironment {
|
|||
private final QualifiedObjectNameFormatter qualifiedObjectNameFormatter;
|
||||
private final LobCreatorBuilderImpl lobCreatorBuilder;
|
||||
|
||||
private final LinkedHashSet<TypeInfo> typeInfoSet = new LinkedHashSet<TypeInfo>();
|
||||
private final NameQualifierSupport nameQualifierSupport;
|
||||
|
||||
/**
|
||||
|
@ -277,8 +276,6 @@ public class JdbcEnvironmentImpl implements JdbcEnvironment {
|
|||
databaseMetaData
|
||||
);
|
||||
|
||||
this.typeInfoSet.addAll( TypeInfo.extractTypeInfo( databaseMetaData ) );
|
||||
|
||||
this.lobCreatorBuilder = LobCreatorBuilderImpl.makeLobCreatorBuilder(
|
||||
dialect,
|
||||
cfgService.getSettings(),
|
||||
|
@ -379,14 +376,9 @@ public class JdbcEnvironmentImpl implements JdbcEnvironment {
|
|||
return lobCreatorBuilder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypeInfo getTypeInfoForJdbcCode(int jdbcTypeCode) {
|
||||
for ( TypeInfo typeInfo : typeInfoSet ) {
|
||||
if ( typeInfo.getJdbcTypeCode() == jdbcTypeCode ) {
|
||||
return typeInfo;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
throw new UnsupportedOperationException( "Support for getting TypeInfo from jdbcTypeCode has been disabled as it wasn't used." +
|
||||
" Use org.hibernate.engine.jdbc.spi.TypeInfo.extractTypeInfo as alternative, or report an issue and explain." );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -45,15 +45,6 @@ public interface ExtractedDatabaseMetaData {
|
|||
*/
|
||||
String getConnectionSchemaName();
|
||||
|
||||
/**
|
||||
* Set of type info reported by the driver.
|
||||
*
|
||||
* @return The type information obtained from the driver.
|
||||
*
|
||||
* @see java.sql.DatabaseMetaData#getTypeInfo()
|
||||
*/
|
||||
LinkedHashSet<TypeInfo> getTypeInfoSet();
|
||||
|
||||
/**
|
||||
* Get the list of extra keywords (beyond standard SQL92 keywords) reported by the driver.
|
||||
*
|
||||
|
|
|
@ -9,7 +9,6 @@ package org.hibernate.engine.jdbc.env.spi;
|
|||
import org.hibernate.boot.model.naming.Identifier;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
|
||||
import org.hibernate.engine.jdbc.spi.TypeInfo;
|
||||
import org.hibernate.service.Service;
|
||||
|
||||
/**
|
||||
|
@ -89,12 +88,4 @@ public interface JdbcEnvironment extends Service {
|
|||
*/
|
||||
LobCreatorBuilder getLobCreatorBuilder();
|
||||
|
||||
/**
|
||||
* Find type information for the type identified by the given "JDBC type code".
|
||||
*
|
||||
* @param jdbcTypeCode The JDBC type code.
|
||||
*
|
||||
* @return The corresponding type info.
|
||||
*/
|
||||
TypeInfo getTypeInfoForJdbcCode(int jdbcTypeCode);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue