|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Cursor
The Cursor provides you with a way of examining a
Table
, both the ones that you create and
the ones that are created
as a result of a select or join operation. This is
an "updateable" cursor, so you can modify columns or
delete rows via the cursor without problems. (Updates
and deletes done through the cursor are handled
properly with respect to the transactioning system, so
they can be committed or rolled back.)
The class is not thread safe, however. It's a serious error for a thread to be modifying a table, either via a Cursor or directly, while another thread is examining or modifying the same table.
Modifications Since Publication of Holub on Patterns:
9/24/02 |
Added a few methods to make it possible to get
column names for the JDBC
ResultSetMetaData class.
|
This code may be used freely by yourself with the following restrictions:
|
Method Summary | |
---|---|
boolean |
advance()
Advances to the next row, or if this iterator has never been used, advances to the first row. |
Object |
column(String columnName)
Return the contents of the requested column of the current row. |
int |
columnCount()
Return the number of columns in the table that we're traversing. |
String |
columnName(int index)
Return the name of the column at the indicated index. |
Iterator |
columns()
Return a java.util.Iterator across all the columns in the current row. |
void |
delete()
Delete the row at the current cursor position. |
boolean |
isTraversing(Table t)
Return true if the iterator is traversing the indicated table. |
String |
tableName()
Metadata method required by JDBC wrapper--Return the name of the table across which we're iterating. |
Object |
update(String columnName,
Object newValue)
Replace the value of the indicated column of the current row with the indicated new value. |
Method Detail |
---|
String tableName()
boolean advance() throws NoSuchElementException
advance()
moves it to the
first row.
NoSuchElementException
- if this call would advance
past the last row.int columnCount()
String columnName(int index)
Object column(String columnName)
Table.update(com.holub.database.Selector)
.
IndexOutOfBoundsException
- --- the requested column
doesn't exist.Iterator columns()
boolean isTraversing(Table t)
Object update(String columnName, Object newValue)
IllegalArgumentException
- if the newValue is
the same as the object that's being updated.void delete()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |