Top Description Fields Constructors Methods
org.apache.derby.impl.sql

pack-priv final Class GenericParameter

extends Object
Class Inheritance
Imports
org.apache.derby.shared.common.reference.SQLState, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.types.DataTypeDescriptor, .DataValueDescriptor, .TypeId, java.sql.ParameterMetaData, .Types

A parameter. Originally lifted from ParameterValueSet.

Field Summary

Modifier and TypeField and Description
private static int
private static int
pack-priv String
declaredClassName

Compile time Java class name.

private final boolean
pack-priv boolean
pack-priv int
jdbcTypeId

Compile time JDBC type identifier.

pack-priv short
parameterMode

Mode of the parameter, from ParameterMetaData

private final GenericParameterValueSet
pack-priv int
registerOutPrecision

When a decimal output parameter is registered we give it a precision

pack-priv int
registerOutScale

Scale that has been registered.

pack-priv int
registerOutType

Type that has been registered.

private DataValueDescriptor
value

Our value

Constructor Summary

AccessConstructor and Description
pack-priv
GenericParameter(GenericParameterValueSet
the parameter set that this is part of
pvs
,
boolean
true if this is a return output parameter
isReturnOutputParameter
)

Constructor for a Parameter

Method Summary

Modifier and TypeMethod and Description
pack-priv void
clear()

Clear the parameter, unless it is a return output parameter

public GenericParameter

Returns:

a new generic parameter.
getClone
(GenericParameterValueSet
the parameter value set
pvs
)

Clone myself.

pack-priv String
getJDBCParameterNumberStr()

get string for param number

pack-priv int
pack-priv int

Returns:

scale
getScale
()

Return the scale of the parameter.

pack-priv DataValueDescriptor

Returns:

the parameter value, may return null
getValue
()

Get the parameter value.

pack-priv void
initialize(DataValueDescriptor value, int jdbcTypeId, String className)

Set the DataValueDescriptor and type information for this parameter

pack-priv void
setOutParameter(int
A type from java.sql.Types
sqlType
,
int
scale, -1 if no scale arg
scale
)

Mark the parameter as an output parameter.

private StandardException
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

pack-priv void
validate()

Validate the parameters.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

DECIMAL_PARAMETER_DEFAULT_PRECISIONback to summary
private static int DECIMAL_PARAMETER_DEFAULT_PRECISION
DECIMAL_PARAMETER_DEFAULT_SCALEback to summary
private static int DECIMAL_PARAMETER_DEFAULT_SCALE
declaredClassNameback to summary
pack-priv String declaredClassName

Compile time Java class name.

isReturnOutputParameterback to summary
private final boolean isReturnOutputParameter
isSetback to summary
pack-priv boolean isSet
jdbcTypeIdback to summary
pack-priv int jdbcTypeId

Compile time JDBC type identifier.

parameterModeback to summary
pack-priv short parameterMode

Mode of the parameter, from ParameterMetaData

pvsback to summary
private final GenericParameterValueSet pvs
registerOutPrecisionback to summary
pack-priv int registerOutPrecision

When a decimal output parameter is registered we give it a precision

registerOutScaleback to summary
pack-priv int registerOutScale

Scale that has been registered.

registerOutTypeback to summary
pack-priv int registerOutType

Type that has been registered.

valueback to summary
private DataValueDescriptor value

Our value

Constructor Detail

GenericParameterback to summary
pack-priv GenericParameter(GenericParameterValueSet pvs, boolean isReturnOutputParameter)

Constructor for a Parameter

Parameters
pvs:GenericParameterValueSet

the parameter set that this is part of

isReturnOutputParameter:boolean

true if this is a return output parameter

Method Detail

clearback to summary
pack-priv void clear()

Clear the parameter, unless it is a return output parameter

getCloneback to summary
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:GenericParameterValueSet

the parameter value set

Returns:GenericParameter

a new generic parameter.

getJDBCParameterNumberStrback to summary
pack-priv String getJDBCParameterNumberStr()

get string for param number

getPrecisionback to summary
pack-priv int getPrecision()
getScaleback to summary
pack-priv int getScale()

Return the scale of the parameter.

Returns:int

scale

getValueback to summary
pack-priv DataValueDescriptor getValue()

Get the parameter value. Doesn't check to see if it has been initialized or not.

Returns:DataValueDescriptor

the parameter value, may return null

initializeback to summary
pack-priv void initialize(DataValueDescriptor value, int jdbcTypeId, String className)

Set the DataValueDescriptor and type information for this parameter

setOutParameterback to summary
pack-priv void setOutParameter(int sqlType, int scale) throws StandardException

Mark the parameter as an output parameter.

Parameters
sqlType:int

A type from java.sql.Types

scale:int

scale, -1 if no scale arg

Exceptions
StandardException:
on error
throwInvalidOutParamMapback to summary
private StandardException throwInvalidOutParamMap(int sqlType)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

validateback to summary
pack-priv 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().

Exceptions
StandardException:
if the parameters aren't valid