Top Description Methods
org.apache.derby.iapi.sql

public Interface ParameterValueSet

Known Direct Implementers
org.apache.derby.impl.sql.GenericParameterValueSet
Imports
org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.types.DataTypeDescriptor, .DataValueDescriptor

A ParameterValueSet is a set of parameter values that can be assembled by a JDBC driver and passed to a PreparedStatement all at once. The fact that they are all passed at once can reduce the communication overhead between client and server.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if all parameters are set, false if at least one parameter is not set.
allAreSet
()

Tells whether all the parameters are set and ready for execution.

public boolean

Returns:

true if a declared Java Procedure INOUT or OUT parameter is in the set, false otherwise.
checkNoDeclaredOutputParameters
()

Check that there are not output parameters defined by the parameter set.

public void
clearParameters()

Sets all parameters to an uninitialized state.

public ParameterValueSet

Returns:

ParameterValueSet A clone of the ParameterValueSet and its contents.
getClone
()

Clone the ParameterValueSet and its contents.

public DataValueDescriptor

Returns:

The parameter at the given position.
getParameter
(int
The parameters's position in the set
position
)

Returns the parameter at the given position.

public int

Returns:

The number of parameters in this set.
getParameterCount
()

Returns the number of parameters in this set.

public DataValueDescriptor

Returns:

Parameter's value holder.
getParameterForGet
(int
Zero based index of the parameter.
position
)

Get the DataValueDescriptor for an INOUT or OUT parameter.

public DataValueDescriptor

Returns:

The parameter at the given position.
getParameterForSet
(int
The parameters's position in the set
position
)

Returns the parameter at the given position in order to set it.

public short

Returns:

the IN/OUT mode of the parameter
getParameterMode
(int
the first parameter is 1, the second is 2, ...
parameterIndex
)

Return the mode of the parameter according to JDBC 3.0 ParameterMetaData

public int

Returns:

precision
getPrecision
(int
the first parameter is 1, the second is 2, ...
parameterIndex
)

Return the precision of the given parameter index in this pvs.

public DataValueDescriptor

Returns:

the return parameter
getReturnValueForSet
()

Get the value of the return parameter in order to set it.

public int

Returns:

scale
getScale
(int
the first parameter is 1, the second is 2, ...
parameterIndex
)

Return the scale of the given parameter index in this pvs.

public boolean

Returns:

true if it has a return parameter
hasReturnOutputParameter
()

Is there a return output parameter in this pvs.

public void
initialize(DataTypeDescriptor[]
expected to match the number of parameters.
types
)

Initialize the parameter set by allocating DataValueDescriptor corresponding to the passed in type for each parameter.

public void
registerOutParameter(int
The ordinal position of a parameter to set to the given value.
parameterIndex
,
int
A type from java.sql.Types
sqlType
,
int
the scale to use. -1 means ignore scale
scale
)

Mark the parameter as an output parameter.

public void
setParameterAsObject(int
The position of the parameter
parameterIndex
,
Object
It's value
value
)

Set the value of this user defined parameter to the passed in Object.

public void
setParameterMode(int
The position of the parameter in the set
position
,
int
The IN/OUT mode to set
mode
)

Set the mode of the parameter, called when setting up static method calls and stored procedures.

public void
transferDataValues(ParameterValueSet
ParameterValueSet which will recieve the values
pvstarget
)

Set the parameter values of the pvstarget to equal those set in this PVS.

public void
validate()

Validate the parameters.

Method Detail

allAreSetback to summary
public boolean allAreSet()

Tells whether all the parameters are set and ready for execution. OUT are not required to be set.

Returns:boolean

true if all parameters are set, false if at least one parameter is not set.

checkNoDeclaredOutputParametersback to summary
public boolean checkNoDeclaredOutputParameters()

Check that there are not output parameters defined by the parameter set. If there are unknown parameter types they are forced to input types. i.e. Derby static method calls with parameters that are array.

Returns:boolean

true if a declared Java Procedure INOUT or OUT parameter is in the set, false otherwise.

clearParametersback to summary
public void clearParameters()

Sets all parameters to an uninitialized state. An exception will be thrown if the caller tries to execute a PreparedStatement when one or more parameters is uninitialized (i.e. has not had setParameterValue() called on it.

getCloneback to summary
public ParameterValueSet getClone()

Clone the ParameterValueSet and its contents.

Returns:ParameterValueSet

ParameterValueSet A clone of the ParameterValueSet and its contents.

getParameterback to summary
public DataValueDescriptor getParameter(int position) throws StandardException

Returns the parameter at the given position.

Parameters
position:int

The parameters's position in the set

Returns:DataValueDescriptor

The parameter at the given position.

Exceptions
StandardException:
Thrown on error
getParameterCountback to summary
public int getParameterCount()

Returns the number of parameters in this set.

Returns:int

The number of parameters in this set.

getParameterForGetback to summary
public DataValueDescriptor getParameterForGet(int position) throws StandardException

Get the DataValueDescriptor for an INOUT or OUT parameter.

Parameters
position:int

Zero based index of the parameter.

Returns:DataValueDescriptor

Parameter's value holder.

Exceptions
StandardException:
Position out of range or the parameter is not INOUT or OUT.
getParameterForSetback to summary
public DataValueDescriptor getParameterForSet(int position) throws StandardException

Returns the parameter at the given position in order to set it. Setting via an unknown object type must use setParameterAsObject() to ensure correct typing.

Parameters
position:int

The parameters's position in the set

Returns:DataValueDescriptor

The parameter at the given position.

Exceptions
StandardException:
Thrown on error
getParameterModeback to summary
public short getParameterMode(int parameterIndex)

Return the mode of the parameter according to JDBC 3.0 ParameterMetaData

Parameters
parameterIndex:int

the first parameter is 1, the second is 2, ...

Returns:short

the IN/OUT mode of the parameter

getPrecisionback to summary
public int getPrecision(int parameterIndex)

Return the precision of the given parameter index in this pvs.

Parameters
parameterIndex:int

the first parameter is 1, the second is 2, ...

Returns:int

precision

getReturnValueForSetback to summary
public DataValueDescriptor getReturnValueForSet() throws StandardException

Get the value of the return parameter in order to set it.

Returns:DataValueDescriptor

the return parameter

Exceptions
StandardException:
if a database-access error occurs.
getScaleback to summary
public int getScale(int parameterIndex)

Return the scale of the given parameter index in this pvs.

Parameters
parameterIndex:int

the first parameter is 1, the second is 2, ...

Returns:int

scale

hasReturnOutputParameterback to summary
public boolean hasReturnOutputParameter()

Is there a return output parameter in this pvs. A return parameter is from a CALL statement of the following syntax: ? = CALL myMethod(). Note that a return output parameter is NOT the same thing as an output parameter; it is a special type of output parameter.

Returns:boolean

true if it has a return parameter

initializeback to summary
public void initialize(DataTypeDescriptor[] types) throws StandardException

Initialize the parameter set by allocating DataValueDescriptor corresponding to the passed in type for each parameter.

Parameters
types:DataTypeDescriptor[]

expected to match the number of parameters.

Exceptions
StandardException:
on error
registerOutParameterback to summary
public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws StandardException

Mark the parameter as an output parameter.

Parameters
parameterIndex:int

The ordinal position of a parameter to set to the given value.

sqlType:int

A type from java.sql.Types

scale:int

the scale to use. -1 means ignore scale

Exceptions
StandardException:
on error
setParameterAsObjectback to summary
public void setParameterAsObject(int parameterIndex, Object value) throws StandardException

Set the value of this user defined parameter to the passed in Object.

Parameters
parameterIndex:int

The position of the parameter

value:Object

It's value

Exceptions
StandardException:
Thrown on error
setParameterModeback to summary
public void setParameterMode(int position, int mode)

Set the mode of the parameter, called when setting up static method calls and stored procedures. Otherwise the parameter type will default to an IN parameter.

Parameters
position:int

The position of the parameter in the set

mode:int

The IN/OUT mode to set

transferDataValuesback to summary
public void transferDataValues(ParameterValueSet pvstarget) throws StandardException

Set the parameter values of the pvstarget to equal those set in this PVS. Used to transfer saved SPS parameters to the actual prepared statement parameters once associated parameters have been established. Assumes pvstarget is the same length as this.

Parameters
pvstarget:ParameterValueSet

ParameterValueSet which will recieve the values

Exceptions
StandardException:
values not compatible
validateback to summary
public 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