Class com.ibm.db.StatementResult
java.lang.Object
|
+----com.ibm.db.StatementResult
- public abstract class StatementResult
- extends Object
- implements Serializable
StatementResult represents a result set from a executing a SQL statement.
- Version:
- 1.0 06/30/98
Constructor Index
- StatementResult()
- Constructs a new StatementResult.
Method Index
- addStatementResultAfterListener(StatementResultAfterListener)
- Adds the StatementAfterListener.
- addStatementResultBeforeListener(StatementResultBeforeListener)
- Adds the StatementBeforeListener.
- close()
- 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.
- 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 StatementAfterListener.
- removeStatementResultBeforeListener(StatementResultBeforeListener)
- Removes the StatementBeforeListener.
- 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 newListener)
- Adds the StatementAfterListener. StatementAfter events occur after
statement scoped actions have been executed such as execute and refresh.
- Parameters:
- newListener - StatementAfterListener
- See Also:
- StatementAfterListener, removeStatementAfterListener
addStatementResultBeforeListener
public void addStatementResultBeforeListener(StatementResultBeforeListener newListener)
- Adds the StatementBeforeListener. StatementAfter events occur before
statement scoped actions such as execute and refresh.
- Parameters:
- newListener - StatementBeforeListener
- See Also:
- StatementBeforeListener, removeStatementBeforeListener
close
public void close() 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
- sqlException
- if a 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
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
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
- 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
- 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
- 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
- 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
- if the column name is not defined
- Throws: DataException
- if an error 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, rows cannot be fetched from the the database and
updates cannot be performed.
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 newListener)
- Removes the StatementAfterListener. StatementAfter events occur after
statement scoped actions have been executed such as execute and refresh.
- Parameters:
- newListener - StatementAfterListener
- See Also:
- StatementAfterListener, addStatementAfterListener
removeStatementResultBeforeListener
public void removeStatementResultBeforeListener(StatementResultBeforeListener newListener)
- Removes the StatementBeforeListener. StatementAfter events occur before
statement scoped actions such as execute and refresh.
- Parameters:
- newListener - StatementBeforeListener
- See Also:
- StatementBeforeListener, addStatementBeforeListener
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
- 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
- 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
- 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
- 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
