|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.garret.consus.TableIterator
An Iterator through the table records (is equivalent to ResultSet for a single table select without condition, but is more efficient).
Constructor Summary | |
---|---|
TableIterator()
|
Method Summary | |
---|---|
abstract boolean |
absolute(int row)
Moves the cursor to the given row number in the resultset. |
abstract void |
afterLast()
Moves the cursor to the end of the resultset, just after the last row. |
abstract void |
beforeFirst()
Moves the cursor to the front of the resultset, just before the first row. |
abstract void |
close()
Closes the iterator and releases all related resourses. |
abstract void |
deleteAllSelectedRows()
Deletes all records in the table. |
abstract void |
deleteRow()
Deletes the current row from the resultset and the underlying database. |
abstract boolean |
first()
Moves the cursor to the first row in the resultset. |
abstract java.lang.Object |
get()
Fetch the current table row as a Java object. |
abstract int |
getNumberOfRows()
Get the number of rows in the table. |
abstract int |
getRow()
Retrieves the current row number. |
abstract boolean |
isAfterLast()
Indicates whether the cursor is after the last row in the resultset. |
abstract boolean |
isBeforeFirst()
Indicates whether the cursor is before the first row in the resultset. |
abstract boolean |
isFirst()
Indicates whether the cursor is on the first row of the resultset. |
abstract boolean |
isLast()
Indicates whether the cursor is on the last row of the resultset. |
abstract boolean |
last()
Moves the cursor to the last row in the resultset. |
abstract boolean |
next()
Moves the cursor down one row from its current position. |
abstract boolean |
previous()
Moves the cursor to the previous row in the result set. |
abstract boolean |
relative(int rows)
Moves the cursor a relative number of rows, either positive or negative. |
abstract java.lang.Object |
selectByKey(java.lang.String keyName,
java.lang.String keyValue)
Select an object from the table using a unique key. |
abstract java.lang.Object |
selectByOid(long oid)
Select an object from the table using an object identifier. |
java.lang.Object[] |
toArray()
Returns an array of java.lang.Object objects, containing all the selected elements. |
java.lang.Object[] |
toArray(java.lang.Object[] a)
Returns an array containing all of the selected elements. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TableIterator()
Method Detail |
---|
public abstract boolean absolute(int row) throws java.sql.SQLException
Moves the cursor to the given row number in the resultset.
If the row number is positive, the cursor moves to the given row number with respect to the beginning of the resultset. The first row is row 1, the second is row 2, and so on.
If the given row number is negative, the cursor moves to
an absolute row position with respect to
the end of the resultset. For example, calling
absolute(-1)
positions the
cursor on the last row, absolute(-2)
indicates the next-to-last
row, and so on.
An attempt to position the cursor beyond the first or last row in the resultset leaves the cursor before or after the first or last row, respectively.
Note: Calling absolute(1)
is the same
as calling first()
.
Calling absolute(-1)
is the same as calling last()
.
java.sql.SQLException
- if a database access error occurs or
row is 0, or result set type is TYPE_FORWARD_ONLY.public abstract void afterLast() throws java.sql.SQLException
Moves the cursor to the end of the resultset, just after the last row. Has no effect if the resultset contains no rows.
java.sql.SQLException
- if a database access error occurs or the
result set type is TYPE_FORWARD_ONLYpublic abstract void beforeFirst() throws java.sql.SQLException
Moves the cursor to the front of the resultset, just before the first row. Has no effect if the resultset contains no rows.
java.sql.SQLException
- if a database access error occurs or the
result set type is TYPE_FORWARD_ONLYpublic abstract void close() throws java.sql.SQLException
java.sql.SQLException
public abstract void deleteAllSelectedRows() throws java.sql.SQLException
java.sql.SQLException
- if a database access error occurs or if
called when on the insert row.public abstract void deleteRow() throws java.sql.SQLException
java.sql.SQLException
- if a database access error occurs or if
called when on the insert row.public abstract boolean first() throws java.sql.SQLException
Moves the cursor to the first row in the resultset.
java.sql.SQLException
- if a database access error occurs or the
result set type is TYPE_FORWARD_ONLYpublic abstract java.lang.Object get() throws java.sql.SQLException
java.sql.SQLException
public abstract int getNumberOfRows() throws java.sql.SQLException
java.sql.SQLException
public abstract int getRow() throws java.sql.SQLException
Retrieves the current row number. The first row is number 1, the second number 2, and so on.
java.sql.SQLException
- if a database access error occurspublic abstract boolean isAfterLast() throws java.sql.SQLException
Indicates whether the cursor is after the last row in the resultset.
java.sql.SQLException
- if a database access error occurspublic abstract boolean isBeforeFirst() throws java.sql.SQLException
Indicates whether the cursor is before the first row in the resultset.
java.sql.SQLException
- if a database access error occurspublic abstract boolean isFirst() throws java.sql.SQLException
Indicates whether the cursor is on the first row of the resultset.
java.sql.SQLException
- if a database access error occurspublic abstract boolean isLast() throws java.sql.SQLException
Indicates whether the cursor is on the last row of the resultset.
java.sql.SQLException
- if a database access error occurspublic abstract boolean last() throws java.sql.SQLException
Moves the cursor to the last row in the resultset.
java.sql.SQLException
- if a database access error occurs or the
result set type is TYPE_FORWARD_ONLY.public abstract boolean next() throws java.sql.SQLException
java.sql.SQLException
- if a database access error occurspublic abstract boolean previous() throws java.sql.SQLException
Moves the cursor to the previous row in the result set.
Note: previous()
is not the same as
relative(-1)
because it
makes sense to callprevious() when there is no current row.
java.sql.SQLException
- if a database access error occurs or the
result set type is TYPE_FORWARD_ONLYpublic abstract boolean relative(int rows) throws java.sql.SQLException
Moves the cursor a relative number of rows, either positive or negative.
Attempting to move beyond the first or last row in the
result set positions the cursor before or after the
the first or last row. Calling relative(0)
is valid, but does
not change the cursors position.
Note: Calling relative(1)
is different from calling next()
because it makes sense to call next()
when there is no current row,
for example, when the cursor is positioned before the first row
or after the last row of the resultset.
java.sql.SQLException
- if a database access error occurs, there
is no current row, or the result set type is TYPE_FORWARD_ONLYpublic abstract java.lang.Object selectByKey(java.lang.String keyName, java.lang.String keyValue) throws java.sql.SQLException
keyName
- table column with a unique keykeyValue
- value of the key to look for
null
otherwise
ConsusRuntimeException
- when there is no such column in the table or
it is not indexed; ConsusNotUniqueException when the key is not unique
java.sql.SQLException
public abstract java.lang.Object selectByOid(long oid) throws java.sql.SQLException
oid
- object identifier
java.sql.SQLException
public java.lang.Object[] toArray() throws java.sql.SQLException
java.sql.SQLException
public java.lang.Object[] toArray(java.lang.Object[] a) throws java.sql.SQLException
If the list fits into the specified array with room to spare (i.e. the array has more elements than the selection), the element in the array immediately following the end of the collection is set to null.
java.sql.SQLException
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |