📄 resultset.java
字号:
/* ResultSet.java -- A SQL statement result set. Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.This file is part of GNU Classpath.GNU Classpath is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2, or (at your option)any later version. GNU Classpath is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNUGeneral Public License for more details.You should have received a copy of the GNU General Public Licensealong with GNU Classpath; see the file COPYING. If not, write to theFree Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA02110-1301 USA.Linking this library statically or dynamically with other modules ismaking a combined work based on this library. Thus, the terms andconditions of the GNU General Public License cover the wholecombination.As a special exception, the copyright holders of this library give youpermission to link this library with independent modules to produce anexecutable, regardless of the license terms of these independentmodules, and to copy and distribute the resulting executable underterms of your choice, provided that you also meet, for each linkedindependent module, the terms and conditions of the license of thatmodule. An independent module is a module which is not derived fromor based on this library. If you modify this library, you may extendthis exception to your version of the library, but you are notobligated to do so. If you do not wish to do so, delete thisexception statement from your version. */package java.sql;import java.io.InputStream;import java.io.Reader;import java.math.BigDecimal;import java.net.URL;import java.util.Calendar;import java.util.Map;/** * This interface provides access to the data set returned by a SQL * statement. An instance of this interface is returned by the various * execution methods in the <code>Statement</code>. * * <p> This class models a cursor, which can be stepped through one row at a * time. Methods are provided for accessing columns by column name or by * index.</p> * * <p> Note that a result set is invalidated if the statement that returned * it is closed.</p> * * @author Aaron M. Renn (arenn@urbanophile.com) */public interface ResultSet { /** * The rows will be processed in order from first to last. */ int FETCH_FORWARD = 1000; /** * The rows will be processed in order from last to first. */ int FETCH_REVERSE = 1001; /** * The rows will be processed in an unknown order */ int FETCH_UNKNOWN = 1002; /** * This type of result set may only step forward through the rows returned. */ int TYPE_FORWARD_ONLY = 1003; /** * This type of result set is scrollable and is not sensitive to changes * made by other statements. */ int TYPE_SCROLL_INSENSITIVE = 1004; /** * This type of result set is scrollable and is also sensitive to changes * made by other statements. */ int TYPE_SCROLL_SENSITIVE = 1005; /** * The concurrency mode of for the result set may not be modified. */ int CONCUR_READ_ONLY = 1007; /** * The concurrency mode of for the result set may be modified. */ int CONCUR_UPDATABLE = 1008; int HOLD_CURSORS_OVER_COMMIT = 1; int CLOSE_CURSORS_AT_COMMIT = 2; /** * This method advances to the next row in the result set. Any streams * open on the current row are closed automatically. * * @return <code>true</code> if the next row exists, <code>false</code> * otherwise. * @exception SQLException If an error occurs. */ boolean next() throws SQLException; /** * This method closes the result set and frees any associated resources. * * @exception SQLException If an error occurs. */ void close() throws SQLException; /** * This method tests whether the value of the last column that was fetched * was actually a SQL NULL value. * * @return <code>true</code> if the last column fetched was a NULL, * <code>false</code> otherwise. * @exception SQLException If an error occurs. */ boolean wasNull() throws SQLException; /** * This method returns the value of the specified column as a Java * <code>String</code>. * * @param index The index of the column to return. * @return The column value as a <code>String</code>. * @exception SQLException If an error occurs. */ String getString(int columnIndex) throws SQLException; /** * This method returns the value of the specified column as a Java * <code>boolean</code>. * * @param index The index of the column to return. * @return The column value as a <code>boolean</code>. * @exception SQLException If an error occurs. */ boolean getBoolean(int columnIndex) throws SQLException; /** * This method returns the value of the specified column as a Java * <code>byte</code>. * * @param index The index of the column to return. * @return The column value as a <code>byte</code>. * @exception SQLException If an error occurs. */ byte getByte(int columnIndex) throws SQLException; /** * This method returns the value of the specified column as a Java * <code>short</code>. * * @param index The index of the column to return. * @return The column value as a <code>short</code>. * @exception SQLException If an error occurs. */ short getShort(int columnIndex) throws SQLException; /** * This method returns the value of the specified column as a Java * <code>int</code>. * * @param index The index of the column to return. * @return The column value as a <code>int</code>. * @exception SQLException If an error occurs. */ int getInt(int columnIndex) throws SQLException; /** * This method returns the value of the specified column as a Java * <code>long</code>. * * @param index The index of the column to return. * @return The column value as a <code>long</code>. * @exception SQLException If an error occurs. */ long getLong(int columnIndex) throws SQLException; /** * This method returns the value of the specified column as a Java * <code>float</code>. * * @param index The index of the column to return. * @return The column value as a <code>float</code>. * @exception SQLException If an error occurs. */ float getFloat(int columnIndex) throws SQLException; /** * This method returns the value of the specified column as a Java * <code>double</code>. * * @param index The index of the column to return. * @return The column value as a <code>double</code>. * @exception SQLException If an error occurs. */ double getDouble(int columnIndex) throws SQLException; /** * This method returns the value of the specified column as a Java * <code>BigDecimal</code>. * * @param index The index of the column to return. * @param scale The number of digits to the right of the decimal to return. * @return The column value as a <code>BigDecimal</code>. * @exception SQLException If an error occurs. * @deprecated */ BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException; /** * This method returns the value of the specified column as a Java * byte array. * * @param index The index of the column to return. * @return The column value as a byte array * @exception SQLException If an error occurs. */ byte[] getBytes(int columnIndex) throws SQLException; /** * This method returns the value of the specified column as a Java * <code>java.sql.Date</code>. * * @param index The index of the column to return. * @return The column value as a <code>java.sql.Date</code>. * @exception SQLException If an error occurs. */ Date getDate(int columnIndex) throws SQLException; /** * This method returns the value of the specified column as a Java * <code>java.sql.Time</code>. * * @param index The index of the column to return. * @return The column value as a <code>java.sql.Time</code>. * @exception SQLException If an error occurs. */ Time getTime(int columnIndex) throws SQLException; /** * This method returns the value of the specified column as a Java * <code>java.sql.Timestamp</code>. * * @param index The index of the column to return. * @return The column value as a <code>java.sql.Timestamp</code>. * @exception SQLException If an error occurs. */ Timestamp getTimestamp(int columnIndex) throws SQLException; /** * This method returns the value of the specified column as an ASCII * stream. Note that all the data from this stream must be read before * fetching the value of any other column. Please also be aware that * calling <code>next()</code> or <code>close()</code> on this result set * will close this stream as well. * * @param index The index of the column to return. * @return The column value as an ASCII <code>InputStream</code>. * @exception SQLException If an error occurs. */ InputStream getAsciiStream(int columnIndex) throws SQLException; /** * This method returns the value of the specified column as a Unicode UTF-8 * stream. Note that all the data from this stream must be read before * fetching the value of any other column. Please also be aware that * calling <code>next()</code> or <code>close()</code> on this result set * will close this stream as well. * * @param index The index of the column to return. * @return The column value as a Unicode UTF-8 <code>InputStream</code>. * @exception SQLException If an error occurs. * @deprecated Use getCharacterStream instead. */ InputStream getUnicodeStream(int columnIndex) throws SQLException; /** * This method returns the value of the specified column as a raw byte * stream. Note that all the data from this stream must be read before * fetching the value of any other column. Please also be aware that * calling <code>next()</code> or <code>close()</code> on this result set * will close this stream as well. * * @param index The index of the column to return. * @return The column value as a raw byte <code>InputStream</code>. * @exception SQLException If an error occurs. */ InputStream getBinaryStream(int columnIndex) throws SQLException; /** * This method returns the value of the specified column as a Java * <code>String</code>. * * @param column The name of the column to return. * @return The column value as a <code>String</code>. * @exception SQLException If an error occurs. */ String getString(String columnName) throws SQLException; /** * This method returns the value of the specified column as a Java * <code>boolean</code>. * * @param column The name of the column to return. * @return The column value as a <code>boolean</code>. * @exception SQLException If an error occurs. */ boolean getBoolean(String columnName) throws SQLException; /** * This method returns the value of the specified column as a Java * <code>byte</code>. * * @param column The name of the column to return. * @return The column value as a <code>byte</code>. * @exception SQLException If an error occurs. */ byte getByte(String columnName) throws SQLException; /** * This method returns the value of the specified column as a Java * <code>short</code>. * * @param column The name of the column to return. * @return The column value as a <code>short</code>. * @exception SQLException If an error occurs. */ short getShort(String columnName) throws SQLException; /** * This method returns the value of the specified column as a Java * <code>int</code>. * * @param column The name of the column to return. * @return The column value as a <code>int</code>. * @exception SQLException If an error occurs. */ int getInt(String columnName) throws SQLException; /** * This method returns the value of the specified column as a Java * <code>long</code>. * * @param column The name of the column to return. * @return The column value as a <code>long</code>. * @exception SQLException If an error occurs. */ long getLong(String columnName) throws SQLException; /** * This method returns the value of the specified column as a Java * <code>float</code>. * * @param column The name of the column to return. * @return The column value as a <code>float</code>. * @exception SQLException If an error occurs. */ float getFloat(String columnName) throws SQLException; /** * This method returns the value of the specified column as a Java * <code>double</code>. *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -