Some other useful functions for reading the result set
Some functions to manipulate the ResultSet
JDBC'sResultSet methods:
click here
(too many to
discuss all of them !!!)
beforeFirst():
(use this method
to "rewind" the
result set !!!)
Moves the read cursor
to the front of this
ResultSet object, just
before the
first row.
(Use this method if you
want to re-readall the tuples in the
ResultSet objectall over again)
first():
Moves the read cursor
to the first row of this
ResultSet object
absolute(rowNumber):
Moves the read cursor
to the row rowNumber of this
ResultSet object
Note:rowNumber >= 1
If rowNumber = 1, it is the same as
first().
afterLast():
Moves the read cursor
to the end of this
ResultSet object, just
after the
last row.
(Use this method to read the
ResultSet data in the reverse
order)
last():
Moves the read cursor
to the last row of this
ResultSet object
(Use this method
--- together with getRow( ) ---
to find
the number of rows in
the ResultSet)
getRow():
Return the row index of the
current row
(Use this method --- along with
last() ---
to find
the number of rows in
the ResultSet)
How to find
the number of tuples in
the ResultSet:
int NTuples;
rset.last( ); // Move to the last tuple in result set "rset"
NTuples = rset.getRow( ); // Get index of last tuple
// = # tuples in result set "rset"
// If you want to access the tuples now,
// you will need to call: rset.beforeFirst( )
// to "rewind" the result set to the beginning.....