public class SqlParameter
extends java.lang.Object
Parameters may be anonymous, in which case "name" is null
.
However, all parameters must define a SQL type according to Types
.
Types
Constructor and Description |
---|
SqlParameter(int sqlType)
Create a new anonymous SqlParameter, supplying the SQL type.
|
SqlParameter(int sqlType,
int scale)
Create a new anonymous SqlParameter, supplying the SQL type.
|
SqlParameter(int sqlType,
java.lang.String typeName)
Create a new anonymous SqlParameter, supplying the SQL type.
|
SqlParameter(SqlParameter otherParam)
Copy constructor.
|
SqlParameter(java.lang.String name,
int sqlType)
Create a new SqlParameter, supplying name and SQL type.
|
SqlParameter(java.lang.String name,
int sqlType,
int scale)
Create a new SqlParameter, supplying name and SQL type.
|
SqlParameter(java.lang.String name,
int sqlType,
java.lang.String typeName)
Create a new SqlParameter, supplying name and SQL type.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getName()
Return the name of the parameter, or
null if anonymous. |
java.lang.Integer |
getScale()
Return the scale of the parameter, if any.
|
int |
getSqlType()
Return the SQL type of the parameter.
|
java.lang.String |
getTypeName()
Return the type name of the parameter, if any.
|
boolean |
isInputValueProvided()
Return whether this parameter holds input values that should be set
before execution even if they are
null . |
boolean |
isResultsParameter()
Return whether this parameter is an implicit return parameter used during the
results preocessing of the CallableStatement.getMoreResults/getUpdateCount.
|
static java.util.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. |
public SqlParameter(int sqlType)
sqlType
- SQL type of the parameter according to java.sql.Types
public SqlParameter(int sqlType, java.lang.String typeName)
sqlType
- SQL type of the parameter according to java.sql.Types
typeName
- the type name of the parameter (optional)public SqlParameter(int sqlType, int scale)
sqlType
- SQL type of the parameter according to java.sql.Types
scale
- the number of digits after the decimal point
(for DECIMAL and NUMERIC types)public SqlParameter(java.lang.String name, int sqlType)
name
- name of the parameter, as used in input and output mapssqlType
- SQL type of the parameter according to java.sql.Types
public SqlParameter(java.lang.String name, int sqlType, java.lang.String typeName)
name
- name of the parameter, as used in input and output mapssqlType
- SQL type of the parameter according to java.sql.Types
typeName
- the type name of the parameter (optional)public SqlParameter(java.lang.String name, int sqlType, int scale)
name
- name of the parameter, as used in input and output mapssqlType
- SQL type of the parameter according to java.sql.Types
scale
- the number of digits after the decimal point
(for DECIMAL and NUMERIC types)public SqlParameter(SqlParameter otherParam)
otherParam
- the SqlParameter object to copy frompublic java.lang.String getName()
null
if anonymous.public int getSqlType()
public java.lang.String getTypeName()
public java.lang.Integer getScale()
public boolean isInputValueProvided()
null
.
This implementation always returns true
.
public boolean isResultsParameter()
This implementation always returns false
.
public static java.util.List<SqlParameter> sqlTypesToAnonymousParameterList(int... types)
java.sql.Types
,
to a List of SqlParameter objects as used in this package.