Class Hierarchy All Classes All Fields and Methods

 

Class com.ibm.db.beans.DBParameterMetaData

java.lang.Object
        com.ibm.db.beans.DBParameterMetaData

public class DBParameterMetaData
implements Serializable
extends Object

This class allows you to get and set meta-data about the parameters for a DBSelect, DBProcedureCall, or DBModify bean.

You must describe and set any parameters before actually executing a statement.

There is no public constructor for DBParameterMetaData. A DBStatement is created with a DBParameterMetaData, which you can get with getParameterMetaData().

Convenience methods are provided that allow you specify multiple characteristics at once for a parameter not previously described. (setParameter) Or you can just call individual methods to set one characteristic of a parameter at a time. You can use these same more granular methods to change a description you have previously provided. You can describe parameters in any order. The position of the parameter in the result set is determined by the index used to call the methods that describe it.

Method Index
Method Description
void clear() Clears the descriptions of all parameters for this statement.
Class getParameterClass(int) Gets the Java class to be used when getting or setting values for the parameter at the specified position.
int getParameterCount() Gets the number of parameters in the SQL statement.
int getParameterMode(int) Gets the mode of the parameter at the specified position.
String getParameterName(int) Gets the name of the parameter at the specified position.
int getParameterNumber(String) Gets the number of a parameter based on its name.
int getParameterScale(int) Gets the number of digits to the right of the decimal point.
int getParameterType(int) Gets the SQL type of the parameter at the specified position.
DBStatement getStatement() Gets the DBStatement object that this object describes.
void setParameter(int, String, int, int, Class) Add the definition of a new parameter to this bean.
void setParameterClass(int, Class) Sets the Java class to be used when getting or setting values for this parameter.
void setParameterMode(int, int) Sets the mode of the parameter at the specified position.
void setParameterName(int, String) Sets the name of the parameter at the specified position.
void setParameterScale(int, int) Sets the number of digits to the right of the decimal point for this parameter.
void setParameterType(int, int) Sets the SQL type of the parameter at the specified position.

 

Methods

 

clear

public void clear() 

Clears the descriptions of all parameters for this statement.

 

getParameterClass

public Class getParameterClass(int position) throws DBException

Gets the Java class to be used when getting or setting values for the parameter at the specified position. The position of the first parameter is 1.

 

getParameterCount

public int getParameterCount() 

Gets the number of parameters in the SQL statement. If information has been specified sparsely (for only some parameters) in this bean, the value returned is the number of the last parameter for which information has been specified.

 

getParameterMode

public int getParameterMode(int position) throws DBException

Gets the mode of the parameter at the specified position. The position of the first parameter is 1. Modes are identified using constants defined in DatabaseMetaData, including: procedureColumnIn, procedureColumnInOut, procedureColumnOut, and procedureColumnResult.

 

getParameterName

public String getParameterName(int position) throws DBException

Gets the name of the parameter at the specified position. The position of the first parameter is 1.

This bean allows you to specify names for parameters, and methods of DBSelect, DBModify, and DBProcedureCall can access parameters by these names. Each parameter name is guaranteed to be unique within this bean.

Your SQL statement can be written using '?' to represent a parameter, or using a host variable syntax like ':myParamName'.

 

getParameterNumber

public int getParameterNumber(String name) throws DBException

Gets the number of a parameter based on its name. The number of the first parameter is 1.

 

getParameterScale

public int getParameterScale(int position) throws DBException

Gets the number of digits to the right of the decimal point. The index of the first column is 1. This value is only used for parameters whose SQL type is decimal.

 

getParameterType

public int getParameterType(int position) throws DBException

Gets the SQL type of the parameter at the specified position. The position of the first parameter is 1.

 

getStatement

public DBStatement getStatement() 

Gets the DBStatement object that this object describes.

The statement property of this object is read-only. This object is created by the DBStatement it describes, and remains associated with that statement for its lifetime.

 

setParameter

public synchronized void setParameter(int position,
                                      String name,
                                      int mode,
                                      int sqlType,
                                      Class aClass) throws DBException

Add the definition of a new parameter to this bean. This is a convenience method that allows you specify multiple characteristics of the parameter at once rather than separately calling several other methods to set them.

When you call this method, there must be no parameter currently defined in the position you specify. The index of the first parameter is 1.

The characteristics you can specify are those you would specify via the methods setParameterName, setParameterMode, setParameterType, and setParameterClass.

 

setParameterClass

public synchronized void setParameterClass(int position,
                                           Class aClass) throws DBException

Sets the Java class to be used when getting or setting values for this parameter. The index of the first parameter is 1.

 

setParameterMode

public void setParameterMode(int position,
                             int mode) throws DBException

Sets the mode of the parameter at the specified position. The position of the first parameter is 1.

Valid modes are those for which constants are defined in DatabaseMetaData, including: procedureColumnIn, procedureColumnInOut, procedureColumnOut, and procedureColumnResult.

 

setParameterName

public void setParameterName(int position,
                             String aName) throws DBException

Sets the name of the parameter at the specified position. The position of the first parameter is 1.

 

setParameterScale

public void setParameterScale(int position,
                              int scale) throws DBException

Sets the number of digits to the right of the decimal point for this parameter. The position of the first parameter is 1.

 

setParameterType

public void setParameterType(int position,
                             int type) throws DBException

Sets the SQL type of the parameter at the specified position. The position of the first parameter is 1.

Class Hierarchy All Classes All Fields and Methods