ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzaha_5.4.0.1/rsltcurs.htm

141 lines
9.2 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="concept" />
<meta name="DC.Title" content="Cursor movement" />
<meta name="abstract" content="The iSeries Java Database Connectivity (JDBC) drivers support scrollable ResultSets. With a scrollable ResultSet, you can process rows of data in any order using a number of cursor-positioning methods." />
<meta name="description" content="The iSeries Java Database Connectivity (JDBC) drivers support scrollable ResultSets. With a scrollable ResultSet, you can process rows of data in any order using a number of cursor-positioning methods." />
<meta name="DC.Relation" scheme="URI" content="rsltsets.htm" />
<meta name="DC.Relation" scheme="URI" content="rsltchar.htm" />
<meta name="DC.Relation" scheme="URI" content="rsltdata.htm" />
<meta name="DC.Relation" scheme="URI" content="rsltchng.htm" />
<meta name="DC.Relation" scheme="URI" content="rsltclse.htm" />
<meta name="DC.Relation" scheme="URI" content="resultex.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="rsltcurs" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>Cursor movement</title>
</head>
<body id="rsltcurs"><a name="rsltcurs"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Cursor movement</h1>
<div><p>The iSeries™ Java™ Database
Connectivity (JDBC) drivers support scrollable ResultSets. With a scrollable
ResultSet, you can process rows of data in any order using a number of cursor-positioning
methods.</p>
<p>The ResultSet.next method is used to move through a ResultSet one row at
a time. With Java Database Connectivity (JDBC) 2.0, the iSeries JDBC
drivers support scrollable ResultSets. Scrollable ResultSets allow processing
the rows of data in any order by using the previous, absolute, relative, first,
and last methods.</p>
<p>By default, JDBC ResultSets are always forward only, meaning that the only
valid cursor-positioning method to call is next(). You have to explicitly
request a scrollable ResultSet. See <a href="rsltchar.htm">ResultSet types</a> for
more information.</p>
<p>With a scrollable ResultSet, you can use the following cursor-positioning
methods:</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="100%" frame="border" border="1" rules="all"><thead align="left"><tr><th align="left" valign="top" width="16.666666666666664%" id="d0e39">Method</th>
<th align="left" valign="top" width="83.33333333333334%" id="d0e41">Description</th>
</tr>
</thead>
<tbody><tr><td valign="top" width="16.666666666666664%" headers="d0e39 ">Next</td>
<td valign="top" width="83.33333333333334%" headers="d0e41 ">This method moves the cursor forward one row in the ResultSet. <p>The
method returns true if the cursor is positioned on a valid row and false otherwise.</p>
</td>
</tr>
<tr><td valign="top" width="16.666666666666664%" headers="d0e39 ">Previous</td>
<td valign="top" width="83.33333333333334%" headers="d0e41 ">The method moves the cursor backward one row in the ResultSet. <p>The
method returns true if the cursor is positioned on a valid row and false otherwise.</p>
</td>
</tr>
<tr><td valign="top" width="16.666666666666664%" headers="d0e39 ">First</td>
<td valign="top" width="83.33333333333334%" headers="d0e41 ">The method moves the cursor to the first row in the ResultSet. <p>The
method returns true if the cursor is positioned on the first row and false
if the ResultSet is empty.</p>
</td>
</tr>
<tr><td valign="top" width="16.666666666666664%" headers="d0e39 ">Last</td>
<td valign="top" width="83.33333333333334%" headers="d0e41 ">The method moves the cursor to the last row in the ResultSet. <p>The
method returns true if the cursor is positioned on the last row and false
if the ResultSet is empty.</p>
</td>
</tr>
<tr><td valign="top" width="16.666666666666664%" headers="d0e39 ">BeforeFirst</td>
<td valign="top" width="83.33333333333334%" headers="d0e41 ">The method moves the cursor immediately before the first row in the
ResultSet. <p>For an empty ResultSet, this method has no effect. There is
no return value from this method.</p>
</td>
</tr>
<tr><td valign="top" width="16.666666666666664%" headers="d0e39 ">AfterLast</td>
<td valign="top" width="83.33333333333334%" headers="d0e41 ">The method moves the cursor immediately after the last row in the ResultSet. <p>For
an empty ResultSet, this method has no effect. There is no return value from
this method.</p>
</td>
</tr>
<tr><td valign="top" width="16.666666666666664%" headers="d0e39 ">Relative (int rows)</td>
<td valign="top" width="83.33333333333334%" headers="d0e41 ">The method moves the cursor relative to its current position. <ul><li>If rows is 0, this method has no effect.</li>
<li>If rows is positive, the cursor is moved forward that many rows. If there
are fewer rows between the current position and the end of the ResultSet than
specified by the input parameters, this method operates like afterLast.</li>
<li>If rows is negative, the cursor is moved backward that many rows. If there
are fewer rows between the current position and the end of the ResultSet than
specified by the input parameter, this method operates like beforeFirst.</li>
</ul>
<p>The method returns true if the cursor in positioned on a valid row
and false otherwise.</p>
</td>
</tr>
<tr><td valign="top" width="16.666666666666664%" headers="d0e39 ">Absolute (int row)</td>
<td valign="top" width="83.33333333333334%" headers="d0e41 ">The method moves the cursor to the row specified by row value. <p>If
row value is positive, the cursor is positioned that many rows from the beginning
of the ResultSet. The first row is numbered 1, the second is 2, and so on.
If there are fewer rows in the ResultSet than specified by the row value,
this method operates the same way as afterLast.</p>
<p>If row value is negative,
the cursor is positioned that many rows from the end of the ResultSet. The
last row is numbered -1, the second to last is -2, and so on. If there are
fewer rows in the ResultSet than specified by the row value, this method operates
the same way beforeFirst.</p>
<p>If row value is 0, this method operates
the same way as beforeFirst.</p>
<p>The method returns true if the cursor
is positioned on a valid row and false otherwise.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rsltsets.htm" title="The ResultSet interface provides access to the results generated by running queries. Conceptually, data of a ResultSet can be thought of as a table with a specific number of columns and a specific number of rows. By default, the table rows are retrieved in sequence. Within a row, column values can be accessed in any order.">ResultSets</a></div>
</div>
<div class="relconcepts"><strong>Related concepts</strong><br />
<div><a href="rsltchar.htm" title="This topic discusses ResultSet characteristics such ResultSet types, concurrency, ability to close the ResultSet by committing the connection object, and specification of ResultSet characteristics.">ResultSet characteristics</a></div>
<div><a href="rsltdata.htm" title="The ResultSet object provides several methods for obtaining column data for a row. All are of the form get&lt;Type&gt;, where &lt;Type&gt; is a Java data type. Some examples of these methods include getInt, getLong, getString, getTimestamp, and getBlob. Nearly all of these methods take a single parameter that is either the column index within the ResultSet or the column name.">Retrieve ResultSet data</a></div>
<div><a href="rsltclse.htm" title="To create a ResultSet object, you can use executeQuery methods, or other methods. This article describes options for creating ResultSets.">Create ResultSets</a></div>
</div>
<div class="reltasks"><strong>Related tasks</strong><br />
<div><a href="rsltchng.htm" title="With the iSeries JDBC drivers, you can change ResultSets by performing several tasks.">Change ResultSets</a></div>
</div>
<div class="relref"><strong>Related reference</strong><br />
<div><a href="resultex.htm" title="This is an example of how to use the ResultSet interface.">Example: ResultSet interface for IBM Developer Kit for Java</a></div>
</div>
</div>
</body>
</html>