Package org.apache.derby.impl.sql
Class GenericParameter
- java.lang.Object
-
- org.apache.derby.impl.sql.GenericParameter
-
final class GenericParameter extends java.lang.Object
A parameter. Originally lifted from ParameterValueSet.
-
-
Field Summary
Fields Modifier and Type Field Description private static int
DECIMAL_PARAMETER_DEFAULT_PRECISION
private static int
DECIMAL_PARAMETER_DEFAULT_SCALE
(package private) java.lang.String
declaredClassName
Compile time Java class name.private boolean
isReturnOutputParameter
(package private) boolean
isSet
(package private) int
jdbcTypeId
Compile time JDBC type identifier.(package private) short
parameterMode
Mode of the parameter, from ParameterMetaDataprivate GenericParameterValueSet
pvs
(package private) int
registerOutPrecision
When a decimal output parameter is registered we give it a precision(package private) int
registerOutScale
Scale that has been registered.(package private) int
registerOutType
Type that has been registered.private DataValueDescriptor
value
Our value
-
Constructor Summary
Constructors Constructor Description GenericParameter(GenericParameterValueSet pvs, boolean isReturnOutputParameter)
Constructor for a Parameter
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
clear()
Clear the parameter, unless it is a return output parameterGenericParameter
getClone(GenericParameterValueSet pvs)
Clone myself.(package private) java.lang.String
getJDBCParameterNumberStr()
get string for param number(package private) int
getPrecision()
(package private) int
getScale()
Return the scale of the parameter.(package private) DataValueDescriptor
getValue()
Get the parameter value.(package private) void
initialize(DataValueDescriptor value, int jdbcTypeId, java.lang.String className)
Set the DataValueDescriptor and type information for this parameter(package private) void
setOutParameter(int sqlType, int scale)
Mark the parameter as an output parameter.private StandardException
throwInvalidOutParamMap(int sqlType)
java.lang.String
toString()
(package private) void
validate()
Validate the parameters.
-
-
-
Field Detail
-
DECIMAL_PARAMETER_DEFAULT_PRECISION
private static int DECIMAL_PARAMETER_DEFAULT_PRECISION
-
DECIMAL_PARAMETER_DEFAULT_SCALE
private static int DECIMAL_PARAMETER_DEFAULT_SCALE
-
pvs
private final GenericParameterValueSet pvs
-
value
private DataValueDescriptor value
Our value
-
jdbcTypeId
int jdbcTypeId
Compile time JDBC type identifier.
-
declaredClassName
java.lang.String declaredClassName
Compile time Java class name.
-
parameterMode
short parameterMode
Mode of the parameter, from ParameterMetaData
-
isSet
boolean isSet
-
isReturnOutputParameter
private final boolean isReturnOutputParameter
-
registerOutType
int registerOutType
Type that has been registered.
-
registerOutScale
int registerOutScale
Scale that has been registered.
-
registerOutPrecision
int registerOutPrecision
When a decimal output parameter is registered we give it a precision
-
-
Constructor Detail
-
GenericParameter
GenericParameter(GenericParameterValueSet pvs, boolean isReturnOutputParameter)
Constructor for a Parameter- Parameters:
pvs
- the parameter set that this is part ofisReturnOutputParameter
- true if this is a return output parameter
-
-
Method Detail
-
getClone
public GenericParameter getClone(GenericParameterValueSet pvs)
Clone myself. It is a shallow copy for everything but the underlying data wrapper and its value -- e.g. for everything but the underlying SQLInt and its int.- Parameters:
pvs
- the parameter value set- Returns:
- a new generic parameter.
-
initialize
void initialize(DataValueDescriptor value, int jdbcTypeId, java.lang.String className)
Set the DataValueDescriptor and type information for this parameter
-
clear
void clear()
Clear the parameter, unless it is a return output parameter
-
getValue
DataValueDescriptor getValue()
Get the parameter value. Doesn't check to see if it has been initialized or not.- Returns:
- the parameter value, may return null
-
setOutParameter
void setOutParameter(int sqlType, int scale) throws StandardException
Mark the parameter as an output parameter.- Parameters:
sqlType
- A type from java.sql.Typesscale
- scale, -1 if no scale arg- Throws:
StandardException
- on error
-
throwInvalidOutParamMap
private StandardException throwInvalidOutParamMap(int sqlType)
-
validate
void validate() throws StandardException
Validate the parameters. This is done for situations where we cannot validate everything in the setXXX() calls. In particular, before we do an execute() on a CallableStatement, we need to go through the parameters and make sure that all parameters are set up properly. The motivator for this is that setXXX() can be called either before or after registerOutputParamter(), we cannot be sure we have the types correct until we get to execute().- Throws:
StandardException
- if the parameters aren't valid
-
getScale
int getScale()
Return the scale of the parameter.- Returns:
- scale
-
getPrecision
int getPrecision()
-
getJDBCParameterNumberStr
java.lang.String getJDBCParameterNumberStr()
get string for param number
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-