Home >Database >Mysql Tutorial >What methods does ResultSet provide for browsing it in JDBC?
We have two types of ResultSet objects namely forward only and bidirectional, as the name suggests in forward only ResultSet you can move only in one direction (forward) whereas in In a bidirectional ResultSet you can move the pointer in both directions. The ResultSet interface provides multiple methods for browsing both types of ResultSet objects.
The following table lists the various methods for browsing ResultSet objects.
Method | Description |
---|---|
##next() | This method moves the result set pointer forward one row.Previous() | This method moves the result set pointer backward one row.
first() | This method moves the result set pointer to the first row.|
relative() | This method accepts an integer value representing the number of rows and advances the result set pointer or moves a given number of rows backward (positive integers move forward, negative integers move backward).|
absolute() | This method accepts a row of integer values representing numbers and moves the result set pointer to The given position in the result set (based on 1).If a positive integer is passed to the result set, the pointer will be moved to the given position starting from the first row of the result set. If a negative integer is passed to the result set, the pointer will be moved to the given position starting from the last one in the result set. | tr>
beforeFirst() | This method moves the result set pointer to its default position, which is before first.
|
afterLast() | This method positions the result set pointer after the last row.
The above is the detailed content of What methods does ResultSet provide for browsing it in JDBC?. For more information, please follow other related articles on the PHP Chinese website!