com.ibm.db
Class StatementMetaData

java.lang.Object
  |
  +--com.ibm.db.StatementMetaData
Direct Known Subclasses:
CallableStatementMetaData, SQLStatementMetaData

public class StatementMetaData
extends java.lang.Object
implements java.io.Serializable

StatementMetaData represents a SQL statement and associated metadata about the SQL statement, including the actual text of the SQL statement, descriptions of any result columns and any parameters, and a list of the tables referenced in the SQL statement.

For both result columns and parameters, the descriptions include the name and number of the column or parameter, its SQL data type in the database, and the java class your program will use to handle the value. When you add a column or parameter description, you can either explicitly name the java class you want to use, or you can specify an SQL data type that you want the column or parameter treated as. The method will then describe the column or parameter as using the default java class for that SQL data type.

The default mapping of SQL data types to java classes is:
Default Mapping
SQLType Java Class
CHAR java.lang.String
VARCHAR java.lang.String
LONGVARCHAR java.lang.String
TINYINT java.lang.Integer
SMALLINT java.lang.Short
BIGINT java.lang.Long
INTEGER java.lang.Integer
BIT java.lang.Boolean
DECIMAL java.math.BigDecimal
NUMERIC java.math.BigDecimal
REAL java.lang.Float
FLOAT java.lang.Double
DOUBLE java.lang.Double
BINARY byte[]
VARBINARY byte[]
LONGVARBINARY byte[]
DATE java.sql.Date
TIME java.sql.Time
TIMESTAMP java.sql.Timestamp
CLOB java.sql.Clob
BLOB java.sql.Blob

StatementMetaData objects can be chained. This allows you to specify multiple StatementMetaData objects for a CallableStatement. For a CallableStatement, the first StatementMetaData object describes the CALL statement that executes the stored procedure, including any parameters used for input and/or output. Any StatementMetaData objects chained behind the first one describe result sets that the stored procedure returns.

See Also:
Statement, Serialized Form

Field Summary
private static java.lang.String copyright
           
protected  Statement fieldStatement
           
protected  StatementMetaData nextMetaData
           
static int PARM_MODE_INOUT
           
static int PARM_MODE_INPUT
           
static int PARM_MODE_OUTPUT
           
protected  DatabaseQuerySpec querySpec
           
(package private) static long serialVersionUID
           
protected  java.util.Vector tables
           
 
Constructor Summary
  StatementMetaData()
          Constructs a new StatementMetaData.
protected StatementMetaData(DatabaseQuerySpec aSpec)
          Constructs a new StatementMetaData and associates it with the specified DatabaseQuerySpec.
 
Method Summary
 void addColumn(java.lang.String columnName, java.lang.Class javaClass, int sourceSQLType)
          Defines a new column with the given name whose value can be passed as an instance of the specified java class and whose SQL type is the specified value.
 void addColumn(java.lang.String columnName, int targetSQLType, int sourceSQLType)
          Defines a new column with the given name.
 void addParameter(java.lang.String name, java.lang.Class javaClass, int sourceSQLType)
          Defines a new parameter with the given name whose value can be passed as an instance of the specified java class and whose SQL type is the specified value.
 void addParameter(java.lang.String parameterName, java.lang.Class javaClass, int sourceSQLType, int mode)
          Defines a new parameter with the given name whose value can be passed as an instance of the specified java class and whose SQL type is the specified value.
 void addParameter(java.lang.String parameterName, int targetSQLType, int sourceSQLType)
          Defines a new parameter with the given name and the specified SQLType.
 void addParameter(java.lang.String parameterName, int targetSQLType, int sourceSQLType, int mode)
          Defines a new parameter with the given name and the specified SQLType.
 void addTable(java.lang.String tableName)
          Defines a table name that is used in this SQL statement.
 java.lang.Class getColumnClass(int columnNumber)
          Returns the java class that is used for the values of the column.
 java.lang.Class getColumnClass(java.lang.String columnName)
          Returns the java class that is used for the values of the column.
 int getColumnCount()
          Returns the number of columns in the result set.
 int getColumnIndex(java.lang.String columnName)
          Returns the index of the column based on its name.
 int getColumnLength(int columnNumber)
          Returns the length of the indexed column.
 int getColumnLength(java.lang.String columnName)
          Returns the length of the named column.
 java.lang.String getColumnName(int columnNumber)
          Returns the name of the specified column.
 java.util.Enumeration getColumnNames()
          Returns an enumeration of the column names.
 int getColumnScale(int columnNumber)
          Returns the scale of the indexed column.
 int getColumnScale(java.lang.String columnName)
          Returns the scale of the indexed column.
protected  DatabaseCompoundType getColumnShape()
          Returns a DatabaseCompoundType describing the result columns in the SQL statement.
 int getColumnSQLType(int columnNumber)
          Returns the SQLType of the column in the database.
 int getColumnSQLType(java.lang.String columnName)
          Returns the SQLType of the named column.
protected  java.lang.String getColumnSQLTypeName(int columnNumber)
          Returns the name of the SQL type of the column in the database.
protected  DatabaseTypeField getColumnType(int columnNumber)
          Returns a DatabaseTypeField that describes the specified column.
protected  DatabaseQuerySpec getDbQuerySpec()
          Returns the DatabaseQuerySpec that is associated with the StatementMetaData.
 java.lang.String getName()
          Returns the name associated with this StatementMetaData.
 StatementMetaData getNextMetaData()
          Returns the next chained StatementMetaData, or null if this is the final StatementMetaData.
 java.lang.Class getParameterClass(int parameterNumber)
          Returns the java class that is used for the value of the parameter.
 java.lang.Class getParameterClass(java.lang.String parameterName)
          Returns the java class that is used for the value of the parameter.
 int getParameterCount()
          Returns the number of parameters that have been defined for this SQL statement.
 int getParameterIndex(java.lang.String parameterName)
          Returns the index of the parameter based on its name.
 int getParameterLength(int parameterNumber)
          Returns the length of the specified parameter.
 int getParameterLength(java.lang.String parameterName)
          Returns the length of the specified parameter.
 int getParameterMode(int parameterNumber)
          Returns the mode of the specified parameter.
 int getParameterMode(java.lang.String parameterName)
          Returns the mode of the specified parameter.
 java.lang.String getParameterName(int parameterNumber)
          Returns the name of the specified parameter.
 int getParameterScale(int parameterNumber)
          Returns the scale of the specified parameter.
 int getParameterScale(java.lang.String parameterName)
          Returns the scale of the specified parameter.
protected  DatabaseCompoundType getParameterShape()
          Returns a DatabaseCompoundType describing the parameters.
 int getParameterSQLType(int parameterNumber)
          Returns the SQLType of the specified parameter.
 int getParameterSQLType(java.lang.String parameterName)
          Returns the SQLType of the specified parameter.
protected  DatabaseTypeField getParameterType(int parameterNumber)
          Returns a DatabaseTypeField that describes the specified parameter.
 java.lang.String getSQL()
          Returns the SQL statement for this StatementMetadata.
 java.util.Enumeration getTables()
          Returns an enumeration of tables for this SQL statement.
 void removeColumn(int columnNumber)
          Removes the column from the list of defined columns.
 void removeColumn(java.lang.String columnName)
          Removes the column from the list of defined columns.
 void removeParameter(int parameterNumber)
          Removes the parameter from the list of defined parameters.
 void removeParameter(java.lang.String parameterName)
          Removes the parameter from the list of defined parameters.
 void removeTable(java.lang.String tableName)
          Removes the table from the list of defined tables.
 void setColumnLength(int columnNumber, int definedLength)
          Sets a user-defined length for the specified column.
 void setColumnLength(java.lang.String columnName, int definedLength)
          Sets a user-defined length for the specified column.
 void setColumnScale(int columnNumber, int definedScale)
          Sets a user-defined scale for the specified column.
 void setColumnScale(java.lang.String columnName, int definedScale)
          Sets a user-defined scale for the specified column.
protected  void setColumnShape(DatabaseCompoundType aType)
          Sets the column shape to the specified DatabaseCompoundType.
 void setColumnSQLType(int columnNumber, int type)
          Sets the SQLType of the specified column.
 void setColumnSQLType(java.lang.String columnName, int type)
          Sets the SQLType of the specified column.
 void setName(java.lang.String name)
          Sets the name for this StatementMetaData.
 void setNextMetaData(StatementMetaData aMetaData)
          Chains the specified StatementMetaData after this one.
 void setParameterLength(int parameterNumber, int definedLength)
          Sets a user-defined length for the specified parameter.
 void setParameterLength(java.lang.String parameterName, int definedLength)
          Sets a user-defined length for the specified parameter.
 void setParameterMode(int parameterNumber, int aMode)
          Sets a mode for the specified parameter.
 void setParameterMode(java.lang.String parameterName, int aMode)
          Sets a mode for the specified parameter.
 void setParameterScale(int parameterNumber, int definedScale)
          Sets a user-defined scale for the specified parameter.
 void setParameterScale(java.lang.String parameterName, int definedScale)
          Sets a user-defined scale for the specified parameter.
 void setParameterSQLType(int parameterNumber, int type)
          Sets the SQLType for the specified parameter.
 void setParameterSQLType(java.lang.String parameterName, int type)
          Sets the SQLType for the specified parameter.
 void setSQL(java.lang.String aStatement)
          Sets the SQL statement for this StatementMetadata.
protected  void setStatement(Statement statement)
          Associates a Statement with this StatementMetaData.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

querySpec

protected DatabaseQuerySpec querySpec

tables

protected java.util.Vector tables

nextMetaData

protected StatementMetaData nextMetaData

fieldStatement

protected Statement fieldStatement

PARM_MODE_INPUT

public static final int PARM_MODE_INPUT

PARM_MODE_INOUT

public static final int PARM_MODE_INOUT

PARM_MODE_OUTPUT

public static final int PARM_MODE_OUTPUT

serialVersionUID

static final long serialVersionUID

copyright

private static final java.lang.String copyright
Constructor Detail

StatementMetaData

public StatementMetaData()
Constructs a new StatementMetaData.

StatementMetaData

protected StatementMetaData(DatabaseQuerySpec aSpec)
Constructs a new StatementMetaData and associates it with the specified DatabaseQuerySpec. Use this constructor when you want to create a new StatementMetaData and associate it with an existing DatabaseQuerySpec.
Parameters:
aSpec - the query specification.
Method Detail

addColumn

public void addColumn(java.lang.String columnName,
                      int targetSQLType,
                      int sourceSQLType)
               throws DataException
Defines a new column with the given name. The index of the defined column is determined by the order in which the columns were defined. The first defined column has an index of 1.

As part of the definition, you define the SQL data type of the column in the database, as well as the SQL data type you want the data treated as. The data will be retrieved into the default java class for the SQL type you want the data treated as. The default java class for each SQL data type is shown in the default mapping table in the overview documentation of the StatementMetaData class itself.

Parameters:
columnName - the name of the column
targetSQLType - the SQLtype that the column will be treated as
sourceSQLType - the SQLtype of the column in the database
Throws:
DataException - badSQLType - if the SQLtype is invalid or unsupported
DataException - duplicateColumn - if the column name is a duplicate of an existing column
See Also:
removeColumn(int)

addColumn

public void addColumn(java.lang.String columnName,
                      java.lang.Class javaClass,
                      int sourceSQLType)
               throws DataException
Defines a new column with the given name whose value can be passed as an instance of the specified java class and whose SQL type is the specified value. The index of the defined column is determined by the order in which the columns were defined. The first defined column has an index of 1.

Use the class literal syntax xxx.class to get an instance of a java class to pass as the second parameter, where xxx is the name you would code, for example boolean.class or String.class.

The default java class for each SQL data type is shown in the default mapping table in the overview documentation of the StatementMetaData class itself.

Parameters:
columnName - the name of the column
javaClass - the java class for the column
sourceSQLType - the SQLtype of the column in the database
Throws:
DataException - badJavaClass - if the javaClass parameter is null
DataException - errorMakeField - if the class specified in the javaClass parameter is not supported
DataException - duplicateColumn - if the column name is a duplicate of an existing column
See Also:
removeColumn(int)

addParameter

public void addParameter(java.lang.String parameterName,
                         int targetSQLType,
                         int sourceSQLType)
                  throws DataException
Defines a new parameter with the given name and the specified SQLType. The mode of the parameter defaults to PARM_MODE_INPUT. The index of the defined parameter is determined by the order in which the parameters were defined. The first defined parameter has an index of 1.

As part of the definition, you define the SQL data type of the parameter in the database, as well as the SQL data type you want the data treated as. The data will be stored in the default java class for the SQL type you want the data treated as. The default java class for each SQL data type is shown in the default mapping table in the overview documentation of the StatementMetaData class itself.

Parameters:
parameterName - the name of the parameter
targetSQLType - the SQLtype that the parameter will be treated as
sourceSQLType - the SQLtype of the parameter in the database.
mode - the use of the parameter for input, output, or both
Throws:
DataException - badSQLType - if the SQLtype is invalid or unsupported
DataException - duplicateParm - if the parameter name is a duplicate of an existing parameter
See Also:
removeParameter(int)

addParameter

public void addParameter(java.lang.String parameterName,
                         int targetSQLType,
                         int sourceSQLType,
                         int mode)
                  throws DataException
Defines a new parameter with the given name and the specified SQLType. The index of the defined parameter is determined by the order in which the parameters were defined. The first defined parameter has an index of 1.

As part of the definition, you define the SQL data type of the parameter in the database, as well as the SQL data type you want the data treated as. The data will be stored in the default java class for the SQL type you want the data treated as. The default java class for each SQL data type is shown in the default mapping table in the overview documentation of the StatementMetaData class itself.

Parameters:
parameterName - the name of the parameter
targetSQLType - the SQLtype that the parameter will be treated as
sourceSQLType - the SQLtype of the parameter in the database.
mode - the use of the parameter for input, output, or both
Throws:
DataException - badSQLType - if the SQLtype is invalid or unsupported
DataException - duplicateParm - if the parameter name is a duplicate of an existing parameter
See Also:
removeParameter(int)

addParameter

public void addParameter(java.lang.String name,
                         java.lang.Class javaClass,
                         int sourceSQLType)
                  throws DataException
Defines a new parameter with the given name whose value can be passed as an instance of the specified java class and whose SQL type is the specified value. The mode of the parameter defaults to PARM_MODE_INPUT. The index of the defined parameter is determined by the order in which the parameters were defined. The first defined parameter has an index of 1.

Use the class literal syntax xxx.class to get an instance of a java class to pass as the second parameter, where xxx is the name you would code, for example boolean.class or String.class.

The default java class for each SQL data type is shown in the default mapping table in the overview documentation of the StatementMetaData class itself.

Parameters:
parameterName - the name of the parameter
javaClass - the java class to use for input and output of the parameter value
sourceSQLType - the SQLtype of the parameter
Throws:
DataException - badJavaClass - if the javaClass parameter is null
DataException - errorMakeField - if the class specified in the javaClass parameter is not supported
DataException - duplicateParm - if the parameter name is a duplicate of an existing parameter
See Also:
removeParameter(int)

addParameter

public void addParameter(java.lang.String parameterName,
                         java.lang.Class javaClass,
                         int sourceSQLType,
                         int mode)
                  throws DataException
Defines a new parameter with the given name whose value can be passed as an instance of the specified java class and whose SQL type is the specified value. The index of the defined parameter is determined by the order in which the parameters were defined. The first defined parameter has an index of 1.

Use the class literal syntax xxx.class to get an instance of a java class to pass as the second parameter, where xxx is the name you would code, for example boolean.class or String.class.

The default java class for each SQL data type is shown in the default mapping table in the overview documentation of the StatementMetaData class itself.

Parameters:
parameterName - the name of the parameter
javaClass - the java class to use for input and output of the parameter value
sourceSQLType - the SQLtype of the parameter
mode - the use of the parameter for input, output, or both
Throws:
DataException - badJavaClass - if the javaClass parameter is null
DataException - errorMakeField - if the class specified in the javaClass parameter is not supported
DataException - duplicateParm - if the parameter name is a duplicate of an existing parameter
See Also:
removeParameter(int)

addTable

public void addTable(java.lang.String tableName)
Defines a table name that is used in this SQL statement.
Parameters:
tableName - the table name
See Also:
removeTable(java.lang.String)

getColumnClass

public java.lang.Class getColumnClass(int columnNumber)
Returns the java class that is used for the values of the column. The index of the first column is 1. If the columns have been defined by addColumn, this method returns the java class used in the definition. If the columns have not been defined by addColumn, the java class is not available until after the SQL statement has been executed.
Parameters:
columnNumber - the index of the column
Returns:
the java class for the column
Throws:
java.lang.IndexOutOfBoundsException - if the column index is not defined

getColumnClass

public java.lang.Class getColumnClass(java.lang.String columnName)
Returns the java class that is used for the values of the column. If the columns have been defined by addColumn, this method returns the java class used in the definition. If the columns have not been defined by addColumn, the java class is not available until after the SQL statement has been executed.
Parameters:
columnName - the name of the column
Returns:
the java class for the column
Throws:
java.lang.IndexOutOfBoundsException - if the column name is not defined

getColumnCount

public int getColumnCount()
Returns the number of columns in the result set. If the columns have been defined by addColumn, this method returns the number of columns that have currently been defined. If the columns have not been defined by addColumn, the number of columns is not available until after the SQL statement has been executed.
Returns:
the number of columns

getColumnIndex

public int getColumnIndex(java.lang.String columnName)
Returns the index of the column based on its name. If the columns have been defined by addColumn, this method returns an index representing the order that the columns were defined. If the columns have not been defined by addColumn, the column index is not available until after the SQL statement has been executed. The first defined column has an index of 1.
Parameters:
columnName - the name of the column
Returns:
the column index
Throws:
java.lang.IndexOutOfBoundsException - if the column name is not defined

getColumnLength

public int getColumnLength(int columnNumber)
Returns the length of the indexed column. The index of the first column is 1. If the columns have not been defined by addColumn, the length is not available until after the SQL statement has been executed.
Parameters:
columnNumber - the index of the column
Returns:
the column length
Throws:
java.lang.IndexOutOfBoundsException - if the column index is not defined
See Also:
setColumnLength(int, int)

getColumnLength

public int getColumnLength(java.lang.String columnName)
Returns the length of the named column. If the columns have not been defined by addColumn, the length is not available until after the SQL statement has been executed.
Parameters:
columnName - the name of the column
Returns:
the column length
Throws:
java.lang.IndexOutOfBoundsException - if the column name is not defined
See Also:
setColumnLength(int, int)

getColumnName

public java.lang.String getColumnName(int columnNumber)
Returns the name of the specified column. The index of the first column is 1. If the columns have not been defined by addColumn, the name is not available until after the SQL statement has been executed.
Parameters:
columnNumber - the index of the column
Returns:
the column name
Throws:
java.lang.IndexOutOfBoundsException - if the column index is not defined

getColumnNames

public java.util.Enumeration getColumnNames()
Returns an enumeration of the column names. If the columns have been defined by addColumn , this method returns the names of columns that have currently been defined. If the columns have not been defined by addColumn, the names of the columns are not available until after the SQL statement has been executed.
Returns:
the column names

getColumnScale

public int getColumnScale(int columnNumber)
Returns the scale of the indexed column. The index of the first column is 1. If the columns have not been defined by addColumn, the scale is not available until after the SQL statement has been executed.
Parameters:
columnNumber - the index of the column
Returns:
the column scale
Throws:
java.lang.IndexOutOfBoundsException - if the column index is not defined
See Also:
setColumnScale(int, int)

getColumnScale

public int getColumnScale(java.lang.String columnName)
Returns the scale of the indexed column. If the columns have not been defined by addColumn, the scale is not available until after the SQL statement has been executed.
Parameters:
columnName - the name of the column
Returns:
the column scale
Throws:
java.lang.IndexOutOfBoundsException - if the column name is not defined
See Also:
setColumnScale(int, int)

getColumnShape

protected DatabaseCompoundType getColumnShape()
Returns a DatabaseCompoundType describing the result columns in the SQL statement.
Returns:
a description of the columns
See Also:
setColumnShape(com.ibm.db.base.DatabaseCompoundType)

getColumnSQLType

public int getColumnSQLType(int columnNumber)
Returns the SQLType of the column in the database. The index of the first column is 1. If the columns have not been defined by addColumn, the SQLType is not available until after the SQL statement has been executed.
Parameters:
columnNumber - the index of the column
Returns:
the column SQLType
Throws:
java.lang.IndexOutOfBoundsException - if the column index is not defined
See Also:
setColumnSQLType(int, int)

getColumnSQLType

public int getColumnSQLType(java.lang.String columnName)
Returns the SQLType of the named column. If the columns have not been defined by addColumn, the SQLType is not available until after the SQL statement has been executed.
Parameters:
columnName - the name of the column
Returns:
the column SQLType
Throws:
java.lang.IndexOutOfBoundsException - if the column name is not defined
See Also:
setColumnSQLType(int, int)

getColumnSQLTypeName

protected java.lang.String getColumnSQLTypeName(int columnNumber)
Returns the name of the SQL type of the column in the database. The index of the first column is 1. This information may not be available until after the SQL statement has been executed.
Parameters:
columnNumber - the index of the column
Returns:
the name of the column's SQL type
Throws:
java.lang.IndexOutOfBoundsException - if the column index is not defined
See Also:
#setColumnSQLTypeName

getColumnType

protected DatabaseTypeField getColumnType(int columnNumber)
Returns a DatabaseTypeField that describes the specified column. The index of the first column is 1. If the columns have not been defined by addColumn, the column description is not available until after the SQL statement has been executed.
Parameters:
columnNumber - the index of the column
Returns:
the description of the column
Throws:
java.lang.IndexOutOfBoundsException - if the column index is not defined

getDbQuerySpec

protected DatabaseQuerySpec getDbQuerySpec()
Returns the DatabaseQuerySpec that is associated with the StatementMetaData.
Returns:
the associated DatabaseQuerySpec
See Also:
#setDbQuerySpec

getName

public java.lang.String getName()
Returns the name associated with this StatementMetaData.
Returns:
the name of this StatementMetaData
See Also:
setName(java.lang.String)

getNextMetaData

public StatementMetaData getNextMetaData()
Returns the next chained StatementMetaData, or null if this is the final StatementMetaData. Chaining of StatementMetaData objects is used to associate multiple metadata objects with a CallableStatement. For a CallableStatement, the first StatementMetaData object describes the CALL statement that executes the stored procedure, including any parameters used for input and/or output. Any StatementMetaData objects chained behind the first one describe result sets that the stored procedure returns.
Returns:
the next chained StatementMetaData object
See Also:
setNextMetaData(com.ibm.db.StatementMetaData)

getParameterClass

public java.lang.Class getParameterClass(int parameterNumber)
Returns the java class that is used for the value of the parameter. The index of the first parameter is 1.
Parameters:
parameterNumber - the index of the parameter
Returns:
the java class for the parameter
Throws:
java.lang.IndexOutOfBoundsException - if the parameter index is not defined

getParameterClass

public java.lang.Class getParameterClass(java.lang.String parameterName)
Returns the java class that is used for the value of the parameter.
Parameters:
parameterName - the name of the parameter
Returns:
the java class for the parameter
Throws:
java.lang.IndexOutOfBoundsException - if the parameter name is not defined

getParameterCount

public int getParameterCount()
Returns the number of parameters that have been defined for this SQL statement.
Returns:
the number of parameters

getParameterIndex

public int getParameterIndex(java.lang.String parameterName)
Returns the index of the parameter based on its name. The first defined parameter has an index of 1.
Parameters:
parameterName - the name of the parameter
Returns:
the parameter index
Throws:
java.lang.IndexOutOfBoundsException - if the parameter name is not defined

getParameterLength

public int getParameterLength(int parameterNumber)
Returns the length of the specified parameter. The index of the first parameter is 1.
Parameters:
parameterNumber - the index of the parameter
Returns:
the parameter length
Throws:
java.lang.IndexOutOfBoundsException - if the parameter index is not defined
See Also:
setParameterLength(int, int)

getParameterLength

public int getParameterLength(java.lang.String parameterName)
Returns the length of the specified parameter.
Parameters:
parameterName - the name of the parameter
Returns:
the parameter length
Throws:
java.lang.IndexOutOfBoundsException - if the parameter name is not defined
See Also:
setParameterLength(int, int)

getParameterMode

public int getParameterMode(int parameterNumber)
Returns the mode of the specified parameter. The mode of the parameter indicates whether it is used for input, output, or both input and output. The index of the first parameter is 1.
Parameters:
parameterNumber - the index of the parameter
Returns:
the parameter mode (PARM_MODE_INPUT, PARM_MODE_OUTPUT, PARM_MODE_INOUT)
Throws:
java.lang.IndexOutOfBoundsException - if the parameter index is not defined
See Also:
setParameterMode(int, int)

getParameterMode

public int getParameterMode(java.lang.String parameterName)
Returns the mode of the specified parameter. The mode of the parameter indicates whether it is used for input, output, or both input and output.
Parameters:
parameterName - the name of the parameter
Returns:
the parameter mode (PARM_MODE_INPUT, PARM_MODE_OUTPUT, PARM_MODE_INOUT)
Throws:
java.lang.IndexOutOfBoundsException - if the parameter name is not defined
See Also:
setParameterMode(int, int)

getParameterName

public java.lang.String getParameterName(int parameterNumber)
Returns the name of the specified parameter. The index of the first parameter is 1.
Parameters:
parameterNumber - the index of the parameter
Returns:
the parameter name
Throws:
java.lang.IndexOutOfBoundsException - if the parameter index is not defined

getParameterScale

public int getParameterScale(int parameterNumber)
Returns the scale of the specified parameter. The index of the first parameter is 1.
Parameters:
parameterNumber - the index of the parameter
Returns:
the parameter scale
Throws:
java.lang.IndexOutOfBoundsException - if the parameter index is not defined
See Also:
setParameterScale(int, int)

getParameterScale

public int getParameterScale(java.lang.String parameterName)
Returns the scale of the specified parameter.
Parameters:
parameterName - the name of the parameter
Returns:
the parameter scale
Throws:
java.lang.IndexOutOfBoundsException - if the parameter name is not defined
See Also:
setParameterScale(int, int)

getParameterShape

protected DatabaseCompoundType getParameterShape()
Returns a DatabaseCompoundType describing the parameters.
Returns:
a description of the parameters

getParameterSQLType

public int getParameterSQLType(int parameterNumber)
Returns the SQLType of the specified parameter. The index of the first parameter is 1.
Parameters:
parameterNumber - the index of the parameter
Returns:
the parameter SQLType
Throws:
java.lang.IndexOutOfBoundsException - if the parameter index is not defined
See Also:
setParameterSQLType(int, int)

getParameterSQLType

public int getParameterSQLType(java.lang.String parameterName)
Returns the SQLType of the specified parameter.
Parameters:
parameterName - the name of the parameter
Returns:
the parameter SQLType
Throws:
java.lang.IndexOutOfBoundsException - if the parameter name is not defined
See Also:
setParameterSQLType(int, int)

getParameterType

protected DatabaseTypeField getParameterType(int parameterNumber)
Returns a DatabaseTypeField that describes the specified parameter. The index of the first parameter is 1.
Parameters:
parameterNumber - the index of the parameter
Returns:
a description of the parameter
Throws:
java.lang.IndexOutOfBoundsException - if the parameter index is not defined

getSQL

public java.lang.String getSQL()
Returns the SQL statement for this StatementMetadata.
Returns:
the SQL statement
See Also:
DatabaseQuerySpec, setSQL(java.lang.String)

getTables

public java.util.Enumeration getTables()
Returns an enumeration of tables for this SQL statement.
Returns:
an enumeration of tables for this statement

removeColumn

public void removeColumn(int columnNumber)
Removes the column from the list of defined columns. The indexes of any columns after this one are decremented by 1. The index of the first column is 1.
Parameters:
columnNumber - the index of the column
Throws:
java.lang.IndexOutOfBoundsException - if the column index is not defined
See Also:
addColumn(java.lang.String, int, int)

removeColumn

public void removeColumn(java.lang.String columnName)
Removes the column from the list of defined columns. The indexes of any columns after this one are decremented by 1.
Parameters:
columnName - the name of the column
Throws:
java.lang.IndexOutOfBoundsException - if the column name is not defined
See Also:
addColumn(java.lang.String, int, int)

removeParameter

public void removeParameter(int parameterNumber)
Removes the parameter from the list of defined parameters. The indexes of any parameters after this one are decremented by 1. The index of the first parameter is 1.
Parameters:
parameterNumber - the index of the parameter
Throws:
java.lang.IndexOutOfBoundsException - if the parameter index is not defined
See Also:
addParameter(java.lang.String, int, int)

removeParameter

public void removeParameter(java.lang.String parameterName)
Removes the parameter from the list of defined parameters. The indexes of any parameters after this one are decremented by 1.
Parameters:
parameterName - the name of the parameter
Throws:
java.lang.IndexOutOfBoundsException - if the parameter name is not defined
See Also:
addParameter(java.lang.String, int, int)

removeTable

public void removeTable(java.lang.String tableName)
                 throws DataException
Removes the table from the list of defined tables.
Parameters:
tableName - the table name
Throws:
DataException - noSuchTable - if the table name is not defined
See Also:
addTable(java.lang.String)

setColumnLength

public void setColumnLength(int columnNumber,
                            int definedLength)
Sets a user-defined length for the specified column. The index of the first column is 1. This method should only be used if the column was defined by addColumn. Otherwise the column length will be obtained from the database when the columns are described after the SQL statement has been executed.
Parameters:
columnNumber - the index of the column
definedLength - the length of the column
Throws:
java.lang.IndexOutOfBoundsException - if the column index is not defined
See Also:
getColumnLength(int)

setColumnLength

public void setColumnLength(java.lang.String columnName,
                            int definedLength)
Sets a user-defined length for the specified column. This method should only be used if the column was defined by addColumn. Otherwise the column length will be obtained from the database when the columns are described after the SQL statement has been executed.
Parameters:
columnName - the name of the column
definedLength - the length of the column
Throws:
java.lang.IndexOutOfBoundsException - if the column name is not defined
See Also:
getColumnLength(int)

setColumnScale

public void setColumnScale(int columnNumber,
                           int definedScale)
Sets a user-defined scale for the specified column. The index of the first column is 1. This method should only be used if the column was defined by addColumn. Otherwise the column scale will be obtained from the database when the columns are described after the SQL statement has been executed.
Parameters:
columnNumber - the index of the column
definedScale - the scale of the column
Throws:
java.lang.IndexOutOfBoundsException - if the column index is not defined
See Also:
getColumnScale(int)

setColumnScale

public void setColumnScale(java.lang.String columnName,
                           int definedScale)
Sets a user-defined scale for the specified column. This method should only be used if the column was defined by addColumn. Otherwise the column scale will be obtained from the database when the columns are described after the SQL statement has been executed.
Parameters:
columnName - the name of the column
definedScale - the scale of the column
Throws:
java.lang.IndexOutOfBoundsException - if the column name is not defined
See Also:
getColumnScale(int)

setColumnShape

protected void setColumnShape(DatabaseCompoundType aType)
Sets the column shape to the specified DatabaseCompoundType. The column shape is a description of the columns.
Parameters:
aType - the description of the columns
See Also:
getColumnShape(), DatabaseCompoundType

setColumnSQLType

public void setColumnSQLType(int columnNumber,
                             int type)
Sets the SQLType of the specified column. The index of the first column is 1. This method should only be used if the column was defined by addColumn. Otherwise the column SQLType will be obtained from the database when the columns are described after the SQL statement has been executed.
Parameters:
columnNumber - the index of the column
type - the SQLType of the column
Throws:
java.lang.IndexOutOfBoundsException - if the column index is not defined
See Also:
getColumnSQLType(int)

setColumnSQLType

public void setColumnSQLType(java.lang.String columnName,
                             int type)
Sets the SQLType of the specified column. This method should only be used if the column was defined by addColumn. Otherwise the column SQLType will be obtained from the database when the columns are described after the SQL statement has been executed.
Parameters:
columnName - the name of the column
type - the SQLType of the column
Throws:
java.lang.IndexOutOfBoundsException - if the column name is not defined
See Also:
getColumnSQLType(int)

setName

public void setName(java.lang.String name)
Sets the name for this StatementMetaData.
Parameters:
name - the name of this StatementMetaData
See Also:
getName()

setNextMetaData

public void setNextMetaData(StatementMetaData aMetaData)
Chains the specified StatementMetaData after this one. Chaining of StatementMetaData objects is used to associate multiple meta data objects with a CallableStatement. For a CallableStatement, the first StatementMetaData object describes the CALL statement that executes the stored procedure, including any parameters used for input and/or output. Any StatementMetaData objects chained behind the first one describe result sets that the stored procedure returns.
Parameters:
aMetaData - StatementMetaData to put next in the chain
See Also:
getNextMetaData()

setParameterLength

public void setParameterLength(int parameterNumber,
                               int definedLength)
Sets a user-defined length for the specified parameter. The index of the first parameter is 1.
Parameters:
parameterNumber - the index of the parameter
definedLength - the length of the parameter
Throws:
java.lang.IndexOutOfBoundsException - if the parameter index is not defined
See Also:
getParameterLength(int)

setParameterLength

public void setParameterLength(java.lang.String parameterName,
                               int definedLength)
Sets a user-defined length for the specified parameter.
Parameters:
parameterName - the name of the parameter
definedLength - the length of the parameter
Throws:
java.lang.IndexOutOfBoundsException - if the parameter name is not defined
See Also:
getParameterLength(int)

setParameterMode

public void setParameterMode(int parameterNumber,
                             int aMode)
Sets a mode for the specified parameter. The mode of the parameter indicates whether it is used for input, output, or both input and output. The index of the first parameter is 1.
Parameters:
parameterNumber - the index of the parameter
aMode - the mode of the parameter (PARM_MODE_INPUT, PARM_MODE_OUTPUT, PARM_MODE_INOUT)
Throws:
java.lang.IndexOutOfBoundsException - if the parameter index is not defined
See Also:
getParameterMode(int)

setParameterMode

public void setParameterMode(java.lang.String parameterName,
                             int aMode)
Sets a mode for the specified parameter. The mode of the parameter indicates whether it is used for input, output, or both input and output.
Parameters:
parameterName - the name of the parameter
aMode - the mode of the parameter (PARM_MODE_INPUT, PARM_MODE_OUTPUT, PARM_MODE_INOUT)
Throws:
java.lang.IndexOutOfBoundsException - if the parameter name is not defined
See Also:
getParameterMode(int)

setParameterScale

public void setParameterScale(int parameterNumber,
                              int definedScale)
Sets a user-defined scale for the specified parameter. The index of the first parameter is 1.
Parameters:
parameterNumber - the index of the parameter
definedScale - the scale of the parameter
Throws:
java.lang.IndexOutOfBoundsException - if the parameter index is not defined
See Also:
getParameterScale(int)

setParameterScale

public void setParameterScale(java.lang.String parameterName,
                              int definedScale)
Sets a user-defined scale for the specified parameter.
Parameters:
parameterName - the name of the parameter
definedScale - the scale of the parameter
Throws:
java.lang.IndexOutOfBoundsException - if the parameter name is not defined
See Also:
getParameterScale(int)

setParameterSQLType

public void setParameterSQLType(int parameterNumber,
                                int type)
Sets the SQLType for the specified parameter. The index of the first parameter is 1.
Parameters:
parameterNumber - the index of the parameter
type - the SQLType of the parameter
Throws:
java.lang.IndexOutOfBoundsException - if the parameter index is not defined
See Also:
getParameterSQLType(int)

setParameterSQLType

public void setParameterSQLType(java.lang.String parameterName,
                                int type)
Sets the SQLType for the specified parameter.
Parameters:
parameterName - the name of the parameter
type - the SQLType of the parameter
Throws:
java.lang.IndexOutOfBoundsException - if the parameter name is not defined
See Also:
getParameterSQLType(int)

setSQL

public void setSQL(java.lang.String aStatement)
Sets the SQL statement for this StatementMetadata.
Parameters:
sStatement - the SQL statement
See Also:
getSQL()

setStatement

protected void setStatement(Statement statement)
Associates a Statement with this StatementMetaData.
Parameters:
statement - the associated Statement