📄 resultset.java
字号:
* Note: Calling the method <code>isLast</code> may be expensive * because the JDBC driver * might need to fetch ahead one row in order to determine * whether the current row is the last row in the result set. * * @return <code>true</code> if the cursor is on the last row; * <code>false</code> otherwise * @exception SQLException if a database access error occurs * @since 1.2 */ boolean isLast() throws SQLException; /** * Moves the cursor to the front of * this <code>ResultSet</code> object, just before the * first row. This method has no effect if the result set contains no rows. * * @exception SQLException if a database access error * occurs or the result set type is <code>TYPE_FORWARD_ONLY</code> * @since 1.2 */ void beforeFirst() throws SQLException; /** * Moves the cursor to the end of * this <code>ResultSet</code> object, just after the * last row. This method has no effect if the result set contains no rows. * @exception SQLException if a database access error * occurs or the result set type is <code>TYPE_FORWARD_ONLY</code> * @since 1.2 */ void afterLast() throws SQLException; /** * Moves the cursor to the first row in * this <code>ResultSet</code> object. * * @return <code>true</code> if the cursor is on a valid row; * <code>false</code> if there are no rows in the result set * @exception SQLException if a database access error * occurs or the result set type is <code>TYPE_FORWARD_ONLY</code> * @since 1.2 */ boolean first() throws SQLException; /** * Moves the cursor to the last row in * this <code>ResultSet</code> object. * * @return <code>true</code> if the cursor is on a valid row; * <code>false</code> if there are no rows in the result set * @exception SQLException if a database access error * occurs or the result set type is <code>TYPE_FORWARD_ONLY</code> * @since 1.2 */ boolean last() throws SQLException; /** * Retrieves the current row number. The first row is number 1, the * second number 2, and so on. * * @return the current row number; <code>0</code> if there is no current row * @exception SQLException if a database access error occurs * @since 1.2 */ int getRow() throws SQLException; /** * Moves the cursor to the given row number in * this <code>ResultSet</code> object. * * <p>If the row number is positive, the cursor moves to * the given row number with respect to the * beginning of the result set. The first row is row 1, the second * is row 2, and so on. * * <p>If the given row number is negative, the cursor moves to * an absolute row position with respect to * the end of the result set. For example, calling the method * <code>absolute(-1)</code> positions the * cursor on the last row; calling the method <code>absolute(-2)</code> * moves the cursor to the next-to-last row, and so on. * * <p>An attempt to position the cursor beyond the first/last row in * the result set leaves the cursor before the first row or after * the last row. * * <p><B>Note:</B> Calling <code>absolute(1)</code> is the same * as calling <code>first()</code>. Calling <code>absolute(-1)</code> * is the same as calling <code>last()</code>. * * @param row the number of the row to which the cursor should move. * A positive number indicates the row number counting from the * beginning of the result set; a negative number indicates the * row number counting from the end of the result set * @return <code>true</code> if the cursor is on the result set; * <code>false</code> otherwise * @exception SQLException if a database access error * occurs, or the result set type is <code>TYPE_FORWARD_ONLY</code> * @since 1.2 */ boolean absolute( int row ) throws SQLException; /** * Moves the cursor a relative number of rows, either positive or negative. * Attempting to move beyond the first/last row in the * result set positions the cursor before/after the * the first/last row. Calling <code>relative(0)</code> is valid, but does * not change the cursor position. * * <p>Note: Calling the method <code>relative(1)</code> * is identical to calling the method <code>next()</code> and * calling the method <code>relative(-1)</code> is identical * to calling the method <code>previous()</code>. * * @param rows an <code>int</code> specifying the number of rows to * move from the current row; a positive number moves the cursor * forward; a negative number moves the cursor backward * @return <code>true</code> if the cursor is on a row; * <code>false</code> otherwise * @exception SQLException if a database access error occurs, * there is no current row, or the result set type is * <code>TYPE_FORWARD_ONLY</code> * @since 1.2 */ boolean relative( int rows ) throws SQLException; /** * Moves the cursor to the previous row in this * <code>ResultSet</code> object. * * @return <code>true</code> if the cursor is on a valid row; * <code>false</code> if it is off the result set * @exception SQLException if a database access error * occurs or the result set type is <code>TYPE_FORWARD_ONLY</code> * @since 1.2 */ boolean previous() throws SQLException; //--------------------------------------------------------------------- // Properties //--------------------------------------------------------------------- /** * The constant indicating that the rows in a result set will be * processed in a forward direction; first-to-last. * This constant is used by the method <code>setFetchDirection</code> * as a hint to the driver, which the driver may ignore. * @since 1.2 */ int FETCH_FORWARD = 1000; /** * The constant indicating that the rows in a result set will be * processed in a reverse direction; last-to-first. * This constant is used by the method <code>setFetchDirection</code> * as a hint to the driver, which the driver may ignore. * @since 1.2 */ int FETCH_REVERSE = 1001; /** * The constant indicating that the order in which rows in a * result set will be processed is unknown. * This constant is used by the method <code>setFetchDirection</code> * as a hint to the driver, which the driver may ignore. */ int FETCH_UNKNOWN = 1002; /** * Gives a hint as to the direction in which the rows in this * <code>ResultSet</code> object will be processed. * The initial value is determined by the * <code>Statement</code> object * that produced this <code>ResultSet</code> object. * The fetch direction may be changed at any time. * * @param direction an <code>int</code> specifying the suggested * fetch direction; one of <code>ResultSet.FETCH_FORWARD</code>, * <code>ResultSet.FETCH_REVERSE</code>, or * <code>ResultSet.FETCH_UNKNOWN</code> * @exception SQLException if a database access error occurs or * the result set type is <code>TYPE_FORWARD_ONLY</code> and the fetch * direction is not <code>FETCH_FORWARD</code> * @since 1.2 * @see Statement#setFetchDirection * @see #getFetchDirection */ void setFetchDirection(int direction) throws SQLException; /** * Retrieves the fetch direction for this * <code>ResultSet</code> object. * * @return the current fetch direction for this <code>ResultSet</code> object * @exception SQLException if a database access error occurs * @since 1.2 * @see #setFetchDirection */ int getFetchDirection() throws SQLException; /** * Gives the JDBC driver a hint as to the number of rows that should * be fetched from the database when more rows are needed for this * <code>ResultSet</code> object. * If the fetch size specified is zero, the JDBC driver * ignores the value and is free to make its own best guess as to what * the fetch size should be. The default value is set by the * <code>Statement</code> object * that created the result set. The fetch size may be changed at any time. * * @param rows the number of rows to fetch * @exception SQLException if a database access error occurs or the * condition <code>0 <= rows <= Statement.getMaxRows()</code> is not satisfied * @since 1.2 * @see #getFetchSize */ void setFetchSize(int rows) throws SQLException; /** * Retrieves the fetch size for this * <code>ResultSet</code> object. * * @return the current fetch size for this <code>ResultSet</code> object * @exception SQLException if a database access error occurs * @since 1.2 * @see #setFetchSize */ int getFetchSize() throws SQLException; /** * The constant indicating the type for a <code>ResultSet</code> object * whose cursor may move only forward. * @since 1.2 */ int TYPE_FORWARD_ONLY = 1003; /** * The constant indicating the type for a <code>ResultSet</code> object * that is scrollable but generally not sensitive to changes made by others. * @since 1.2 */ int TYPE_SCROLL_INSENSITIVE = 1004; /** * The constant indicating the type for a <code>ResultSet</code> object * that is scrollable and generally sensitive to changes made by others. * @since 1.2 */ int TYPE_SCROLL_SENSITIVE = 1005; /** * Retrieves the type of this <code>ResultSet</code> object. * The type is determined by the <code>Statement</code> object * that created the result set. * * @return <code>ResultSet.TYPE_FORWARD_ONLY</code>, * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, * or <code>ResultSet.TYPE_SCROLL_SENSITIVE</code> * @exception SQLException if a database access error occurs * @since 1.2 */ int getType() throws SQLException; /** * The constant indicating the concurrency mode for a * <code>ResultSet</code> object that may NOT be updated. * @since 1.2 */ int CONCUR_READ_ONLY = 1007; /** * The constant indicating the concurrency mode for a * <code>ResultSet</code> object that may be updated. * @since 1.2 */ int CONCUR_UPDATABLE = 1008; /** * Retrieves the concurrency mode of this <code>ResultSet</code> object. * The concurrency used is determined by the * <code>Statement</code> object that created the result set. * * @return the concurrency type, either * <code>ResultSet.CONCUR_READ_ONLY</code> * or <code>ResultSet.CONCUR_UPDATABLE</code> * @exception SQLException if a database access error occurs * @since 1.2 */ int getConcurrency() throws SQLException; //--------------------------------------------------------------------- // Updates //--------------------------------------------------------------------- /** * Retrieves whether the current row has been updated. The value returned * depends on whether or not the result set can detect updates. * * @return <code>true</code> if both (1) the row has been visibly updated * by the owner or another and (2) updates are detected * @exception SQLException if a database access error occurs * @see DatabaseMetaData#updatesAreDetected * @since 1.2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -