Class GenericCallMetaDataProvider
java.lang.Object
org.springframework.jdbc.core.metadata.GenericCallMetaDataProvider
- All Implemented Interfaces:
CallMetaDataProvider
- Direct Known Subclasses:
Db2CallMetaDataProvider,DerbyCallMetaDataProvider,HanaCallMetaDataProvider,OracleCallMetaDataProvider,PostgresCallMetaDataProvider,SqlServerCallMetaDataProvider,SybaseCallMetaDataProvider
A generic implementation of the
CallMetaDataProvider interface.
This class can be extended to provide database specific behavior.- Since:
- 2.5
- Author:
- Thomas Risberg, Juergen Hoeller, Sam Brannen
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedGenericCallMetaDataProvider(DatabaseMetaData databaseMetaData) Constructor used to initialize with provided database meta-data. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbyPassReturnParameter(String parameterName) Should we bypass the return parameter with the specified name.catalogNameToUse(String catalogName) Provide any modification of the catalog name passed in to match the meta-data currently used.createDefaultInOutParameter(String parameterName, CallParameterMetaData meta) Create a default in/out parameter based on the provided meta-data.createDefaultInParameter(String parameterName, CallParameterMetaData meta) Create a default in parameter based on the provided meta-data.createDefaultOutParameter(String parameterName, CallParameterMetaData meta) Create a default out parameter based on the provided meta-data.Get the call parameter meta-data that is currently used.intGet theTypestype for columns that return ResultSets as ref cursors if this feature is supported.Get the name of the current user.voidinitializeWithMetaData(DatabaseMetaData databaseMetaData) Initialize using the provided DatabaseMetData.voidinitializeWithProcedureColumnMetaData(DatabaseMetaData databaseMetaData, String catalogName, String schemaName, String procedureName) Initialize the database specific management of procedure column meta-data.booleanAre we using the meta-data for the procedure columns?booleanDoes this database support returning ResultSets as ref cursors to be retrieved withCallableStatement.getObject(int)for the specified column.booleanDoes this database support returning ResultSets that should be retrieved with the JDBC call:Statement.getResultSet()?protected booleanDoes the database use lower case for identifiers?protected booleanDoes the database use upper case for identifiers?booleanDoes the database support the use of catalog name in procedure calls?booleanDoes the database support the use of schema name in procedure calls?metaDataCatalogNameToUse(String catalogName) Provide any modification of the catalog name passed in to match the meta-data currently used.metaDataSchemaNameToUse(String schemaName) Provide any modification of the schema name passed in to match the meta-data currently used.parameterNameToUse(String parameterName) Provide any modification of the column name passed in to match the meta-data currently used.procedureNameToUse(String procedureName) Provide any modification of the procedure name passed in to match the meta-data currently used.schemaNameToUse(String schemaName) Provide any modification of the schema name passed in to match the meta-data currently used.protected voidsetStoresLowerCaseIdentifiers(boolean storesLowerCaseIdentifiers) Specify whether the database uses lower case for identifiers.protected voidsetStoresUpperCaseIdentifiers(boolean storesUpperCaseIdentifiers) Specify whether the database uses upper case for identifiers.protected voidsetSupportsCatalogsInProcedureCalls(boolean supportsCatalogsInProcedureCalls) Specify whether the database supports the use of catalog name in procedure calls.protected voidsetSupportsSchemasInProcedureCalls(boolean supportsSchemasInProcedureCalls) Specify whether the database supports the use of schema name in procedure calls.
-
Field Details
-
logger
Logger available to subclasses.
-
-
Constructor Details
-
GenericCallMetaDataProvider
Constructor used to initialize with provided database meta-data.- Parameters:
databaseMetaData- meta-data to be used- Throws:
SQLException
-
-
Method Details
-
initializeWithMetaData
Description copied from interface:CallMetaDataProviderInitialize using the provided DatabaseMetData.- Specified by:
initializeWithMetaDatain interfaceCallMetaDataProvider- Parameters:
databaseMetaData- used to retrieve database specific information- Throws:
SQLException- in case of initialization failure
-
initializeWithProcedureColumnMetaData
public void initializeWithProcedureColumnMetaData(DatabaseMetaData databaseMetaData, @Nullable String catalogName, @Nullable String schemaName, @Nullable String procedureName) throws SQLException Description copied from interface:CallMetaDataProviderInitialize the database specific management of procedure column meta-data. This is only called for databases that are supported. This initialization can be turned off by specifying that column meta-data should not be used.- Specified by:
initializeWithProcedureColumnMetaDatain interfaceCallMetaDataProvider- Parameters:
databaseMetaData- used to retrieve database specific informationcatalogName- name of catalog to use (ornullif none)schemaName- name of schema name to use (ornullif none)procedureName- name of the stored procedure- Throws:
SQLException- in case of initialization failure- See Also:
-
getCallParameterMetaData
Description copied from interface:CallMetaDataProviderGet the call parameter meta-data that is currently used.- Specified by:
getCallParameterMetaDatain interfaceCallMetaDataProvider- Returns:
- a List of
CallParameterMetaData
-
procedureNameToUse
Description copied from interface:CallMetaDataProviderProvide any modification of the procedure name passed in to match the meta-data currently used. This could include altering the case.- Specified by:
procedureNameToUsein interfaceCallMetaDataProvider
-
catalogNameToUse
Description copied from interface:CallMetaDataProviderProvide any modification of the catalog name passed in to match the meta-data currently used. This could include altering the case.- Specified by:
catalogNameToUsein interfaceCallMetaDataProvider
-
schemaNameToUse
Description copied from interface:CallMetaDataProviderProvide any modification of the schema name passed in to match the meta-data currently used. This could include altering the case.- Specified by:
schemaNameToUsein interfaceCallMetaDataProvider
-
metaDataCatalogNameToUse
Description copied from interface:CallMetaDataProviderProvide any modification of the catalog name passed in to match the meta-data currently used. The returned value will be used for meta-data lookups. This could include altering the case used or providing a base catalog if none is provided.- Specified by:
metaDataCatalogNameToUsein interfaceCallMetaDataProvider
-
metaDataSchemaNameToUse
Description copied from interface:CallMetaDataProviderProvide any modification of the schema name passed in to match the meta-data currently used. The returned value will be used for meta-data lookups. This could include altering the case used or providing a base schema if none is provided.- Specified by:
metaDataSchemaNameToUsein interfaceCallMetaDataProvider
-
parameterNameToUse
Description copied from interface:CallMetaDataProviderProvide any modification of the column name passed in to match the meta-data currently used. This could include altering the case.- Specified by:
parameterNameToUsein interfaceCallMetaDataProvider- Parameters:
parameterName- name of the parameter of column
-
byPassReturnParameter
Description copied from interface:CallMetaDataProviderShould we bypass the return parameter with the specified name. This allows the database specific implementation to skip the processing for specific results returned by the database call.- Specified by:
byPassReturnParameterin interfaceCallMetaDataProvider
-
createDefaultOutParameter
Description copied from interface:CallMetaDataProviderCreate a default out parameter based on the provided meta-data. This is used when no explicit parameter declaration has been made.- Specified by:
createDefaultOutParameterin interfaceCallMetaDataProvider- Parameters:
parameterName- the name of the parametermeta- meta-data used for this call- Returns:
- the configured SqlOutParameter
-
createDefaultInOutParameter
Description copied from interface:CallMetaDataProviderCreate a default in/out parameter based on the provided meta-data. This is used when no explicit parameter declaration has been made.- Specified by:
createDefaultInOutParameterin interfaceCallMetaDataProvider- Parameters:
parameterName- the name of the parametermeta- meta-data used for this call- Returns:
- the configured SqlInOutParameter
-
createDefaultInParameter
Description copied from interface:CallMetaDataProviderCreate a default in parameter based on the provided meta-data. This is used when no explicit parameter declaration has been made.- Specified by:
createDefaultInParameterin interfaceCallMetaDataProvider- Parameters:
parameterName- the name of the parametermeta- meta-data used for this call- Returns:
- the configured SqlParameter
-
getUserName
Description copied from interface:CallMetaDataProviderGet the name of the current user. Useful for meta-data lookups etc.- Specified by:
getUserNamein interfaceCallMetaDataProvider- Returns:
- current user name from database connection
-
isReturnResultSetSupported
public boolean isReturnResultSetSupported()Description copied from interface:CallMetaDataProviderDoes this database support returning ResultSets that should be retrieved with the JDBC call:Statement.getResultSet()?- Specified by:
isReturnResultSetSupportedin interfaceCallMetaDataProvider
-
isRefCursorSupported
public boolean isRefCursorSupported()Description copied from interface:CallMetaDataProviderDoes this database support returning ResultSets as ref cursors to be retrieved withCallableStatement.getObject(int)for the specified column.- Specified by:
isRefCursorSupportedin interfaceCallMetaDataProvider
-
getRefCursorSqlType
public int getRefCursorSqlType()Description copied from interface:CallMetaDataProviderGet theTypestype for columns that return ResultSets as ref cursors if this feature is supported.- Specified by:
getRefCursorSqlTypein interfaceCallMetaDataProvider
-
isProcedureColumnMetaDataUsed
public boolean isProcedureColumnMetaDataUsed()Description copied from interface:CallMetaDataProviderAre we using the meta-data for the procedure columns?- Specified by:
isProcedureColumnMetaDataUsedin interfaceCallMetaDataProvider
-
setSupportsCatalogsInProcedureCalls
protected void setSupportsCatalogsInProcedureCalls(boolean supportsCatalogsInProcedureCalls) Specify whether the database supports the use of catalog name in procedure calls. -
isSupportsCatalogsInProcedureCalls
public boolean isSupportsCatalogsInProcedureCalls()Does the database support the use of catalog name in procedure calls?- Specified by:
isSupportsCatalogsInProcedureCallsin interfaceCallMetaDataProvider
-
setSupportsSchemasInProcedureCalls
protected void setSupportsSchemasInProcedureCalls(boolean supportsSchemasInProcedureCalls) Specify whether the database supports the use of schema name in procedure calls. -
isSupportsSchemasInProcedureCalls
public boolean isSupportsSchemasInProcedureCalls()Does the database support the use of schema name in procedure calls?- Specified by:
isSupportsSchemasInProcedureCallsin interfaceCallMetaDataProvider
-
setStoresUpperCaseIdentifiers
protected void setStoresUpperCaseIdentifiers(boolean storesUpperCaseIdentifiers) Specify whether the database uses upper case for identifiers. -
isStoresUpperCaseIdentifiers
protected boolean isStoresUpperCaseIdentifiers()Does the database use upper case for identifiers? -
setStoresLowerCaseIdentifiers
protected void setStoresLowerCaseIdentifiers(boolean storesLowerCaseIdentifiers) Specify whether the database uses lower case for identifiers. -
isStoresLowerCaseIdentifiers
protected boolean isStoresLowerCaseIdentifiers()Does the database use lower case for identifiers?
-