Difference between revisions of "Documentation/DevGuide/Database/Moving the Result Set Cursor"
m (1 revision(s)) |
m |
||
Line 27: | Line 27: | ||
The interface <idl>com.sun.star.sdbc.XResultSet</idl> 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: | The interface <idl>com.sun.star.sdbc.XResultSet</idl> 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: | ||
− | + | <source lang="idl"> | |
// move one row at a time | // move one row at a time | ||
boolean next() | boolean next() | ||
Line 60: | Line 60: | ||
com::sun::star::uno::XInterface getStatement() | com::sun::star::uno::XInterface getStatement() | ||
− | + | </source> | |
{{Documentation/Note|Note that you can only move the cursor backwards if you set the statement property <tt>ResultSetType</tt> to <tt>SCROLL_INSENSITIVE</tt> or <tt>SCROLL_SENSITIVE</tt>. For details, refer to chapter [[Documentation/DevGuide/Database/Scrollable Result Sets|Scrollable Result Sets]].}} | {{Documentation/Note|Note that you can only move the cursor backwards if you set the statement property <tt>ResultSetType</tt> to <tt>SCROLL_INSENSITIVE</tt> or <tt>SCROLL_SENSITIVE</tt>. For details, refer to chapter [[Documentation/DevGuide/Database/Scrollable Result Sets|Scrollable Result Sets]].}} | ||
{{PDL1}} | {{PDL1}} | ||
[[Category: Database Access]] | [[Category: Database Access]] |
Revision as of 15:23, 31 May 2008
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()
Content on this page is licensed under the Public Documentation License (PDL). |