Moving the Result Set Cursor

From Apache OpenOffice Wiki
< Documentation‎ | DevGuide
Revision as of 12:08, 1 November 2007 by Jsc (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search



The ResultSet stored in the variable xResult contains the following data after the call above:

FIRSTNAME LASTNAME BIRTHDATE
Joseph Smith 02/07/46
Bob Meyers 09/07/49

To access the data, go to each row and retrieve the values according to their types. The method next() is used to move the row cursor from row to row. Since the cursor is initially positioned just above the first row of a ResultSet object, the first call to next() moves the cursor to the first row and makes it the current row. For the same reason, use the method next() to access the first row even if there is only one row in a result set. Subsequent invocations of next() move the cursor down one row at a time.

The interface com.sun.star.sdbc.XResultSet offers methods to move to specific row numbers, and to positions relative to the current row, in addition to moving the cursor back and forth one row at a time:

 // move one row at a time
 boolean next()
 boolean previous()
 
 // move a number of rows
 boolean absolute( [in] long row )
 boolean relative( [in] long rows )
 
 // move to result set borders and beyond
 boolean first()
 boolean last()
 void beforeFirst()
 void afterLast()
 
 //detect position
 boolean isBeforeFirst()
 boolean isAfterLast()
 boolean isFirst()
 boolean isLast()
 long getRow()
 
 // refetch row from the database
 void refreshRow()
 
 // row has been updated, inserted or deleted
 boolean rowUpdated()
 boolean rowInserted()
 boolean rowDeleted()
 
 // get the statement which created the result set
 com::sun::star::uno::XInterface getStatement()


Template:Documentation/Note

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools