Class com.ibm.db.StatementResult
java.lang.Object
|
+----com.ibm.db.StatementResult
- public abstract class StatementResult
- implements Serializable
- extends Object
StatementResult represents a result set from a executing an SQL statement.
Constructor Index
- StatementResult()
- Constructs a new StatementResult.
Method Index
- addStatementResultAfterListener(StatementResultAfterListener)
- Adds the StatementResultAfterListener.
- addStatementResultBeforeListener(StatementResultBeforeListener)
- Adds the StatementResultBeforeListener.
- closeResult()
- Closes the result set.
- columnNames()
- Returns an enumeration containing the names of the columns in the result set.
- deleteRow()
- Deletes a row.
- getColumnCount()
- Returns the number of columns in the result set.
- getColumnName(int)
- Returns the name of the column at the specified index.
- getColumnValue(int)
- Returns the value of the column at the specified index.
- getColumnValue(String)
- Returns the value of the column with the specified name.
- getColumnValueToString(int)
- Returns the value of the column at the specified index as a String.
- getColumnValueToString(String)
- Returns the value of the column with the specified name as a String.
- getJDBCMetaData()
- Returns the java.sql.ResultSetMetaData associated with this StatementResult.
- getNumRows()
- Returns the number of rows in the result set.
- isOpen()
- Returns true if the result set is open in the database and can be accessed,
otherwise returns false.
- removeStatementResultAfterListener(StatementResultAfterListener)
- Removes the StatementResultAfterListener.
- removeStatementResultBeforeListener(StatementResultBeforeListener)
- Removes the StatementResultBeforeListener.
- restoreRow()
- Restores a row's column values to those last known to be in the database.
- setColumnValue(int, Object)
- Sets the value of the column at the specified index to the specified value.
- setColumnValue(String, Object)
- Sets the value of the column with the specified name to the specified value.
- setColumnValueFromString(int, String)
- Sets the value of the column at the specified index to the specified value.
- setColumnValueFromString(String, String)
- Sets the value of the column with the specified name to the specified
value.
- updateRow()
- Updates a row.
Constructors
StatementResult
public StatementResult()
- Constructs a new StatementResult.
Methods
addStatementResultAfterListener
public void addStatementResultAfterListener(StatementResultAfterListener listener)
- Adds the StatementResultAfterListener. StatementResultAfter events occur after
result set scoped actions have been executed such as newRow and updateRow.
- Parameters:
- listener - StatementResultAfterListener
- See Also:
- StatementResultAfterListener
- removeStatementResultAfterListener
addStatementResultBeforeListener
public void addStatementResultBeforeListener(StatementResultBeforeListener listener)
- Adds the StatementResultBeforeListener. StatementResultAfter events occur before
result set scoped actions such as newRow and updateRow.
- Parameters:
- listener - StatementResultBeforeListener
- See Also:
- StatementResultBeforeListener
- removeStatementResultBeforeListener
closeResult
public abstract void closeResult() throws DataException
- Closes the result set. JDBC resources associated with the result set are
released. After the result set is closed, no more rows can be fetched into
it and it cannot be used to update the database.
- Throws: DataException
- notOpen
- if the statement is not open
- Throws: DataException
- noActiveConnection
- if no active connection exists
- Throws: DataException
- sqlException
- if an SQLException occurred
columnNames
public abstract Enumeration columnNames() throws DataException
- Returns an enumeration containing the names of the columns in the result set.
See subclasses for implementation.
- Returns:
- enumeration of column names
- Throws: DataException
- - if an error occurs
deleteRow
public abstract void deleteRow() throws DataException
- Deletes a row. See subclasses for implementation.
- Throws: DataException
- if an error occurred
getColumnCount
public abstract int getColumnCount() throws DataException
- Returns the number of columns in the result set.
See subclasses for implementation.
- Returns:
- the number of columns in the result set
- Throws: DataException
- - if an error occurs
getColumnName
public abstract String getColumnName(int columnNumber) throws DataException
- Returns the name of the column at the specified index. See subclasses for implementation.
The index of the first column is 1.
- Parameters:
- columnNumber - index of the column
- Returns:
- name of the column
- Throws: IndexOutOfBoundsException
- noSuchColumn
- if the column index is not defined
- Throws: DataException
- if an error occurred
getColumnValue
public abstract Object getColumnValue(int columnNumber) throws DataException
- Returns the value of the column at the specified index.
The index of the first column is 1.
See subclasses for implementation.
- Parameters:
- columnNumber - index of the column
- Returns:
- value of the column
- Throws: IndexOutOfBoundsException
- noSuchColumn
- if the column index is not defined
- Throws: DataException
- if an error occurred
- See Also:
- setColumnValue
getColumnValue
public abstract Object getColumnValue(String columnName) throws DataException
- Returns the value of the column with the specified name.
See subclasses for implementation.
- Parameters:
- columnName - name of the column
- Returns:
- value of the column
- Throws: IndexOutOfBoundsException
- noSuchColumn
- if the column name is not defined
- Throws: DataException
- if an error occurred
- See Also:
- setColumnValue
getColumnValueToString
public abstract String getColumnValueToString(int columnNumber) throws DataException
- Returns the value of the column at the specified index as a String. The value of
the column is converted to a String before it is returned. If the column
value is null, a null is returned.
The index of the first column is 1. See subclasses for implementation.
- Parameters:
- columnNumber - index of the column
- Returns:
- value of the column as a String.
- Throws: IndexOutOfBoundsException
- noSuchColumn
- if the column index is not defined
- Throws: DataException
- if an error occurred
- See Also:
- setColumnValueFromString
getColumnValueToString
public abstract String getColumnValueToString(String columnName) throws DataException
- Returns the value of the column with the specified name as a String. The value of the
column is converted to a String before it is returned. If the column
value is null, a null is returned. See subclasses for implementation.
- Parameters:
- columnName - name of the column
- Returns:
- value of the column as a String.
- Throws: IndexOutOfBoundsException
- noSuchColumn
- if the column name is not defined
- Throws: DataException
- if an error occurred
- See Also:
- setColumnValueFromString
getJDBCMetaData
public ResultSetMetaData getJDBCMetaData() throws DataException
- Returns the java.sql.ResultSetMetaData associated with this StatementResult. If the
SQL statement has not been exeucted yet, it will return a null value.
- Returns:
- the associated ResultSetMetaData
- Throws: DataException
- sqlException
- if an SQLException occurred
- See Also:
- setColumnValueFromString
getNumRows
public int getNumRows()
- Returns the number of rows in the result set. This number changes as rows are
fetched from the database, deleted, or added via the
newRow
method.
- Returns:
- number of rows in the result set
isOpen
public boolean isOpen()
- Returns true if the result set is open in the database and can be accessed,
otherwise returns false.
If the result set is not open, no more rows can be fetched into the result set from
the database.
When
isOpen
returns false, it may be because the associated Statement
has not been executed, the close
method has been invoked, or the
StatementResult has been serialized and then de-serialized.
- Returns:
- true if the result set is open in the database, otherwise false.
removeStatementResultAfterListener
public void removeStatementResultAfterListener(StatementResultAfterListener listener)
- Removes the StatementResultAfterListener. StatementResultAfter events occur after
result set scoped actions have been executed such as newRow and updateRow.
- Parameters:
- listener - StatementResultAfterListener
- See Also:
- StatementResultAfterListener
- addStatementResultAfterListener
removeStatementResultBeforeListener
public void removeStatementResultBeforeListener(StatementResultBeforeListener listener)
- Removes the StatementResultBeforeListener. StatementResultAfter events occur before
result set scoped actions have been executed such as newRow and updateRow.
- Parameters:
- listener - StatementResultBeforeListener
- See Also:
- StatementResultBeforeListener
- addStatementResultBeforeListener
restoreRow
public abstract void restoreRow() throws DataException
- Restores a row's column values to those last known to be in the database. See subclasses for implementation.
- Throws: DataException
- if an error occurred
setColumnValue
public abstract void setColumnValue(int columnNumber,
Object aValue) throws DataException
- Sets the value of the column at the specified index to the specified value.
The index of the first column is 1.
See subclasses for implementation.
- Parameters:
- columnNumber - index of the column
- aValue - value for the column
- Throws: IndexOutOfBoundsException
- noSuchColumn
- if the column index is not defined
- Throws: DataException
- if an error occurred
- See Also:
- getColumnValue
setColumnValue
public abstract void setColumnValue(String columnName,
Object aValue) throws DataException
- Sets the value of the column with the specified name to the specified value.
See subclasses for implementation.
- Parameters:
- columnName - name of the column
- aValue - value for the column
- Throws: IndexOutOfBoundsException
- noSuchColumn
- if the column name is not defined
- Throws: DataException
- if an error occurred
- See Also:
- getColumnValue
setColumnValueFromString
public abstract void setColumnValueFromString(int columnNumber,
String stringValue) throws DataException
- Sets the value of the column at the specified index to the specified value.
The stringValue parameter is converted to the datatype associated with the
column before the value is set.
The index of the first column is 1. See subclasses for implementation.
- Parameters:
- columnNumber - index of the column
- stringValue - value for the column as a String
- Throws: IndexOutOfBoundsException
- noSuchColumn
- if the column index is not defined
- Throws: DataException
- if an error occurred
- See Also:
- getColumnValueToString
setColumnValueFromString
public abstract void setColumnValueFromString(String columnName,
String stringValue) throws DataException
- Sets the value of the column with the specified name to the specified
value. The stringValue parameter is converted to the datatype associated with the
column before the value is set. See subclasses for implementation.
- Parameters:
- columnName - name of the column
- stringValue - value for the column as a String
- Throws: IndexOutOfBoundsException
- noSuchColumn
- if the column name is not defined
- Throws: DataException
- if an error occurred
- See Also:
- getColumnValueToString
updateRow
public abstract void updateRow() throws DataException
- Updates a row. See subclasses for implementation.
- Throws: DataException
- if an error occurred
