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

public Class SqlParameter

extends Object
Class Inheritance
Known Direct Subclasses
org.springframework.jdbc.core.SqlParameterValue, org.springframework.jdbc.core.SqlReturnUpdateCount, org.springframework.jdbc.core.ResultSetSupportingSqlParameter
Imports
java.util.ArrayList, .List, org.springframework.lang.Nullable, org.springframework.util.Assert

Object to represent an SQL parameter definition.

Parameters may be anonymous, in which case "name" is null. However, all parameters must define an SQL type according to java.sql.Types.

Authors
Rod Johnson, Thomas Risberg, Juergen Hoeller
See Also
java.sql.Types

Field Summary

Modifier and TypeField and Description
private String
private Integer
private final int
private String

Constructor Summary

AccessConstructor and Description
public
SqlParameter(int
the SQL type of the parameter according to java.sql.Types
sqlType
)

Create a new anonymous SqlParameter, supplying the SQL type.

public
SqlParameter(int
the SQL type of the parameter according to java.sql.Types
sqlType
,
String
the type name of the parameter (optional)
typeName
)

Create a new anonymous SqlParameter, supplying the SQL type.

public
SqlParameter(int
the SQL type of the parameter according to java.sql.Types
sqlType
,
int
the number of digits after the decimal point (for DECIMAL and NUMERIC types)
scale
)

Create a new anonymous SqlParameter, supplying the SQL type.

public
SqlParameter(String
the name of the parameter, as used in input and output maps
name
,
int
the SQL type of the parameter according to java.sql.Types
sqlType
)

Create a new SqlParameter, supplying name and SQL type.

public
SqlParameter(String
the name of the parameter, as used in input and output maps
name
,
int
the SQL type of the parameter according to java.sql.Types
sqlType
,
String
the type name of the parameter (optional)
typeName
)

Create a new SqlParameter, supplying name and SQL type.

public
SqlParameter(String
the name of the parameter, as used in input and output maps
name
,
int
the SQL type of the parameter according to java.sql.Types
sqlType
,
int
the number of digits after the decimal point (for DECIMAL and NUMERIC types)
scale
)

Create a new SqlParameter, supplying name and SQL type.

public
SqlParameter(SqlParameter
the SqlParameter object to copy from
otherParam
)

Copy constructor.

Method Summary

Modifier and TypeMethod and Description
public String
getName()

Return the name of the parameter, or null if anonymous.

public Integer
getScale()

Return the scale of the parameter, if any.

public int
getSqlType()

Return the SQL type of the parameter.

public String
getTypeName()

Return the type name of the parameter, if any.

public boolean
isInputValueProvided()

Return whether this parameter holds input values that should be set before execution even if they are null.

public boolean
isResultsParameter()

Return whether this parameter is an implicit return parameter used during the results processing of CallableStatement.getMoreResults/getUpdateCount.

public static List<SqlParameter>
sqlTypesToAnonymousParameterList(int... types)

Convert a list of JDBC types, as defined in java.sql.Types, to a List of SqlParameter objects as used in this package.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

nameback to summary
private String name
Annotations
@Nullable
scaleback to summary
private Integer scale
Annotations
@Nullable
sqlTypeback to summary
private final int sqlType
typeNameback to summary
private String typeName
Annotations
@Nullable

Constructor Detail

SqlParameterback to summary
public SqlParameter(int sqlType)

Create a new anonymous SqlParameter, supplying the SQL type.

Parameters
sqlType:int

the SQL type of the parameter according to java.sql.Types

SqlParameterback to summary
public SqlParameter(int sqlType, String typeName)

Create a new anonymous SqlParameter, supplying the SQL type.

Parameters
sqlType:int

the SQL type of the parameter according to java.sql.Types

typeName:String

the type name of the parameter (optional)

SqlParameterback to summary
public SqlParameter(int sqlType, int scale)

Create a new anonymous SqlParameter, supplying the SQL type.

Parameters
sqlType:int

the SQL type of the parameter according to java.sql.Types

scale:int

the number of digits after the decimal point (for DECIMAL and NUMERIC types)

SqlParameterback to summary
public SqlParameter(String name, int sqlType)

Create a new SqlParameter, supplying name and SQL type.

Parameters
name:String

the name of the parameter, as used in input and output maps

sqlType:int

the SQL type of the parameter according to java.sql.Types

SqlParameterback to summary
public SqlParameter(String name, int sqlType, String typeName)

Create a new SqlParameter, supplying name and SQL type.

Parameters
name:String

the name of the parameter, as used in input and output maps

sqlType:int

the SQL type of the parameter according to java.sql.Types

typeName:String

the type name of the parameter (optional)

SqlParameterback to summary
public SqlParameter(String name, int sqlType, int scale)

Create a new SqlParameter, supplying name and SQL type.

Parameters
name:String

the name of the parameter, as used in input and output maps

sqlType:int

the SQL type of the parameter according to java.sql.Types

scale:int

the number of digits after the decimal point (for DECIMAL and NUMERIC types)

SqlParameterback to summary
public SqlParameter(SqlParameter otherParam)

Copy constructor.

Parameters
otherParam:SqlParameter

the SqlParameter object to copy from

Method Detail

getNameback to summary
public String getName()

Return the name of the parameter, or null if anonymous.

Annotations
@Nullable
getScaleback to summary
public Integer getScale()

Return the scale of the parameter, if any.

Annotations
@Nullable
getSqlTypeback to summary
public int getSqlType()

Return the SQL type of the parameter.

getTypeNameback to summary
public String getTypeName()

Return the type name of the parameter, if any.

Annotations
@Nullable
isInputValueProvidedback to summary
public boolean isInputValueProvided()

Return whether this parameter holds input values that should be set before execution even if they are null.

This implementation always returns true.

isResultsParameterback to summary
public boolean isResultsParameter()

Return whether this parameter is an implicit return parameter used during the results processing of CallableStatement.getMoreResults/getUpdateCount.

This implementation always returns false.

sqlTypesToAnonymousParameterListback to summary
public static List<SqlParameter> sqlTypesToAnonymousParameterList(int... types)

Convert a list of JDBC types, as defined in java.sql.Types, to a List of SqlParameter objects as used in this package.