Class CallMetaDataContext
java.lang.Object
org.springframework.jdbc.core.metadata.CallMetaDataContext
Class to manage context meta-data used for the configuration
and execution of a stored procedure call.
- Since:
- 2.5
- Author:
- Thomas Risberg, Juergen Hoeller, Kiril Nugmanov
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionBuild the call string based on configuration and meta-data information.protected String
createParameterBinding
(SqlParameter parameter) Build the parameter binding fragment.createReturnResultSetParameter
(String parameterName, RowMapper<?> rowMapper) Create a ReturnResultSetParameter/SqlOutParameter depending on the support provided by the JDBC driver used for the database in use.Get the List of SqlParameter objects to be used in call execution.Get the name of the catalog.Get the name used for the return value of the function.Get a limited set of in parameters to be used.Get a list of the out parameter names.Get the name of the procedure.Get the name of the single out parameter for this call.Get the name of the schema.void
initializeMetaData
(DataSource dataSource) Initialize this class with meta-data from the database.boolean
Check whether call parameter meta-data should be accessed.boolean
Check whether this call is a function call.boolean
Check whether parameters should be bound by name.boolean
Check whether a return value is required.matchInParameterValuesWithCallParameters
(Object[] parameterValues) matchInParameterValuesWithCallParameters
(Map<String, ?> inParameters) Match input parameter values with the parameters declared to be used in the call.matchInParameterValuesWithCallParameters
(SqlParameterSource parameterSource) Match input parameter values with the parameters declared to be used in the call.void
processParameters
(List<SqlParameter> parameters) Process the list of parameters provided, and if procedure column meta-data is used, the parameters will be matched against the meta-data information and any missing ones will be automatically included.protected List<SqlParameter>
reconcileParameters
(List<SqlParameter> parameters) Reconcile the provided parameters with available meta-data and add new ones where appropriate.void
setAccessCallParameterMetaData
(boolean accessCallParameterMetaData) Specify whether call parameter meta-data should be accessed.void
setCatalogName
(String catalogName) Specify the name of the catalog.void
setFunction
(boolean function) Specify whether this call is a function call.void
setFunctionReturnName
(String functionReturnName) Specify the name used for the return value of the function.void
setLimitedInParameterNames
(Set<String> limitedInParameterNames) Specify a limited set of in parameters to be used.void
setNamedBinding
(boolean namedBinding) Specify whether parameters should be bound by name.void
setOutParameterNames
(List<String> outParameterNames) Specify the names of the out parameters.void
setProcedureName
(String procedureName) Specify the name of the procedure.void
setReturnValueRequired
(boolean returnValueRequired) Specify whether a return value is required.void
setSchemaName
(String schemaName) Specify the name of the schema.
-
Field Details
-
logger
-
-
Constructor Details
-
CallMetaDataContext
public CallMetaDataContext()
-
-
Method Details
-
setFunctionReturnName
Specify the name used for the return value of the function. -
getFunctionReturnName
Get the name used for the return value of the function. -
setLimitedInParameterNames
Specify a limited set of in parameters to be used. -
getLimitedInParameterNames
Get a limited set of in parameters to be used. -
setOutParameterNames
Specify the names of the out parameters. -
getOutParameterNames
Get a list of the out parameter names. -
setProcedureName
Specify the name of the procedure. -
getProcedureName
Get the name of the procedure. -
setCatalogName
Specify the name of the catalog. -
getCatalogName
Get the name of the catalog. -
setSchemaName
Specify the name of the schema. -
getSchemaName
Get the name of the schema. -
setFunction
public void setFunction(boolean function) Specify whether this call is a function call. -
isFunction
public boolean isFunction()Check whether this call is a function call. -
setReturnValueRequired
public void setReturnValueRequired(boolean returnValueRequired) Specify whether a return value is required. -
isReturnValueRequired
public boolean isReturnValueRequired()Check whether a return value is required. -
setAccessCallParameterMetaData
public void setAccessCallParameterMetaData(boolean accessCallParameterMetaData) Specify whether call parameter meta-data should be accessed. -
isAccessCallParameterMetaData
public boolean isAccessCallParameterMetaData()Check whether call parameter meta-data should be accessed. -
setNamedBinding
public void setNamedBinding(boolean namedBinding) Specify whether parameters should be bound by name.- Since:
- 4.2
-
isNamedBinding
public boolean isNamedBinding()Check whether parameters should be bound by name.- Since:
- 4.2
-
initializeMetaData
Initialize this class with meta-data from the database.- Parameters:
dataSource
- the DataSource used to retrieve meta-data
-
createReturnResultSetParameter
Create a ReturnResultSetParameter/SqlOutParameter depending on the support provided by the JDBC driver used for the database in use.- Parameters:
parameterName
- the name of the parameter (also used as the name of the List returned in the output)rowMapper
- a RowMapper implementation used to map the data returned in the result set- Returns:
- the appropriate SqlParameter
-
getScalarOutParameterName
Get the name of the single out parameter for this call. If there are multiple parameters, the name of the first one will be returned. -
getCallParameters
Get the List of SqlParameter objects to be used in call execution. -
processParameters
Process the list of parameters provided, and if procedure column meta-data is used, the parameters will be matched against the meta-data information and any missing ones will be automatically included.- Parameters:
parameters
- the list of parameters to use as a base
-
reconcileParameters
Reconcile the provided parameters with available meta-data and add new ones where appropriate. -
matchInParameterValuesWithCallParameters
public Map<String,Object> matchInParameterValuesWithCallParameters(SqlParameterSource parameterSource) Match input parameter values with the parameters declared to be used in the call.- Parameters:
parameterSource
- the input values- Returns:
- a Map containing the matched parameter names with the value taken from the input
-
matchInParameterValuesWithCallParameters
Match input parameter values with the parameters declared to be used in the call.- Parameters:
inParameters
- the input values- Returns:
- a Map containing the matched parameter names with the value taken from the input
-
matchInParameterValuesWithCallParameters
-
createCallString
Build the call string based on configuration and meta-data information.- Returns:
- the call string to be used
-
createParameterBinding
Build the parameter binding fragment.- Parameters:
parameter
- call parameter- Returns:
- parameter binding fragment
- Since:
- 4.2
-