Top Description Fields Constructors Methods
org.springframework.jdbc.object

public abstract Class SqlCall

extends RdbmsOperation
Class Inheritance
Known Direct Subclasses
org.springframework.jdbc.object.StoredProcedure
Imports
java.util.List, .Map, javax.sql.DataSource, org.springframework.jdbc.core.CallableStatementCreator, .CallableStatementCreatorFactory, .ParameterMapper, .SqlParameter, org.springframework.lang.Nullable, org.springframework.util.Assert

RdbmsOperation using a JdbcTemplate and representing an SQL-based call such as a stored procedure or a stored function.

Configures a CallableStatementCreatorFactory based on the declared parameters.

Authors
Rod Johnson, Thomas Risberg
See Also
CallableStatementCreatorFactory

Field Summary

Modifier and TypeField and Description
private CallableStatementCreatorFactory
callableStatementFactory

Object enabling us to create CallableStatementCreators efficiently, based on this class's declared parameters.

private String
callString

Call string as defined in java.sql.CallableStatement.

private boolean
function

Flag used to indicate that this call is for a function and to use the {?

private boolean
sqlReadyForUse

Flag used to indicate that the sql for this call should be used exactly as it is defined.

Inherited from org.springframework.jdbc.object.RdbmsOperation:
logger

Constructor Summary

AccessConstructor and Description
public
SqlCall()

Constructor to allow use as a JavaBean.

public
SqlCall(DataSource
the DataSource to obtain connections from
ds
,
String
the SQL to execute
sql
)

Create a new SqlCall object with SQL, but without parameters.

Method Summary

Modifier and TypeMethod and Description
protected final void
compileInternal()

Implements abstract org.springframework.jdbc.object.RdbmsOperation.compileInternal.

Overridden method to configure the CallableStatementCreatorFactory based on our declared parameters.

public String
getCallString()

Get the call string.

public boolean
isFunction()

Return whether this call is for a function.

public boolean
isSqlReadyForUse()

Return whether the SQL can be used as is.

protected CallableStatementCreator
newCallableStatementCreator(Map<String, ?>
parameters. May be null.
inParams
)

Return a CallableStatementCreator to perform an operation with these parameters.

protected CallableStatementCreator
newCallableStatementCreator(ParameterMapper
parametermapper. May not be null.
inParamMapper
)

Return a CallableStatementCreator to perform an operation with the parameters returned from this ParameterMapper.

protected void
onCompileInternal()

Hook method that subclasses may override to react to compilation.

public void
setFunction(boolean function)

Set whether this call is for a function.

public void
setSqlReadyForUse(boolean sqlReadyForUse)

Set whether the SQL can be used as is.

Inherited from org.springframework.jdbc.object.RdbmsOperation:
afterPropertiesSetallowsUnusedParameterscheckCompiledcompiledeclareParametergetDeclaredParametersgetGeneratedKeysColumnNamesgetJdbcTemplategetResultSetTypegetSqlisCompiledisReturnGeneratedKeysisUpdatableResultsresolveSqlsetDataSourcesetFetchSizesetGeneratedKeysColumnNamessetJdbcTemplatesetMaxRowssetParameterssetQueryTimeoutsetResultSetTypesetReturnGeneratedKeyssetSqlsetTypessetUpdatableResultssupportsLobParametersvalidateNamedParametersvalidateParameters

Field Detail

callableStatementFactoryback to summary
private CallableStatementCreatorFactory callableStatementFactory

Object enabling us to create CallableStatementCreators efficiently, based on this class's declared parameters.

Annotations
@Nullable
callStringback to summary
private String callString

Call string as defined in java.sql.CallableStatement. String of form {call add_invoice(?, ?, ?)} or {? = call get_invoice_count(?)} if isFunction is set to true. Updated after each parameter is added.

Annotations
@Nullable
functionback to summary
private boolean function

Flag used to indicate that this call is for a function and to use the {? = call get_invoice_count(?)} syntax.

sqlReadyForUseback to summary
private boolean sqlReadyForUse

Flag used to indicate that the sql for this call should be used exactly as it is defined. No need to add the escape syntax and parameter placeholders.

Constructor Detail

SqlCallback to summary
public SqlCall()

Constructor to allow use as a JavaBean. A DataSource, SQL and any parameters must be supplied before invoking the compile method and using this object.

See Also
setDataSource, setSql, compile
SqlCallback to summary
public SqlCall(DataSource ds, String sql)

Create a new SqlCall object with SQL, but without parameters. Must add parameters or settle with none.

Parameters
ds:DataSource

the DataSource to obtain connections from

sql:String

the SQL to execute

Method Detail

compileInternalback to summary
protected final void compileInternal()

Implements abstract org.springframework.jdbc.object.RdbmsOperation.compileInternal.

Overridden method to configure the CallableStatementCreatorFactory based on our declared parameters.

Annotations
@Override
See Also
RdbmsOperation#compileInternal()
getCallStringback to summary
public String getCallString()

Get the call string.

Annotations
@Nullable
isFunctionback to summary
public boolean isFunction()

Return whether this call is for a function.

isSqlReadyForUseback to summary
public boolean isSqlReadyForUse()

Return whether the SQL can be used as is.

newCallableStatementCreatorback to summary
protected CallableStatementCreator newCallableStatementCreator(Map<String, ?> inParams)

Return a CallableStatementCreator to perform an operation with these parameters.

Parameters
inParams:Map<String, ?>

parameters. May be null.

newCallableStatementCreatorback to summary
protected CallableStatementCreator newCallableStatementCreator(ParameterMapper inParamMapper)

Return a CallableStatementCreator to perform an operation with the parameters returned from this ParameterMapper.

Parameters
inParamMapper:ParameterMapper

parametermapper. May not be null.

onCompileInternalback to summary
protected void onCompileInternal()

Hook method that subclasses may override to react to compilation. This implementation does nothing.

setFunctionback to summary
public void setFunction(boolean function)

Set whether this call is for a function.

setSqlReadyForUseback to summary
public void setSqlReadyForUse(boolean sqlReadyForUse)

Set whether the SQL can be used as is.