Where Am I? Class Hierarchy All Classes All Fields and Methods

Class com.ibm.db.SelectResult

java.lang.Object
   |
   +----com.ibm.db.StatementResult
           |
           +----com.ibm.db.SelectResult

public class SelectResult
extends StatementResult

SelectResult represents a result set returned from executing a SQL Select statement.

Version:
1.0 06/30/98
See Also:
SelectStatement

Constructor Index

SelectResult()
Constructs a new SelectResult.
SelectResult(SelectStatement)
Constructs a new SelectResult and associates it with the specified SelectStatement.

Method Index

addPropertyChangeListener(PropertyChangeListener)
Adds the PropertyChangeListener.
addStatementResultValueChangeListener(StatementResultValueChangeListener)
Adds the StatementResultValueChangeListener.
close()
Closes the result set.
columnNames()
Returns the names of the columns of the result set.
deleteRow()
Deletes the current row from the result set and from the database.
firstRow()
Applies any changes in the current row to the database, and then makes the first row in the result set the current 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 in the current row.
getColumnValue(String)
Returns the value of the column with the specified name in the current row.
getColumnValueToString(int)
Returns the value of the column at the specified index in the current row as a String.
getColumnValueToString(String)
Returns the value of the column with the specified name in the current row as a String.
getCurrentRow()
Returns the index in the result set of the current row.
getCurrentRowInCache()
Returns the index in the cache of the current row.
getNumPacketsInCache()
Returns the number of packets currently in the cache.
getNumRowsInCache()
Returns the number of rows currently in the cache.
isEnd()
Returns true if the currentRow is the last row in the result set and no more rows can be fetched.
isMaxRowsReached()
Returns true if the number of rows in the result set is equal to the maximum size of the result set.
isRowLocked()
Returns true if the current row is locked in the database.
lastRow()
Applies any changes in the current row to the database, and then makes the last row in the result set the current row.
lockRow()
Locks the current row in the database.
newRow(boolean)
Applies any changes in the current row to the database, and then inserts a new row making it the current row.
nextPacket()
Fetches the next packet from the database into the result set.
nextRow()
Applies any changes in the current row to the database, and then makes the next row in the result set the current row.
previousRow()
Applies any changes in the current row to the database, and then makes the previous row in the result set the current row.
removePropertyChangeListener(PropertyChangeListener)
Removes the PropertyChangeListener.
removeStatementResultValueChangeListener(StatementResultValueChangeListener)
Removes the StatementResultValueChangeListener.
restoreRow()
Restores a row's column values to those last known to be in the database.
setColumnValue(int, Object)
Sets (in the result set) the value of the column at the specified index in the current row.
setColumnValue(String, Object)
Sets (in the result set) the value of the column with the specified name in the current row.
setColumnValueFromString(int, String)
Sets (in the result set) the value of the column at the specified index in the current row.
setColumnValueFromString(String, String)
Sets (in the result set) the value of the column with the specified name in the current row.
setCurrentRow(int)
Applies any changes in the current row to the database, and then makes the specified row in the result set the current row.
setStatement(SelectStatement)
Associates a SelectStatement with this SelectResult.
unlockRow()
Unlocks the current row.
updateRow()
Updates the database with the values of the current row in the result set.

Constructors

SelectResult
 public SelectResult()
Constructs a new SelectResult. A SelectResult must always be associated with a SelectStatement. If you use this constructor, you must invoke setStatement to associate a SelectStatement with this SelectResult.

SelectResult
 public SelectResult(SelectStatement aStatement)
Constructs a new SelectResult and associates it with the specified SelectStatement.

Parameters:
aStatement - the associated SelectStatement

Methods

addPropertyChangeListener
 public synchronized void addPropertyChangeListener(PropertyChangeListener listener)
Adds the PropertyChangeListener. PropertyChange events occur when the bound properties, currentRow and currentRowInCache are changed.

Parameters:
newListener - PropertyChangeListener
See Also:
removePropertyChangeListener
addStatementResultValueChangeListener
 public void addStatementResultValueChangeListener(StatementResultValueChangeListener newListener)
Adds the StatementResultValueChangeListener. StatementResultValueChange events occur when the values in the result set are changed.

Parameters:
newListener - StatementResultValueChangeListener
See Also:
StatementResultValueChangeListener, removeStatementResultValueChangeListener
close
 public synchronized 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. This class performs more error checking then the method in the base class.

This method is automatically called when a SelectResult is garbage-collected.

The events aboutToClose and closed are triggered by this method.

Throws: DataException
noStatement - if no SelectStatement associated with this SelectResult
Throws: DataException
notExecuted - if associated statement has not been executed
Throws: DataException
notOpen - if the result set is not open
Throws: DataException
sqlException - if a SQLException occurred
Overrides:
close in class StatementResult
columnNames
 public Enumeration columnNames() throws DataException
Returns the names of the columns of the result set. This method invokes the StatementMetaData.getColumnNames to obtain the returned value.

Returns:
enumeration containing column names
Throws: DataException
noStatement - if no SelectStatement associated with this SelectResult
Overrides:
columnNames in class StatementResult
deleteRow
 public synchronized void deleteRow() throws DataException
Deletes the current row from the result set and from the database. If the last row in the result set is deleted, the previous row becomes the current row. Otherwise, the next row becomes the current row and the index returned by the getCurrentRow method does not change.

Before the database is updated, if the row is not already locked, the lockRow method is implicitly invoked to insure that no other user has updated or deleted the row in the database. The associated StatementMetaData must have a table defined via addTable in order for this lock to be obtained. The database lock is released after the delete. To insure that your delete affects the intended row in the database, make sure that the SQL statement used to produce the result set includes columns that uniquely identify a row. For a fuller discussion of these points, see the lockRow method.

The events aboutToDeleteRow and deletedRow are triggered by this method. The event cacheRowsChanged may also be triggered.

Throws: DataException
noStatement - if no SelectStatement associated with this SelectResult
Throws: DataException
notExecuted - if associated statement has not been executed
Throws: DataException
notOpen - if the result set is not open
Throws: DataException
readOnly - if the result set is read only
Throws: DataException
noResults - if the result set is empty
Throws: DataException
rowChanged - if the current row cannot be deleted from the database because it has been modified by another user since it was fetched
Throws: DataException
rowNotFound - if the lockRows property of the associated SelectStatement is true and the new current row cannot be locked
Throws: DataException
sqlException - if a SQLException occurred
Overrides:
deleteRow in class StatementResult
See Also:
lockRow
firstRow
 public void firstRow() throws DataException
Applies any changes in the current row to the database, and then makes the first row in the result set the current row.

If the first row in the result set has been displaced from the cache, the first row still in the cache becomes the current row and an exception is thrown to notify the user that the request could not be satisfied.

If the current row should be locked ( isLockRows of the associated SelectStatement returns true), the new current row is locked in the database.

The event cacheRowsChanged may be triggered by this method.

Throws: DataException
noStatement - if no SelectStatement associated with this SelectResult
Throws: DataException
notExecuted - if associated statement has not been executed
Throws: DataException
noResults - if the result set is empty
Throws: DataException
rowChanged - if the current row cannot be updated in the database because it has been modified by another user since it was fetched
Throws: DataException
rowNotFound - if the lockRows property of the associated SelectStatement is true and the new current row cannot be locked
Throws: DataException
beforeCacheStart - if the requested row is before the start of the cache
Throws: DataException
sqlException - if a SQLException occurred
See Also:
setCurrentRow
getColumnCount
 public int getColumnCount() throws DataException
Returns the number of columns in the result set. This method invokes StatementMetaData.getColumnCount to obtain returned value.

Returns:
number of columns in the result set
Throws: DataException
noStatement - if no SelectStatement associated with this SelectResult
Overrides:
getColumnCount in class StatementResult
getColumnName
 public String getColumnName(int columnNumber) throws DataException
Returns the name of the column at the specified index. This method invokes StatementMetaData.getColumnName to obtain the returned value. The index of the first column is 1.

Parameters:
columnNumber - index of the column
Returns:
name of the column
Throws: DataException
noStatement - if no SelectStatement associated with this SelectResult
Throws: IndexOutOfBoundsException
noSuchColumn - if the column index is not defined
Overrides:
getColumnName in class StatementResult
getColumnValue
 public Object getColumnValue(int columnNumber) throws DataException
Returns the value of the column at the specified index in the current row. The index of the first column is 1.

Parameters:
columnNumber - index of the column
Returns:
value of the column
Throws: DataException
noStatement - if no SelectStatement associated with this SelectResult
Throws: DataException
notExecuted - if associated statement has not been executed
Throws: DataException
noResults - if the result set is empty
Throws: IndexOutOfBoundsException
noSuchColumn - if the column index is not defined
Overrides:
getColumnValue in class StatementResult
See Also:
setColumnValue
getColumnValue
 public Object getColumnValue(String columnName) throws DataException
Returns the value of the column with the specified name in the current row.

Parameters:
columnName - name of the column
Returns:
value of the column
Throws: DataException
noStatement - if no SelectStatement associated with this SelectResult
Throws: DataException
notExecuted - if associated statement has not been executed
Throws: DataException
noResults - if the result set is empty
Throws: IndexOutOfBoundsException
noSuchColumn - if the column name is not defined
Overrides:
getColumnValue in class StatementResult
See Also:
setColumnValue
getColumnValueToString
 public String getColumnValueToString(int columnNumber) throws DataException
Returns the value of the column at the specified index in the current row 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.

Parameters:
columnNumber - index of the column
Returns:
value of the column as a String.
Throws: DataException
noStatement - if no SelectStatement associated with this SelectResult
Throws: DataException
notExecuted - if associated statement has not been executed
Throws: DataException
noResults - if the result set is empty
Throws: IndexOutOfBoundsException
noSuchColumn - if the column index is not defined
Overrides:
getColumnValueToString in class StatementResult
See Also:
setColumnValueFromString
getColumnValueToString
 public String getColumnValueToString(String columnName) throws DataException
Returns the value of the column with the specified name in the current row 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.

Parameters:
columnName - name of the column
Returns:
value of the column as a String.
Throws: DataException
noStatement - if no SelectStatement associated with this SelectResult
Throws: DataException
notExecuted - if associated statement has not been executed
Throws: DataException
noResults - if the result set is empty
Throws: IndexOutOfBoundsException
noSuchColumn - if the column name is not defined
Overrides:
getColumnValueToString in class StatementResult
See Also:
setColumnValueFromString
getCurrentRow
 public int getCurrentRow()
Returns the index in the result set of the current row. The index of the first row is 1.

Most methods on SelectResult operate on the current row.

Returns:
index of the current row
See Also:
setCurrentRow
getCurrentRowInCache
 public int getCurrentRowInCache()
Returns the index in the cache of the current row. The index of the first row in the cache is 1.

The value of currentRowInCache and currentRow will be the same unless you are using the large result set support and a packet has been displaced from the cache. For example, if a packet of 10 rows has been displaced from the cache and the currentRow is 11, the currentRowInCache would be 1.

Returns:
index of the current row
getNumPacketsInCache
 public int getNumPacketsInCache()
Returns the number of packets currently in the cache.

Returns:
the number of packets in the cache
getNumRowsInCache
 public int getNumRowsInCache()
Returns the number of rows currently in the cache.

Returns:
the number of rows in cache
isEnd
 public boolean isEnd()
Returns true if the currentRow is the last row in the result set and no more rows can be fetched. No more rows can be fetched if any of the following conditions is true: all rows have been fetched from the database, the maxRows limit has been reached, or the result set has been closed.

Returns:
true if the currentRow is the last row in the result set and no more rows can be fetched
See Also:
isOpen, isMaxRowsReached
isMaxRowsReached
 public boolean isMaxRowsReached() throws DataException
Returns true if the number of rows in the result set is equal to the maximum size of the result set.

Returns:
true if the number of rows in the result set is equal to the maximum size of the result set, otherwise false.
Throws: DataException
noStatement - if no SelectStatement associated with this SelectResult
See Also:
setMaximumRows
isRowLocked
 public boolean isRowLocked()
Returns true if the current row is locked in the database.

Returns:
true if the current row is locked in the database
See Also:
lockRow, unlockRow
lastRow
 public synchronized void lastRow() throws DataException
Applies any changes in the current row to the database, and then makes the last row in the result set the current row. If more rows can be fetched from the database they are fetched before making the last row current. For a discussion of when more rows can be fetched, see the isEnd method.

If the current row should be locked ( isLockRows of the associated SelectStatement returns true), the new current row is locked in the database.

The event cacheRowsChanged is triggered by this method.

Throws: DataException
noStatement - if no SelectStatement associated with this SelectResult
Throws: DataException
notExecuted - if associated statement has not been executed
Throws: DataException
noResults - if the result set is empty
Throws: DataException
rowChanged - if the current row cannot be updated in the database because it has been modified by another user since it was fetched
Throws: DataException
rowNotFound - if the lockRows property of the associated SelectStatement is true and the new current row cannot be locked
Throws: DataException
sqlException - if a SQLException occurred
See Also:
setCurrentRow
lockRow
 public synchronized void lockRow() throws DataException
Locks the current row in the database. No updates can be made to this row by another user until the lock is released. The lock is automatically released when you move to another row. You can release the lock without moving to another row by invoking the unlockRow method.

The row is locked by opening a database cursor using a SELECT statement whose WHERE clause should identify the one row whose column values are those last known to this result set. If the row has been updated in the database by another user, it will not be identified, and you cannot obtain the lock. An exception is thrown in this case. The associated StatementMetaData must have a table defined via addTable in order for this SELECT statement to be generated.

To insure that no more than one row is identified, make sure the SELECT statement associated with this result set includes columns that uniquely identify a row. If more than one row is identified, more than one row is locked. Furthermore, a subsequent updateRow or deleteRow will affect one of the locked rows, but it is unpredictable whether this is the one you intended. This situation cannot be detected, and no exception is thrown.

Throws: DataException
noStatement - if no SelectStatement associated with this SelectResult
Throws: DataException
notExecuted - if associated statement has not been executed
Throws: DataException
noResults - if the result set is empty
Throws: DataException
readOnly - if the result set is read only
Throws: DataException
notOpen - if the result set is not open
Throws: DataException
rowNotFound - if the current row cannot be locked in the database because it has been modified by another user since it was fetched
Throws: DataException
rowNotInDatabase - if the current row cannot be locked in the database because it has not yet been written to the database
Throws: DataException
sqlException - if a SQLException occurred
See Also:
unlockRow
newRow
 public synchronized void newRow(boolean beforeCurrent) throws DataException
Applies any changes in the current row to the database, and then inserts a new row making it the current row. Use the setColumnValue method to set values for its columns. The new row is not inserted into the database until you move to another row or invoke the updateRow method.

The events aboutToAddNewRow, addedNewRow, and cacheRowsChanged are triggered by this method.

Parameters:
beforeCurrent - true, insert the new row before the current row; false insert the new row after the current row.
Throws: DataException
noStatement - if no SelectStatement associated with this SelectResult
Throws: DataException
notExecuted - if associated statement has not been executed
Throws: DataException
readOnly - if the result set is read only
Throws: DataException
notOpen - if the result set is not open
Throws: DataException
maxSize - if the maximum number of rows in the result set has been reached
Throws: DataException
rowChanged - if the current row cannot be updated in the database because it has been modified by another user since it was fetched
nextPacket
 public synchronized void nextPacket() throws DataException
Fetches the next packet from the database into the result set. If this causes the current row to be displaced from the cache any changes in the current row are first applied to the database, and then the first row in the cache becomes the current row.

The event cacheRowsChanged is triggered by this method.

Throws: DataException
noStatement - if no SelectStatement associated with this SelectResult
Throws: DataException
notExecuted - if associated statement has not been executed
Throws: DataException
noResults - if the result set is empty
Throws: DataException
notOpen - if the result set is not open
Throws: DataException
rowChanged - if the current row cannot be updated in the database because it has been modified by another user since it was fetched
Throws: DataException
rowNotFound - if the lockRows property of the associated SelectStatement is true and the new current row cannot be locked
Throws: DataException
sqlException - if a SQLException occurred
nextRow
 public void nextRow() throws DataException
Applies any changes in the current row to the database, and then makes the next row in the result set the current row.

If the next row has not already been fetched from the database, it is fetched, along with any other rows in the next packet. If no more rows can be fetched, the last row remains the current row, and no exception is thrown. Thus, if you are at the end of the result set, repeatedly invoking this method has no effect. For a discussion of when no more rows can be fetched, see the isEnd method.

If the current row should be locked ( isLockRows of the associated SelectStatement returns true), the new current row is locked in the database.

The event cacheRowsChanged is triggered by this method.

Throws: DataException
noStatement - if no SelectStatement associated with this SelectResult
Throws: DataException
notExecuted - if associated statement has not been executed
Throws: DataException
noResults - if the result set is empty
Throws: DataException
rowChanged - if the current row cannot be updated in the database because it has been modified by another user since it was fetched
Throws: DataException
rowNotFound - if the lockRows property of the associated SelectStatement is true and the new current row cannot be locked
Throws: DataException
sqlException - if a SQLException occurred
See Also:
setCurrentRow
previousRow
 public void previousRow() throws DataException
Applies any changes in the current row to the database, and then makes the previous row in the result set the current row.

If you are already on the first row, it remains the current row, and no exception is thrown. Thus, if you are at the beginning of the result set, repeatedly invoking this method has no effect.

If the previous row has been displaced from the cache, the first row in the cache remains the current row and an exception is thrown to notify the user that the request could not be satisfied.

If the current row should be locked ( isLockRows of the associated SelectStatement returns true), the new current row is locked in the database.

Throws: DataException
noStatement - if no SelectStatement associated with this SelectResult
Throws: DataException
notExecuted - if associated statement has not been executed
Throws: DataException
noResults - if the result set is empty
Throws: DataException
rowChanged - if the current row cannot be updated in the database because it has been modified by another user since it was fetched
Throws: DataException
rowNotFound - if the lockRows property of the associated SelectStatement is true and the new current row cannot be locked
Throws: DataException
beforeCacheStart - if the requested row is before the start of the cache
Throws: DataException
sqlException - if a SQLException occurred
See Also:
setCurrentRow
removePropertyChangeListener
 public synchronized void removePropertyChangeListener(PropertyChangeListener listener)
Removes the PropertyChangeListener. PropertyChange events occur when the bound properties, currentRow and currentRowInCache are changed.

Parameters:
newListener - PropertyChangeListener
See Also:
addPropertyChangeListener
removeStatementResultValueChangeListener
 public void removeStatementResultValueChangeListener(StatementResultValueChangeListener newListener)
Removes the StatementResultValueChangeListener. StatementResultValueChange events occur when the values in the result set are changed.

Parameters:
newListener - StatementResultValueChangeListener
See Also:
StatementResultValueChangeListener, addStatementResultValueChangeListener
restoreRow
 public void restoreRow() throws DataException
Restores a row's column values to those last known to be in the database. Use this method when an attempt to lock a row, write a row in the database, or delete a row from the database failed. This can occur implicitly when you try to move to another row. When one of these failures has occurred, you cannot move to another row until you either correct the problem or use this method.

If the current row was added via the newRow method, its column values are reset to nulls. Otherwise, its column values are reset to the the values originally fetched from the database or the values to which it was last successfully updated.

If you believe the failure that occurred is correctible by changing one or more of column values, as for example if the failure was due to a duplicate key value in the database, you can just change the values and try the operation again instead of using this method.

The events aboutToSetColumnValue and columnValueSet are triggered by this method.

Throws: DataException
noStatement - if no SelectStatement associated with this SelectResult
Throws: DataException
notExecuted - if associated statement has not been executed
Throws: DataException
noResults - if the result set is empty
Throws: DataException
readOnly - if the result set is read only
Overrides:
restoreRow in class StatementResult
setColumnValue
 public synchronized void setColumnValue(int columnNumber,
                                         Object aValue) throws DataException
Sets (in the result set) the value of the column at the specified index in the current row. The index of the first column is 1.

The column value is not updated in the database until you move to another row or invoke the updateRow method.

The events aboutToSetColumnValue and columnValueSet are triggered by this method.

Parameters:
columnNumber - index of the column
aValue - value for the column
Throws: DataException
noStatement - if no SelectStatement associated with this SelectResult
Throws: DataException
notExecuted - if associated statement has not been executed
Throws: DataException
notOpen - if the result set is not open
Throws: DataException
readOnly - if the result set is read only
Throws: DataException
noResults - if the result set is empty
Throws: IndexOutOfBoundsException
noSuchColumn - if the column index is not defined
Throws: DataException
wrongObjectType - if the value does match the object type of the column
Overrides:
setColumnValue in class StatementResult
See Also:
getColumnValue
setColumnValue
 public void setColumnValue(String columnName,
                            Object aValue) throws DataException
Sets (in the result set) the value of the column with the specified name in the current row.

The column value is not updated in the database until you move to another row or invoke the updateRow method.

The events aboutToSetColumnValue and columnValueSet are triggered by this method.

Parameters:
columnName - name of the column
aValue - value for the column
Throws: DataException
noStatement - if no SelectStatement associated with this SelectResult
Throws: DataException
notExecuted - if associated statement has not been executed
Throws: DataException
notOpen - if the result set is not open
Throws: DataException
readOnly - if the result set is read only
Throws: DataException
noResults - if the result set is empty
Throws: IndexOutOfBoundsException
noSuchColumn - if the column name is not defined
Throws: DataException
wrongObjectType - if the value does match the object type of the column
Overrides:
setColumnValue in class StatementResult
See Also:
getColumnValue
setColumnValueFromString
 public void setColumnValueFromString(int columnNumber,
                                      String stringValue) throws DataException
Sets (in the result set) the value of the column at the specified index in the current row. The index of the first column is 1.

The stringValue parameter is converted to the datatype associated with the column before the value is set.

The column value is not updated in the database until you move to another row or invoke the updateRow method.

The events aboutToSetColumnValue and columnValueSet are triggered by this method.

Parameters:
columnNumber - index of the column
stringValue - value for the column
Throws: DataException
noStatement - if no SelectStatement associated with this SelectResult
Throws: DataException
notExecuted - if associated statement has not been executed
Throws: DataException
notOpen - if the result set is not open
Throws: DataException
readOnly - if the result set is read only
Throws: DataException
noResults - if the result set is empty
Throws: IndexOutOfBoundsException
noSuchColumn - if the column index is not defined
Throws: DataException
cannotConvert - if cannot convert to object type of column of the column
Overrides:
setColumnValueFromString in class StatementResult
See Also:
getColumnValueToString
setColumnValueFromString
 public void setColumnValueFromString(String columnName,
                                      String stringValue) throws DataException
Sets (in the result set) the value of the column with the specified name in the current row. The index of the first column is 1.

The stringValue parameter is converted to the datatype associated with the column before the value is set.

The column value is not updated in the database until you move to another row or invoke the updateRow method.

The events aboutToSetColumnValue and columnValueSet are triggered by this method.

Parameters:
columnName - name of the column
stringValue - value for the column
Throws: DataException
noStatement - if no SelectStatement associated with this SelectResult
Throws: DataException
notExecuted - if associated statement has not been executed
Throws: DataException
notOpen - if the result set is not open
Throws: DataException
readOnly - if the result set is read only
Throws: DataException
noResults - if the result set is empty
Throws: IndexOutOfBoundsException
noSuchColumn - if the column name is not defined
Throws: DataException
cannotConvert - if cannot convert to object type of column
Overrides:
setColumnValueFromString in class StatementResult
See Also:
getColumnValueToString
setCurrentRow
 public void setCurrentRow(int rowNumber) throws DataException
Applies any changes in the current row to the database, and then makes the specified row in the result set the current row.

If the specified row has not yet been fetched, packets are fetched until the specified row is in the cache or no more rows can be fetched. If no more rows can be fetched, and the specified row was not reached, the last row becomes the current row and an exception is thrown to notify the user that the request could not be satisfied. For a discussion of when no more rows can be fetched, see the isEnd method.

If the specified row has been displaced from the cache, the first row in the cache becomes the current row and an exception is thrown to notify the user that the request could not be satisfied.

If the current row should be locked ( isLockRows of the associated SelectStatement returns true), the new current row is locked in the database.

The event cacheRowsChanged is triggered by this method.

Parameters:
rowNumber - index in the result set of the row
Throws: DataException
noStatement - if no SelectStatement associated with this SelectResult
Throws: DataException
notExecuted - if associated statement has not been executed
Throws: DataException
noResults - if the result set is empty
Throws: DataException
rowChanged - if the current row cannot be updated in the database because it has been modified by another user since it was fetched
Throws: DataException
rowNotFound - if the lockRows property of the associated SelectStatement is true and the new current row cannot be locked
Throws: DataException
beforeCacheStart - if the requested row is before the start of the cache
Throws: DataException
indexTooLarge - if the requested row is after the end of the result set
Throws: DataException
sqlException - if a SQLException occurred
See Also:
getCurrentRow
setStatement
 public void setStatement(SelectStatement aStatement)
Associates a SelectStatement with this SelectResult.

Parameters:
aStatement - the associated SelectStatement
unlockRow
 public void unlockRow() throws DataException
Unlocks the current row. The database lock on the current row is released.

Throws: DataException
noStatement - if no SelectStatement associated with this SelectResult
Throws: DataException
notExecuted - if associated statement has not been executed
Throws: DataException
noResults - if the result set is empty
Throws: DataException
readOnly - if the result set is read only
Throws: DataException
notOpen - if the result set is not open
Throws: DataException
sqlException - if a SQLException occurred
See Also:
lockRow
updateRow
 public synchronized void updateRow() throws DataException
Updates the database with the values of the current row in the result set. If the current row is a new row, it is INSERTed into the database. If it is an existing row, it is UPDATEd in the database.

For an existing row, before the database is updated, if the row is not already locked, the LockRow method is implicitly invoked to insure that no other user has updated or deleted the row in the database. The associated StatementMetaData must have a table defined via addTable in order for this lock to be obtained. The database lock is released after the update unless the lockRows property of the associated SelectStatement is true. To insure that your update affects the intended row in the database, make sure that the associated SelectStatement includes columns that uniquely identify a row. See the lockRow method for a fuller discussion of these points.

The events aboutToUpdateRow and updatedRow are triggered by this method.

Throws: DataException
noStatement - if no SelectStatement associated with this SelectResult
Throws: DataException
notExecuted - if associated statement has not been executed
Throws: DataException
noResults - if the result set is empty
Throws: DataException
readOnly - if the result set is read only
Throws: DataException
notOpen - if the result set is not open
Throws: DataException
rowChanged - if the current row cannot be updated in the database because it has been modified by another user since it was fetched
Throws: DataException
sqlException - if a SQLException occurred
Overrides:
updateRow in class StatementResult

Where Am I? Class Hierarchy All Classes All Fields and Methods