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

public class GenericCallMetaDataProvider extends Object implements CallMetaDataProvider
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, Stephane Nicoll
  • Field Details

    • logger

      protected static final Log logger
      Logger available to subclasses.
  • Constructor Details

    • GenericCallMetaDataProvider

      protected GenericCallMetaDataProvider(DatabaseMetaData databaseMetaData) throws SQLException
      Constructor used to initialize with provided database meta-data.
      Parameters:
      databaseMetaData - meta-data to be used
      Throws:
      SQLException
  • Method Details

    • initializeWithMetaData

      public void initializeWithMetaData(DatabaseMetaData databaseMetaData) throws SQLException
      Description copied from interface: CallMetaDataProvider
      Initialize using the provided DatabaseMetData.
      Specified by:
      initializeWithMetaData in interface CallMetaDataProvider
      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: CallMetaDataProvider
      Initialize 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:
      initializeWithProcedureColumnMetaData in interface CallMetaDataProvider
      Parameters:
      databaseMetaData - used to retrieve database specific information
      catalogName - name of catalog to use (or null if none)
      schemaName - name of schema name to use (or null if none)
      procedureName - name of the stored procedure
      Throws:
      SQLException - in case of initialization failure
      See Also:
    • getCallParameterMetaData

      public List<CallParameterMetaData> getCallParameterMetaData()
      Description copied from interface: CallMetaDataProvider
      Get the call parameter meta-data that is currently used.
      Specified by:
      getCallParameterMetaData in interface CallMetaDataProvider
      Returns:
      a List of CallParameterMetaData
    • procedureNameToUse

      @Nullable public String procedureNameToUse(@Nullable String procedureName)
      Description copied from interface: CallMetaDataProvider
      Provide any modification of the procedure name passed in to match the meta-data currently used.

      This could include altering the case.

      Specified by:
      procedureNameToUse in interface CallMetaDataProvider
    • catalogNameToUse

      @Nullable public String catalogNameToUse(@Nullable String catalogName)
      Description copied from interface: CallMetaDataProvider
      Provide any modification of the catalog name passed in to match the meta-data currently used.

      This could include altering the case.

      Specified by:
      catalogNameToUse in interface CallMetaDataProvider
    • schemaNameToUse

      @Nullable public String schemaNameToUse(@Nullable String schemaName)
      Description copied from interface: CallMetaDataProvider
      Provide any modification of the schema name passed in to match the meta-data currently used.

      This could include altering the case.

      Specified by:
      schemaNameToUse in interface CallMetaDataProvider
    • metaDataCatalogNameToUse

      @Nullable public String metaDataCatalogNameToUse(@Nullable String catalogName)
      Description copied from interface: CallMetaDataProvider
      Provide 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:
      metaDataCatalogNameToUse in interface CallMetaDataProvider
    • metaDataSchemaNameToUse

      @Nullable public String metaDataSchemaNameToUse(@Nullable String schemaName)
      Description copied from interface: CallMetaDataProvider
      Provide 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:
      metaDataSchemaNameToUse in interface CallMetaDataProvider
    • parameterNameToUse

      @Nullable public String parameterNameToUse(@Nullable String parameterName)
      Description copied from interface: CallMetaDataProvider
      Provide any modification of the column name passed in to match the meta-data currently used.

      This could include altering the case.

      Specified by:
      parameterNameToUse in interface CallMetaDataProvider
      Parameters:
      parameterName - name of the parameter of column
    • namedParameterBindingToUse

      public String namedParameterBindingToUse(@Nullable String parameterName)
      Description copied from interface: CallMetaDataProvider
      Return the name of the named parameter to use for binding the given parameter name.
      Specified by:
      namedParameterBindingToUse in interface CallMetaDataProvider
      Parameters:
      parameterName - the name of the parameter to bind
      Returns:
      the name of the named parameter to use for binding the given parameter name
    • createDefaultOutParameter

      public SqlParameter createDefaultOutParameter(String parameterName, CallParameterMetaData meta)
      Description copied from interface: CallMetaDataProvider
      Create a default out parameter based on the provided meta-data.

      This is used when no explicit parameter declaration has been made.

      Specified by:
      createDefaultOutParameter in interface CallMetaDataProvider
      Parameters:
      parameterName - the name of the parameter
      meta - meta-data used for this call
      Returns:
      the configured SqlOutParameter
    • createDefaultInOutParameter

      public SqlParameter createDefaultInOutParameter(String parameterName, CallParameterMetaData meta)
      Description copied from interface: CallMetaDataProvider
      Create a default in/out parameter based on the provided meta-data.

      This is used when no explicit parameter declaration has been made.

      Specified by:
      createDefaultInOutParameter in interface CallMetaDataProvider
      Parameters:
      parameterName - the name of the parameter
      meta - meta-data used for this call
      Returns:
      the configured SqlInOutParameter
    • createDefaultInParameter

      public SqlParameter createDefaultInParameter(String parameterName, CallParameterMetaData meta)
      Description copied from interface: CallMetaDataProvider
      Create a default in parameter based on the provided meta-data.

      This is used when no explicit parameter declaration has been made.

      Specified by:
      createDefaultInParameter in interface CallMetaDataProvider
      Parameters:
      parameterName - the name of the parameter
      meta - meta-data used for this call
      Returns:
      the configured SqlParameter
    • getUserName

      public String getUserName()
      Description copied from interface: CallMetaDataProvider
      Get the name of the current user. Useful for meta-data lookups etc.
      Specified by:
      getUserName in interface CallMetaDataProvider
      Returns:
      current user name from database connection
    • isProcedureColumnMetaDataUsed

      public boolean isProcedureColumnMetaDataUsed()
      Description copied from interface: CallMetaDataProvider
      Are we using the meta-data for the procedure columns?
      Specified by:
      isProcedureColumnMetaDataUsed in interface CallMetaDataProvider
    • isReturnResultSetSupported

      public boolean isReturnResultSetSupported()
      Description copied from interface: CallMetaDataProvider
      Does this database support returning ResultSets that should be retrieved with the JDBC call: Statement.getResultSet()?
      Specified by:
      isReturnResultSetSupported in interface CallMetaDataProvider
    • isRefCursorSupported

      public boolean isRefCursorSupported()
      Description copied from interface: CallMetaDataProvider
      Does this database support returning ResultSets as ref cursors to be retrieved with CallableStatement.getObject(int) for the specified column?
      Specified by:
      isRefCursorSupported in interface CallMetaDataProvider
    • getRefCursorSqlType

      public int getRefCursorSqlType()
      Description copied from interface: CallMetaDataProvider
      Get the Types type for columns that return ResultSets as ref cursors if this feature is supported.
      Specified by:
      getRefCursorSqlType in interface CallMetaDataProvider
    • byPassReturnParameter

      public boolean byPassReturnParameter(String parameterName)
      Description copied from interface: CallMetaDataProvider
      Should 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:
      byPassReturnParameter in interface CallMetaDataProvider
    • 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:
      isSupportsCatalogsInProcedureCalls in interface CallMetaDataProvider
    • 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:
      isSupportsSchemasInProcedureCalls in interface CallMetaDataProvider
    • 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?