public interface ResultSet
implements Wrapper, AutoCloseable
java.sql.ResultSet |
Known Indirect Subclasses |
表示数据库结果集的数据表,通常通过执行查询数据库的语句生成。
一个ResultSet
对象维护一个指向其当前数据行的游标。 最初光标位于第一行之前。 next
方法将光标移动到下一行,并且因为它在ResultSet
对象中没有更多行时返回false
,所以它可以在while
循环中用于遍历结果集。
默认的ResultSet
对象不可更新,并且只有一个只能向前移动的游标。 因此,只能从第一行到最后一行迭代遍历它。 这是可能产生ResultSet
对象是可滚动和/或可更新的。 以下代码片段(其中con
是有效的Connection
对象)说明了如何创建一个可滚动且对其他人的更新不敏感的结果集,并且这是可更新的。 有关其他选项,请参阅ResultSet
字段。
Statement stmt = con.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = stmt.executeQuery("SELECT a, b FROM TABLE2"); // rs will be scrollable, will not show changes made by others, // and will be updatableThe
ResultSet
interface provides
getter methods (
getBoolean
,
getLong
, and so on) for retrieving column values from the current row. Values can be retrieved using either the index number of the column or the name of the column. In general, using the column index will be more efficient. Columns are numbered from 1. For maximum portability, result set columns within each row should be read in left-to-right order, and each column should be read only once.
对于getter方法,JDBC驱动程序会尝试将基础数据转换为getter方法中指定的Java类型,并返回适当的Java值。 JDBC规范具有一个表,显示可从ResultSet
getter方法使用的SQL类型到Java类型的允许映射。
用作getter方法输入的列名不区分大小写。 当使用列名称调用getter方法并且多个列具有相同的名称时,将返回第一个匹配列的值。 列名选项设计为在生成结果集的SQL查询中使用列名时使用。 对于在查询中未明确命名的列,最好使用列号。 如果使用列名称,程序员应小心保证它们唯一地引用预期的列,这可以通过SQL AS子句来保证。
在JDBC 2.0 API(Java TM 2 SDK,标准版,1.2)中的此接口中添加了一组更新方法。 有关getter方法参数的注释也适用于更新器方法的参数。
更新器方法可以以两种方式使用:
ResultSet
object, the cursor can be moved backwards and forwards, to an absolute position, or to a position relative to the current row. The following code fragment updates the NAME
column in the fifth row of the ResultSet
object rs
and then uses the method updateRow
to update the data source table from which rs
was derived. rs.absolute(5); // moves the cursor to the fifth row of rs rs.updateString("NAME", "AINSWORTH"); // updates the //NAME
column of row 5 to beAINSWORTH
rs.updateRow(); // updates the row in the data source
ResultSet
object has a special row associated with it that serves as a staging area for building a row to be inserted. The following code fragment moves the cursor to the insert row, builds a three-column row, and inserts it into rs
and into the data source table using the method insertRow
. rs.moveToInsertRow(); // moves cursor to the insert row rs.updateString(1, "AINSWORTH"); // updates the // first column of the insert row to beAINSWORTH
rs.updateInt(2,35); // updates the second column to be35
rs.updateBoolean(3, true); // updates the third column totrue
rs.insertRow(); rs.moveToCurrentRow();
当生成它的 Statement
对象被关闭,重新执行或用于从多个结果序列中检索下一个结果时, ResultSet
对象会自动关闭。
ResultSet
对象列的数量,类型和属性由 ResultSet.getMetaData
方法返回的 ResultSetMetaData
对象提供。
Constants |
|
---|---|
int |
CLOSE_CURSORS_AT_COMMIT 当 |
int |
CONCUR_READ_ONLY 该常数指示可能无法更新的 |
int |
CONCUR_UPDATABLE 该常数指示可能更新的 |
int |
FETCH_FORWARD 该常数表示结果集中的行将以正向处理; 第一个到最后。 |
int |
FETCH_REVERSE 该常数表示结果集中的行将反向处理; 最后到第一位。 |
int |
FETCH_UNKNOWN 该常量指示结果集中行的处理顺序未知。 |
int |
HOLD_CURSORS_OVER_COMMIT 当 |
int |
TYPE_FORWARD_ONLY 该常数表示光标可能只能向前移动的 |
int |
TYPE_SCROLL_INSENSITIVE 该常数指示可滚动的 |
int |
TYPE_SCROLL_SENSITIVE 该常数指示可滚动的 |
Public methods |
|
---|---|
abstract boolean |
absolute(int row) 将光标移动到此 |
abstract void |
afterLast() 将光标移动到最后一行后面的 |
abstract void |
beforeFirst() 将光标移动到该前方 |
abstract void |
cancelRowUpdates() 取消对此 |
abstract void |
clearWarnings() 清除此 |
abstract void |
close() 释放此 |
abstract void |
deleteRow() 从此 |
abstract int |
findColumn(String columnLabel) 将给定的 |
abstract boolean |
first() 将光标移动到此 |
abstract Array |
getArray(int columnIndex) 以Java编程语言中的 |
abstract Array |
getArray(String columnLabel) 以Java编程语言中的 |
abstract InputStream |
getAsciiStream(int columnIndex) 以 |
abstract InputStream |
getAsciiStream(String columnLabel) 以 |
abstract BigDecimal |
getBigDecimal(String columnLabel) 以 |
abstract BigDecimal |
getBigDecimal(String columnLabel, int scale) 此方法在API级别1中已弃用。已弃用 |
abstract BigDecimal |
getBigDecimal(int columnIndex, int scale) 此方法在API级别1中已弃用。已弃用 |
abstract BigDecimal |
getBigDecimal(int columnIndex) 以 |
abstract InputStream |
getBinaryStream(String columnLabel) 以未解释的 |
abstract InputStream |
getBinaryStream(int columnIndex) 以未解释的字节流的形式检索此 |
abstract Blob |
getBlob(int columnIndex) 以Java编程语言中的 |
abstract Blob |
getBlob(String columnLabel) 以Java编程语言中的 |
abstract boolean |
getBoolean(String columnLabel) 以Java编程语言中的 |
abstract boolean |
getBoolean(int columnIndex) 以Java编程语言中的 |
abstract byte |
getByte(String columnLabel) 以Java编程语言中的 |
abstract byte |
getByte(int columnIndex) 以Java编程语言中的 |
abstract byte[] |
getBytes(String columnLabel) 以Java编程语言中的 |
abstract byte[] |
getBytes(int columnIndex) 以Java编程语言中的 |
abstract Reader |
getCharacterStream(int columnIndex) 以 |
abstract Reader |
getCharacterStream(String columnLabel) 以 |
abstract Clob |
getClob(int columnIndex) 以Java编程语言中的 |
abstract Clob |
getClob(String columnLabel) 以Java编程语言中的 |
abstract int |
getConcurrency() 检索此 |
abstract String |
getCursorName() 检索此 |
abstract Date |
getDate(int columnIndex) 以Java编程语言中的 |
abstract Date |
getDate(String columnLabel) 以Java编程语言中的 |
abstract Date |
getDate(String columnLabel, Calendar cal) 以Java编程语言中的 |
abstract Date |
getDate(int columnIndex, Calendar cal) 以Java编程语言中的 |
abstract double |
getDouble(int columnIndex) 以Java编程语言中的 |
abstract double |
getDouble(String columnLabel) 以Java编程语言中的 |
abstract int |
getFetchDirection() 检索此 |
abstract int |
getFetchSize() 检索此 |
abstract float |
getFloat(String columnLabel) 以Java编程语言中的 |
abstract float |
getFloat(int columnIndex) 以Java编程语言中的 |
abstract int |
getHoldability() 检索此 |
abstract int |
getInt(int columnIndex) 以Java编程语言中的 |
abstract int |
getInt(String columnLabel) 以Java编程语言中的 |
abstract long |
getLong(String columnLabel) 以Java编程语言中的 |
abstract long |
getLong(int columnIndex) 以Java编程语言中的 |
abstract ResultSetMetaData |
getMetaData() 检索此 |
abstract Reader |
getNCharacterStream(int columnIndex) 以 |
abstract Reader |
getNCharacterStream(String columnLabel) 以 |
abstract NClob |
getNClob(String columnLabel) 以Java编程语言中的 |
abstract NClob |
getNClob(int columnIndex) 以Java编程语言中的 |
abstract String |
getNString(String columnLabel) 以Java编程语言中的 |
abstract String |
getNString(int columnIndex) 以Java编程语言中的 |
abstract Object |
getObject(int columnIndex) 以Java编程语言中的 |
abstract Object |
getObject(String columnLabel) 以Java编程语言中的 |
abstract Object |
getObject(int columnIndex, Map<String, Class<?>> map) 以Java编程语言中的 |
abstract Object |
getObject(String columnLabel, Map<String, Class<?>> map) 以Java编程语言中的 |
abstract Ref |
getRef(int columnIndex) 以Java编程语言中的 |
abstract Ref |
getRef(String columnLabel) 以Java编程语言中的 |
abstract int |
getRow() 检索当前行号。 |
abstract RowId |
getRowId(int columnIndex) 以Java编程语言中的 |
abstract RowId |
getRowId(String columnLabel) 以Java编程语言中的 |
abstract SQLXML |
getSQLXML(String columnLabel) 以Java编程语言中的 |
abstract SQLXML |
getSQLXML(int columnIndex) 以Java编程语言中的 |
abstract short |
getShort(String columnLabel) 以Java编程语言中的 |
abstract short |
getShort(int columnIndex) 以Java编程语言中的 |
abstract Statement |
getStatement() 检索 |
abstract String |
getString(int columnIndex) 以Java编程语言中的 |
abstract String |
getString(String columnLabel) 以Java编程语言中的 |
abstract Time |
getTime(String columnLabel) 以Java编程语言中的 |
abstract Time |
getTime(String columnLabel, Calendar cal) 以Java编程语言中的 |
abstract Time |
getTime(int columnIndex) 以Java编程语言中的 |
abstract Time |
getTime(int columnIndex, Calendar cal) 以Java编程语言中的 |
abstract Timestamp |
getTimestamp(int columnIndex, Calendar cal) 以Java编程语言中的 |
abstract Timestamp |
getTimestamp(int columnIndex) 以Java编程语言中的 |
abstract Timestamp |
getTimestamp(String columnLabel, Calendar cal) 以Java编程语言中的 |
abstract Timestamp |
getTimestamp(String columnLabel) 以Java编程语言中的 |
abstract int |
getType() 检索此 |
abstract URL |
getURL(int columnIndex) 以Java编程语言中的 |
abstract URL |
getURL(String columnLabel) 以Java编程语言中的 |
abstract InputStream |
getUnicodeStream(int columnIndex) 此方法在API级别1中已弃用。使用 |
abstract InputStream |
getUnicodeStream(String columnLabel) 此方法在API级别1中已弃用。请改用 |
abstract SQLWarning |
getWarnings() 检索此 |
abstract void |
insertRow() 将插入行的内容插入到这个 |
abstract boolean |
isAfterLast() 检索光标是否位于此 |
abstract boolean |
isBeforeFirst() 检索光标是否位于此 |
abstract boolean |
isClosed() 检索此 |
abstract boolean |
isFirst() 检索光标是否位于此 |
abstract boolean |
isLast() 检索光标是否位于此 |
abstract boolean |
last() 将光标移动到此 |
abstract void |
moveToCurrentRow() 将光标移动到记忆的光标位置,通常是当前行。 |
abstract void |
moveToInsertRow() 将光标移动到插入行。 |
abstract boolean |
next() 将光标从当前位置移动一行。 |
abstract boolean |
previous() 将光标移动 |
abstract void |
refreshRow() 使用数据库中的最新值刷新当前行。 |
abstract boolean |
relative(int rows) 将光标移动相对的行数,无论是正数还是负数。 |
abstract boolean |
rowDeleted() 检索一行是否已被删除。 |
abstract boolean |
rowInserted() 检索当前行是否有插入。 |
abstract boolean |
rowUpdated() 检索当前行是否已更新。 |
abstract void |
setFetchDirection(int direction) 给出关于此 |
abstract void |
setFetchSize(int rows) 当此 |
abstract void |
updateArray(String columnLabel, Array x) 用 |
abstract void |
updateArray(int columnIndex, Array x) 用 |
abstract void |
updateAsciiStream(int columnIndex, InputStream x) 用ascii流值更新指定的列。 |
abstract void |
updateAsciiStream(int columnIndex, InputStream x, long length) 使用ascii流值更新指定列,该值将具有指定的字节数。 |
abstract void |
updateAsciiStream(String columnLabel, InputStream x, long length) 使用ascii流值更新指定列,该值将具有指定的字节数。 |
abstract void |
updateAsciiStream(String columnLabel, InputStream x) 用ascii流值更新指定的列。 |
abstract void |
updateAsciiStream(int columnIndex, InputStream x, int length) 使用ascii流值更新指定列,该值将具有指定的字节数。 |
abstract void |
updateAsciiStream(String columnLabel, InputStream x, int length) 使用ascii流值更新指定列,该值将具有指定的字节数。 |
abstract void |
updateBigDecimal(int columnIndex, BigDecimal x) 用 |
abstract void |
updateBigDecimal(String columnLabel, BigDecimal x) 用 |
abstract void |
updateBinaryStream(int columnIndex, InputStream x, int length) 用二进制流值更新指定列,该值将具有指定的字节数。 |
abstract void |
updateBinaryStream(int columnIndex, InputStream x) 用二进制流值更新指定的列。 |
abstract void |
updateBinaryStream(String columnLabel, InputStream x, long length) 用二进制流值更新指定列,该值将具有指定的字节数。 |
abstract void |
updateBinaryStream(String columnLabel, InputStream x) 用二进制流值更新指定的列。 |
abstract void |
updateBinaryStream(String columnLabel, InputStream x, int length) 用二进制流值更新指定列,该值将具有指定的字节数。 |
abstract void |
updateBinaryStream(int columnIndex, InputStream x, long length) 用二进制流值更新指定列,该值将具有指定的字节数。 |
abstract void |
updateBlob(String columnLabel, Blob x) 用 |
abstract void |
updateBlob(String columnLabel, InputStream inputStream) 使用给定的输入流更新指定的列。 |
abstract void |
updateBlob(int columnIndex, Blob x) 用 |
abstract void |
updateBlob(String columnLabel, InputStream inputStream, long length) 使用给定的输入流更新指定的列,该输入流将具有指定的字节数。 |
abstract void |
updateBlob(int columnIndex, InputStream inputStream) 使用给定的输入流更新指定的列。 |
abstract void |
updateBlob(int columnIndex, InputStream inputStream, long length) 使用给定的输入流更新指定的列,该输入流将具有指定的字节数。 |
abstract void |
updateBoolean(String columnLabel, boolean x) 用 |
abstract void |
updateBoolean(int columnIndex, boolean x) 用 |
abstract void |
updateByte(int columnIndex, byte x) 用 |
abstract void |
updateByte(String columnLabel, byte x) 用 |
abstract void |
updateBytes(int columnIndex, byte[] x) 使用 |
abstract void |
updateBytes(String columnLabel, byte[] x) 用字节数组值更新指定的列。 |
abstract void |
updateCharacterStream(String columnLabel, Reader reader, int length) 使用字符流值更新指定的列,该值将具有指定的字节数。 |
abstract void |
updateCharacterStream(String columnLabel, Reader reader, long length) 使用字符流值更新指定的列,该值将具有指定的字节数。 |
abstract void |
updateCharacterStream(int columnIndex, Reader x, long length) 使用字符流值更新指定的列,该值将具有指定的字节数。 |
abstract void |
updateCharacterStream(int columnIndex, Reader x) 用字符流值更新指定的列。 |
abstract void |
updateCharacterStream(int columnIndex, Reader x, int length) 使用字符流值更新指定的列,该值将具有指定的字节数。 |
abstract void |
updateCharacterStream(String columnLabel, Reader reader) 用字符流值更新指定的列。 |
abstract void |
updateClob(int columnIndex, Clob x) 用 |
abstract void |
updateClob(String columnLabel, Reader reader) 使用给定的 |
abstract void |
updateClob(String columnLabel, Reader reader, long length) 使用给定的 |
abstract void |
updateClob(int columnIndex, Reader reader) 使用给定的 |
abstract void |
updateClob(int columnIndex, Reader reader, long length) 使用给定的 |
abstract void |
updateClob(String columnLabel, Clob x) 用 |
abstract void |
updateDate(int columnIndex, Date x) 用 |
abstract void |
updateDate(String columnLabel, Date x) 用 |
abstract void |
updateDouble(String columnLabel, double x) 用 |
abstract void |
updateDouble(int columnIndex, double x) 用 |
abstract void |
updateFloat(int columnIndex, float x) 用 |
abstract void |
updateFloat(String columnLabel, float x) 用 |
abstract void |
updateInt(String columnLabel, int x) 用 |
abstract void |
updateInt(int columnIndex, int x) 用 |
abstract void |
updateLong(int columnIndex, long x) 用 |
abstract void |
updateLong(String columnLabel, long x) 用 |
abstract void |
updateNCharacterStream(int columnIndex, Reader x, long length) 使用字符流值更新指定的列,该值将具有指定的字节数。 |
abstract void |
updateNCharacterStream(String columnLabel, Reader reader) 用字符流值更新指定的列。 |
abstract void |
updateNCharacterStream(int columnIndex, Reader x) 用字符流值更新指定的列。 |
abstract void |
updateNCharacterStream(String columnLabel, Reader reader, long length) 使用字符流值更新指定的列,该值将具有指定的字节数。 |
abstract void |
updateNClob(int columnIndex, Reader reader, long length) 使用给定的 |
abstract void |
updateNClob(int columnIndex, NClob nClob) 用 |
abstract void |
updateNClob(String columnLabel, NClob nClob) 用 |
abstract void |
updateNClob(String columnLabel, Reader reader) 使用给定的 |
abstract void |
updateNClob(String columnLabel, Reader reader, long length) 使用给定的 |
abstract void |
updateNClob(int columnIndex, Reader reader) 使用给定的 |
abstract void |
updateNString(String columnLabel, String nString) 用 |
abstract void |
updateNString(int columnIndex, String nString) 用 |
abstract void |
updateNull(int columnIndex) 用 |
abstract void |
updateNull(String columnLabel) 用 |
abstract void |
updateObject(int columnIndex, Object x) 用 |
abstract void |
updateObject(int columnIndex, Object x, int scaleOrLength) 用 |
abstract void |
updateObject(String columnLabel, Object x, int scaleOrLength) 用 |
abstract void |
updateObject(String columnLabel, Object x) 用 |
abstract void |
updateRef(int columnIndex, Ref x) 用 |
abstract void |
updateRef(String columnLabel, Ref x) 用 |
abstract void |
updateRow() 使用此 |
abstract void |
updateRowId(int columnIndex, RowId x) 用 |
abstract void |
updateRowId(String columnLabel, RowId x) 用 |
abstract void |
updateSQLXML(int columnIndex, SQLXML xmlObject) 用 |
abstract void |
updateSQLXML(String columnLabel, SQLXML xmlObject) 用 |
abstract void |
updateShort(String columnLabel, short x) 用 |
abstract void |
updateShort(int columnIndex, short x) 用 |
abstract void |
updateString(String columnLabel, String x) 用 |
abstract void |
updateString(int columnIndex, String x) 用 |
abstract void |
updateTime(int columnIndex, Time x) 用 |
abstract void |
updateTime(String columnLabel, Time x) 用 |
abstract void |
updateTimestamp(String columnLabel, Timestamp x) 用 |
abstract void |
updateTimestamp(int columnIndex, Timestamp x) 用 |
abstract boolean |
wasNull() 报告最后一列的读取值是否为SQL |
Inherited methods |
|
---|---|
From interface java.sql.Wrapper
|
|
From interface java.lang.AutoCloseable
|
int CLOSE_CURSORS_AT_COMMIT
当 ResultSet
当前事务时,指示具有此可保存性的开放 ResultSet
对象的常量将被关闭。
常量值:2(0x00000002)
int CONCUR_READ_ONLY
该常量指示可能无法更新的 ResultSet
对象的并发模式。
常量值:1007(0x000003ef)
int CONCUR_UPDATABLE
该常数指示可能更新的 ResultSet
对象的并发模式。
常数值:1008(0x000003f0)
int FETCH_FORWARD
该常数表示结果集中的行将以正向处理; 第一个到最后。 该常数被方法setFetchDirection
用作驱动程序的提示,驱动程序可能会忽略该提示。
常量值:1000(0x000003e8)
int FETCH_REVERSE
该常数表示结果集中的行将反向处理; 最后到第一位。 该常数被方法setFetchDirection
用作驱动程序的提示,驱动程序可能会忽略该提示。
常量值:1001(0x000003e9)
int FETCH_UNKNOWN
该常量指示结果集中行的处理顺序未知。 这个常量被方法setFetchDirection
用作驱动程序的提示,驱动程序可能会忽略这个提示。
常量值:1002(0x000003ea)
int HOLD_CURSORS_OVER_COMMIT
当 ResultSet
当前事务时,表示具有此可保留性的对象的开放 ResultSet
将保持打开。
常数值:1(0x00000001)
int TYPE_FORWARD_ONLY
该常数指示其光标可能仅向前移动的 ResultSet
对象的类型。
常量值:1003(0x000003eb)
int TYPE_SCROLL_INSENSITIVE
该常数指示可滚动的 ResultSet
对象的类型,但通常对 ResultSet
的数据更改不敏感。
常量值:1004(0x000003ec)
int TYPE_SCROLL_SENSITIVE
该常数指示可滚动的 ResultSet
对象的类型,并且通常对 ResultSet
的数据更改敏感。
常量值:1005(0x000003ed)
boolean absolute (int row)
将光标移动到此 ResultSet
对象中的给定行号。
如果行号是正数,则光标将移至相对于结果集开头的给定行号。 第一行是第一行,第二行是第二行,依此类推。
如果给定的行号是负数,则光标将移到相对于结果集结束的绝对行位置。 例如,调用方法absolute(-1)
将光标定位在最后一行; 调用方法absolute(-2)
将光标移动到倒数第二行,依此类推。
如果指定的行号为零,则光标移至第一行之前。
尝试将光标放在结果集中第一行/最后一行之外时,会将光标留在第一行之前或最后一行之后。
注意:拨打absolute(1)
与拨打first()
相同。 调用absolute(-1)
与调用last()
相同。
Parameters | |
---|---|
row |
int : the number of the row to which the cursor should move. A value of zero indicates that the cursor will be positioned before the first row; 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 |
Returns | |
---|---|
boolean |
true if the cursor is moved to a position in this ResultSet object; false if the cursor is before the first row or after the last row |
Throws | |
---|---|
SQLException |
if a database access error occurs; this method is called on a closed result set or the result set type is TYPE_FORWARD_ONLY |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void afterLast ()
将光标移动到最后一行后面的ResultSet
对象的末尾。 如果结果集不包含任何行,则此方法不起作用。
Throws | |
---|---|
SQLException |
if a database access error occurs; this method is called on a closed result set or the result set type is TYPE_FORWARD_ONLY |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void beforeFirst ()
将光标移动到该前方ResultSet
正好位于第一行之前的对象。 如果结果集不包含任何行,则此方法不起作用。
Throws | |
---|---|
SQLException |
if a database access error occurs; this method is called on a closed result set or the result set type is TYPE_FORWARD_ONLY |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void cancelRowUpdates ()
取消对此ResultSet
对象中的当前行进行的更新。 可以在调用更新器方法之后以及调用方法updateRow
来回滚对行进行的更新之前调用此方法。 如果没有更新或已经调用updateRow
,则此方法不起作用。
Throws | |
---|---|
SQLException |
if a database access error occurs; this method is called on a closed result set; the result set concurrency is CONCUR_READ_ONLY or if this method is called when the cursor is on the insert row |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void clearWarnings ()
清除此ResultSet
对象上报告的所有警告。 在调用此方法后,方法getWarnings
将返回null
直到为此ResultSet
对象报告新警告为止。
Throws | |
---|---|
SQLException |
if a database access error occurs or this method is called on a closed result set |
void close ()
立即释放此 ResultSet
对象的数据库和JDBC资源,而不是在它自动关闭时等待它发生。
一个的闭合ResultSet
对象不关闭Blob
, Clob
或NClob
由创建的对象ResultSet
。 Blob
, Clob
或NClob
对象为其中它们creataed,除非他们的交易的至少持续时间保持有效free
方法被调用。
当 ResultSet
关闭时,通过调用 getMetaData
方法创建的任何 ResultSetMetaData
实例仍可访问。
注意:当 Statement
对象关闭,重新执行或用于从多个结果序列中检索下一个结果时, ResultSet
对象会自动由 Statement
对象关闭,该对象会生成该对象。
在已经关闭的 ResultSet
对象上调用方法 close
是无操作的。
Throws | |
---|---|
SQLException |
if a database access error occurs |
void deleteRow ()
从此ResultSet
对象和底层数据库中删除当前行。 当光标位于插入行上时,不能调用此方法。
Throws | |
---|---|
SQLException |
if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY ; this method is called on a closed result set or if this method is called when the cursor is on the insert row |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
int findColumn (String columnLabel)
将给定的 ResultSet
列标签映射到其 ResultSet
列索引。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
int |
the column index of the given column name |
Throws | |
---|---|
SQLException |
if the ResultSet object does not contain a column labeled columnLabel , a database access error occurs or this method is called on a closed result set |
boolean first ()
将光标移动到此 ResultSet
对象的第一行。
Returns | |
---|---|
boolean |
true if the cursor is on a valid row; false if there are no rows in the result set |
Throws | |
---|---|
SQLException |
if a database access error occurs; this method is called on a closed result set or the result set type is TYPE_FORWARD_ONLY |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
Array getArray (int columnIndex)
以Java编程语言中的 ResultSet
对象的形式 Array
此 ResultSet
对象当前行中指定列的值。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
Returns | |
---|---|
Array |
an Array object representing the SQL ARRAY value in the specified column |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
Array getArray (String columnLabel)
以Java编程语言中的 ResultSet
对象的形式 Array
此 ResultSet
对象当前行中指定列的值。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
Array |
an Array object representing the SQL ARRAY value in the specified column |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
InputStream getAsciiStream (int columnIndex)
以ASCII字符流的形式检索此ResultSet
对象当前行中指定列的值。 然后可以从流中读取该块的值。 该方法特别适用于获取大LONGVARCHAR
值。 JDBC驱动程序将执行从数据库格式到ASCII的任何必要转换。
注意:必须在获取任何其他列的值之前读取返回流中的所有数据。 下一次调用getter方法会隐式关闭流。 此外,一个流可以返回0
当方法InputStream.available
称为是否存在可用的或不是数据。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
Returns | |
---|---|
InputStream |
a Java input stream that delivers the database column value as a stream of one-byte ASCII characters; if the value is SQL NULL , the value returned is null |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
InputStream getAsciiStream (String columnLabel)
以ASCII字符流的形式检索此ResultSet
对象当前行中指定列的值。 然后可以从流中读取该块的值。 该方法特别适用于检索较大的LONGVARCHAR
值。 JDBC驱动程序将执行从数据库格式到ASCII的任何必要转换。
注意:必须在获取任何其他列的值之前读取返回流中的所有数据。 下一次调用getter方法会隐式关闭流。 此外,一个流可以返回0
当方法available
称为是否存在可用的或不是数据。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
InputStream |
a Java input stream that delivers the database column value as a stream of one-byte ASCII characters. If the value is SQL NULL , the value returned is null . |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
BigDecimal getBigDecimal (String columnLabel)
完全精确地以 java.math.BigDecimal
此 ResultSet
对象当前行中指定列的值。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
BigDecimal |
the column value (full precision); if the value is SQL NULL , the value returned is null in the Java programming language. |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
BigDecimal getBigDecimal (String columnLabel, int scale)
此方法在API级别1中已弃用。
弃用
以Java编程语言中的 java.math.BigDecimal
此 ResultSet
对象的当前行中指定列的值。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
scale |
int : the number of digits to the right of the decimal point |
Returns | |
---|---|
BigDecimal |
the column value; if the value is SQL NULL , the value returned is null |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
BigDecimal getBigDecimal (int columnIndex, int scale)
此方法在API级别1中已弃用。
弃用
以Java编程语言中的 java.sql.BigDecimal
此 ResultSet
对象的当前行中指定列的值。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
scale |
int : the number of digits to the right of the decimal point |
Returns | |
---|---|
BigDecimal |
the column value; if the value is SQL NULL , the value returned is null |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
BigDecimal getBigDecimal (int columnIndex)
以 java.math.BigDecimal
的全精度检索此 ResultSet
对象当前行中指定列的值。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
Returns | |
---|---|
BigDecimal |
the column value (full precision); if the value is SQL NULL , the value returned is null in the Java programming language. |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
InputStream getBinaryStream (String columnLabel)
以未解释的byte
s的形式检索此ResultSet
对象当前行中指定列的值。 然后可以从流中读取该块的值。 该方法特别适用于检索较大的LONGVARBINARY
值。
注意:必须在获取任何其他列的值之前读取返回流中的所有数据。 下一次调用getter方法会隐式关闭流。 此外,一个流可以返回0
当方法available
称为是否存在可用的或不是数据。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
InputStream |
a Java input stream that delivers the database column value as a stream of uninterpreted bytes; if the value is SQL NULL , the result is null |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
InputStream getBinaryStream (int columnIndex)
以未解释的字节流的形式检索此ResultSet
对象当前行中指定列的值。 然后可以从流中读取该块的值。 该方法特别适用于检索较大的LONGVARBINARY
值。
注意:必须在获取任何其他列的值之前读取返回流中的所有数据。 下一次调用getter方法会隐式关闭流。 此外,一个流可以返回0
当方法InputStream.available
称为是否存在可用的或不是数据。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
Returns | |
---|---|
InputStream |
a Java input stream that delivers the database column value as a stream of uninterpreted bytes; if the value is SQL NULL , the value returned is null |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
Blob getBlob (int columnIndex)
以Java编程语言中的 ResultSet
对象的形式 Blob
此 ResultSet
对象当前行中指定列的值。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
Returns | |
---|---|
Blob |
a Blob object representing the SQL BLOB value in the specified column |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
Blob getBlob (String columnLabel)
以Java编程语言中的 ResultSet
对象的形式 Blob
此 ResultSet
对象当前行中指定列的值。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
Blob |
a Blob object representing the SQL BLOB value in the specified column |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
boolean getBoolean (String columnLabel)
以Java编程语言中的 boolean
此 ResultSet
对象当前行中指定列的值。
如果指定的列具有CHAR或VARCHAR的数据类型并且包含“0”或具有BIT,TINYINT,SMALLINT,INTEGER或BIGINT的数据类型并且包含0,则返回值false
。 如果指定的列具有CHAR或VARCHAR的数据类型并且包含“1”或具有BIT,TINYINT,SMALLINT,INTEGER或BIGINT的数据类型并且包含1,则返回值true
。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
boolean |
the column value; if the value is SQL NULL , the value returned is false |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
boolean getBoolean (int columnIndex)
以Java编程语言中的 boolean
此 ResultSet
对象当前行中指定列的值。
如果指定的列具有CHAR或VARCHAR的数据类型并且包含“0”或具有BIT,TINYINT,SMALLINT,INTEGER或BIGINT的数据类型且包含0,则返回值false
。 如果指定的列具有CHAR或VARCHAR的数据类型并且包含“1”或具有BIT,TINYINT,SMALLINT,INTEGER或BIGINT的数据类型并且包含1,则返回值true
。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
Returns | |
---|---|
boolean |
the column value; if the value is SQL NULL , the value returned is false |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
byte getByte (String columnLabel)
以Java编程语言中的 byte
此 ResultSet
对象当前行中指定列的值。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
byte |
the column value; if the value is SQL NULL , the value returned is 0 |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
byte getByte (int columnIndex)
以Java编程语言中的 byte
此 ResultSet
对象的当前行中指定列的值。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
Returns | |
---|---|
byte |
the column value; if the value is SQL NULL , the value returned is 0 |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
byte[] getBytes (String columnLabel)
以Java编程语言中的byte
数组检索此ResultSet
对象当前行中指定列的值。 字节表示驱动程序返回的原始值。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
byte[] |
the column value; if the value is SQL NULL , the value returned is null |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
byte[] getBytes (int columnIndex)
以Java编程语言中的byte
数组检索此ResultSet
对象当前行中指定列的值。 字节表示驱动程序返回的原始值。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
Returns | |
---|---|
byte[] |
the column value; if the value is SQL NULL , the value returned is null |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
Reader getCharacterStream (int columnIndex)
以 ResultSet
对象的形式 java.io.Reader
此 ResultSet
对象当前行中指定列的值。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
Returns | |
---|---|
Reader |
a java.io.Reader object that contains the column value; if the value is SQL NULL , the value returned is null in the Java programming language. |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
Reader getCharacterStream (String columnLabel)
以 ResultSet
对象的形式 java.io.Reader
此 ResultSet
对象的当前行中指定列的值。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
Reader |
a java.io.Reader object that contains the column value; if the value is SQL NULL , the value returned is null in the Java programming language |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
Clob getClob (int columnIndex)
以Java编程语言中的 ResultSet
对象的形式 Clob
此 ResultSet
对象的当前行中指定列的值。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
Returns | |
---|---|
Clob |
a Clob object representing the SQL CLOB value in the specified column |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
Clob getClob (String columnLabel)
以Java编程语言中的 ResultSet
对象的形式 Clob
此 ResultSet
对象的当前行中指定列的值。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
Clob |
a Clob object representing the SQL CLOB value in the specified column |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
int getConcurrency ()
检索此ResultSet
对象的并发模式。 使用的并发性由创建结果集的Statement
对象决定。
Returns | |
---|---|
int |
the concurrency type, either ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE |
Throws | |
---|---|
SQLException |
if a database access error occurs or this method is called on a closed result set |
String getCursorName ()
检索此 ResultSet
对象使用的SQL游标的名称。
在SQL中,通过名为的游标检索结果表。 可以使用引用光标名称的定位更新/删除语句来更新或删除结果集的当前行。 为确保游标具有适当的隔离级别以支持更新,游标的SELECT
语句的格式应为SELECT FOR UPDATE
。 如果省略FOR UPDATE
,则定位的更新可能会失败。
JDBC API通过提供ResultSet
对象所使用的SQL游标的名称来支持此SQL功能。 ResultSet
对象的当前行也是此SQL游标的当前行。
Returns | |
---|---|
String |
the SQL name for this ResultSet object's cursor |
Throws | |
---|---|
SQLException |
if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
Date getDate (int columnIndex)
以Java编程语言中的 ResultSet
对象的形式 java.sql.Date
此 ResultSet
对象当前行中指定列的值。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
Returns | |
---|---|
Date |
the column value; if the value is SQL NULL , the value returned is null |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
Date getDate (String columnLabel)
以Java编程语言中的 ResultSet
对象的形式 java.sql.Date
此 ResultSet
对象的当前行中指定列的值。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
Date |
the column value; if the value is SQL NULL , the value returned is null |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
Date getDate (String columnLabel, Calendar cal)
以Java编程语言中的ResultSet
对象的形式java.sql.Date
此ResultSet
对象的当前行中指定列的值。 如果底层数据库不存储时区信息,则此方法使用给定的日历为日期构造适当的毫秒值。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
cal |
Calendar : the java.util.Calendar object to use in constructing the date |
Returns | |
---|---|
Date |
the column value as a java.sql.Date object; if the value is SQL NULL , the value returned is null in the Java programming language |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
Date getDate (int columnIndex, Calendar cal)
以Java编程语言中的ResultSet
对象的形式java.sql.Date
此ResultSet
对象的当前行中指定列的值。 如果底层数据库不存储时区信息,则此方法使用给定的日历为日期构造适当的毫秒值。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
cal |
Calendar : the java.util.Calendar object to use in constructing the date |
Returns | |
---|---|
Date |
the column value as a java.sql.Date object; if the value is SQL NULL , the value returned is null in the Java programming language |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
double getDouble (int columnIndex)
以Java编程语言中的 double
此 ResultSet
对象当前行中指定列的值。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
Returns | |
---|---|
double |
the column value; if the value is SQL NULL , the value returned is 0 |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
double getDouble (String columnLabel)
以Java编程语言中的 double
此 ResultSet
对象的当前行中指定列的值。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
double |
the column value; if the value is SQL NULL , the value returned is 0 |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
int getFetchDirection ()
检索此 ResultSet
对象的获取方向。
Returns | |
---|---|
int |
the current fetch direction for this ResultSet object |
Throws | |
---|---|
SQLException |
if a database access error occurs or this method is called on a closed result set |
也可以看看:
int getFetchSize ()
检索此 ResultSet
对象的获取大小。
Returns | |
---|---|
int |
the current fetch size for this ResultSet object |
Throws | |
---|---|
SQLException |
if a database access error occurs or this method is called on a closed result set |
也可以看看:
float getFloat (String columnLabel)
以Java编程语言中的 float
此 ResultSet
对象当前行中指定列的值。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
float |
the column value; if the value is SQL NULL , the value returned is 0 |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
float getFloat (int columnIndex)
以Java编程语言中的 float
此 ResultSet
对象当前行中指定列的值。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
Returns | |
---|---|
float |
the column value; if the value is SQL NULL , the value returned is 0 |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
int getHoldability ()
检索此 ResultSet
对象的可保存性
Returns | |
---|---|
int |
either ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT |
Throws | |
---|---|
SQLException |
if a database access error occurs or this method is called on a closed result set |
int getInt (int columnIndex)
以Java编程语言中的 int
此 ResultSet
对象当前行中指定列的值。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
Returns | |
---|---|
int |
the column value; if the value is SQL NULL , the value returned is 0 |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
int getInt (String columnLabel)
以Java编程语言中的 int
此 ResultSet
对象的当前行中指定列的值。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
int |
the column value; if the value is SQL NULL , the value returned is 0 |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
long getLong (String columnLabel)
以Java编程语言中的 long
此 ResultSet
对象当前行中指定列的值。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
long |
the column value; if the value is SQL NULL , the value returned is 0 |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
long getLong (int columnIndex)
以Java编程语言中的 long
此 ResultSet
对象的当前行中指定列的值。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
Returns | |
---|---|
long |
the column value; if the value is SQL NULL , the value returned is 0 |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
ResultSetMetaData getMetaData ()
检索此 ResultSet
对象列的数量,类型和属性。
Returns | |
---|---|
ResultSetMetaData |
the description of this ResultSet object's columns |
Throws | |
---|---|
SQLException |
if a database access error occurs or this method is called on a closed result set |
Reader getNCharacterStream (int columnIndex)
以ResultSet
对象的形式java.io.Reader
此ResultSet
对象的当前行中指定列的值。 访问时,它适用于使用NCHAR
, NVARCHAR
和LONGNVARCHAR
列。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
Returns | |
---|---|
Reader |
a java.io.Reader object that contains the column value; if the value is SQL NULL , the value returned is null in the Java programming language. |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
Reader getNCharacterStream (String columnLabel)
以ResultSet
对象的形式java.io.Reader
此ResultSet
对象的当前行中指定列的值。 访问时,它适用于使用NCHAR
, NVARCHAR
和LONGNVARCHAR
列。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
Reader |
a java.io.Reader object that contains the column value; if the value is SQL NULL , the value returned is null in the Java programming language |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
NClob getNClob (String columnLabel)
以Java编程语言中的 ResultSet
对象的形式 NClob
此 ResultSet
对象当前行中指定列的值。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
NClob |
a NClob object representing the SQL NCLOB value in the specified column |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; this method is called on a closed result set or if a database access error occurs |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
NClob getNClob (int columnIndex)
以Java编程语言中的 ResultSet
对象的形式 NClob
此 ResultSet
对象的当前行中指定列的值。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
Returns | |
---|---|
NClob |
a NClob object representing the SQL NCLOB value in the specified column |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; this method is called on a closed result set or if a database access error occurs |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
String getNString (String columnLabel)
以Java编程语言中的String
此ResultSet
对象当前行中指定列的值。 访问时,它适用于使用NCHAR
, NVARCHAR
和LONGNVARCHAR
列。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
String |
the column value; if the value is SQL NULL , the value returned is null |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
String getNString (int columnIndex)
以Java编程语言中的String
此ResultSet
对象当前行中指定列的值。 访问时,它适用于使用NCHAR
, NVARCHAR
和LONGNVARCHAR
列。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
Returns | |
---|---|
String |
the column value; if the value is SQL NULL , the value returned is null |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
Object getObject (int columnIndex)
以Java编程语言中的 Object
获取此 ResultSet
对象当前行中指定列的值。
此方法将以Java对象的形式返回给定列的值。 根据JDBC规范中指定的内置类型的映射,Java对象的类型将是与列的SQL类型对应的默认Java对象类型。 如果该值是一个SQL NULL
,则该驱动程序将返回一个Java null
。
此方法也可用于读取数据库特定的抽象数据类型。 在JDBC 2.0 API中,方法getObject
的行为被扩展为实现SQL用户定义类型的数据。
如果Connection.getTypeMap
不会抛出SQLFeatureNotSupportedException
,那么当列包含结构化值或不同值时,此方法的行为就好像是对getObject(columnIndex, this.getStatement().getConnection().getTypeMap())
的调用。 如果Connection.getTypeMap
确实会抛出SQLFeatureNotSupportedException
,则不支持结构化值,并且将不同值映射到由DISTINCT类型的基础SQL类型确定的默认Java类。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
Returns | |
---|---|
Object |
a java.lang.Object holding the column value |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
Object getObject (String columnLabel)
以Java编程语言中的 Object
获取此 ResultSet
对象当前行中指定列的值。
此方法将以Java对象的形式返回给定列的值。 根据JDBC规范中指定的内置类型的映射,Java对象的类型将是与列的SQL类型对应的默认Java对象类型。 如果该值是SQL NULL
,则该驱动程序将返回Java null
。
此方法也可用于读取数据库特定的抽象数据类型。
在JDBC 2.0 API中,扩展了方法getObject
的行为以实现SQL用户定义类型的数据。 当列包含结构化或不同的值时,此方法的行为就好像是对getObject(columnIndex, this.getStatement().getConnection().getTypeMap())
的调用。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
Object |
a java.lang.Object holding the column value |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
Object getObject (int columnIndex, Map<String, Class<?>> map)
以Java编程语言中的Object
此ResultSet
对象当前行中指定列的值。 如果该值是SQL NULL
,则驱动程序将返回Java null
。 此方法将给定的Map
对象用于正在检索的SQL结构化或不同类型的自定义映射。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
map |
Map : a java.util.Map object that contains the mapping from SQL type names to classes in the Java programming language |
Returns | |
---|---|
Object |
an Object in the Java programming language representing the SQL value |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
Object getObject (String columnLabel, Map<String, Class<?>> map)
以Java编程语言中的Object
此ResultSet
对象当前行中指定列的值。 如果该值是SQL NULL
,则驱动程序将返回Java null
。 如果适用,此方法使用指定的Map
对象进行自定义映射。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
map |
Map : a java.util.Map object that contains the mapping from SQL type names to classes in the Java programming language |
Returns | |
---|---|
Object |
an Object representing the SQL value in the specified column |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
Ref getRef (int columnIndex)
以Java编程语言中的 ResultSet
对象的形式 Ref
此 ResultSet
对象当前行中指定列的值。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
Returns | |
---|---|
Ref |
a Ref object representing an SQL REF value |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
Ref getRef (String columnLabel)
以Java编程语言中的 ResultSet
对象的形式 Ref
此 ResultSet
对象的当前行中指定列的值。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
Ref |
a Ref object representing the SQL REF value in the specified column |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
int getRow ()
检索当前行号。 第一行是数字1,第二个数字2,依此类推。
注意:支持 getRow
方法是 ResultSet
的可选方法,结果集类型为 TYPE_FORWARD_ONLY
Returns | |
---|---|
int |
the current row number; 0 if there is no current row |
Throws | |
---|---|
SQLException |
if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
RowId getRowId (int columnIndex)
以Java编程语言中的 ResultSet
对象的形式 java.sql.RowId
此 ResultSet
对象当前行中指定列的值。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second 2, ... |
Returns | |
---|---|
RowId |
the column value; if the value is a SQL NULL the value returned is null |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
RowId getRowId (String columnLabel)
以Java编程语言中的 ResultSet
对象的形式 java.sql.RowId
此 ResultSet
对象当前行中指定列的值。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
RowId |
the column value ; if the value is a SQL NULL the value returned is null |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
SQLXML getSQLXML (String columnLabel)
以Java编程语言中的 java.sql.SQLXML
对象的形式获取此 ResultSet
的当前行中指定列的值。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
SQLXML |
a SQLXML object that maps an SQL XML value |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
SQLXML getSQLXML (int columnIndex)
以Java编程语言中的 java.sql.SQLXML
对象的形式 java.sql.SQLXML
此 ResultSet
的当前行中指定列的值。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
Returns | |
---|---|
SQLXML |
a SQLXML object that maps an SQL XML value |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
short getShort (String columnLabel)
以Java编程语言中的 short
此 ResultSet
对象当前行中指定列的值。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
short |
the column value; if the value is SQL NULL , the value returned is 0 |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
short getShort (int columnIndex)
以Java编程语言中的 short
此 ResultSet
对象当前行中指定列的值。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
Returns | |
---|---|
short |
the column value; if the value is SQL NULL , the value returned is 0 |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
Statement getStatement ()
检索Statement
生成此对象ResultSet
对象。 如果结果集是以其他方式生成的,例如通过DatabaseMetaData
方法,则此方法可能会返回null
。
Returns | |
---|---|
Statement |
the Statment object that produced this ResultSet object or null if the result set was produced some other way |
Throws | |
---|---|
SQLException |
if a database access error occurs or this method is called on a closed result set |
String getString (int columnIndex)
以Java编程语言中的 String
此 ResultSet
对象当前行中指定列的值。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
Returns | |
---|---|
String |
the column value; if the value is SQL NULL , the value returned is null |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
String getString (String columnLabel)
以Java编程语言中的 String
此 ResultSet
对象当前行中指定列的值。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
String |
the column value; if the value is SQL NULL , the value returned is null |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
Time getTime (String columnLabel)
以Java编程语言中的 ResultSet
对象的形式 java.sql.Time
此 ResultSet
对象的当前行中指定列的值。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
Time |
the column value; if the value is SQL NULL , the value returned is null |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
Time getTime (String columnLabel, Calendar cal)
以Java编程语言中的ResultSet
对象的形式java.sql.Time
此ResultSet
对象的当前行中指定列的值。 如果底层数据库不存储时区信息,则此方法使用给定日历为该时间构造适当的毫秒值。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
cal |
Calendar : the java.util.Calendar object to use in constructing the time |
Returns | |
---|---|
Time |
the column value as a java.sql.Time object; if the value is SQL NULL , the value returned is null in the Java programming language |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
Time getTime (int columnIndex)
以Java编程语言中的 ResultSet
对象的形式 java.sql.Time
此 ResultSet
对象当前行中指定列的值。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
Returns | |
---|---|
Time |
the column value; if the value is SQL NULL , the value returned is null |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
Time getTime (int columnIndex, Calendar cal)
以Java编程语言中的ResultSet
对象的形式java.sql.Time
此ResultSet
对象的当前行中指定列的值。 如果底层数据库不存储时区信息,则此方法使用给定日历为该时间构造适当的毫秒值。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
cal |
Calendar : the java.util.Calendar object to use in constructing the time |
Returns | |
---|---|
Time |
the column value as a java.sql.Time object; if the value is SQL NULL , the value returned is null in the Java programming language |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
Timestamp getTimestamp (int columnIndex, Calendar cal)
以Java编程语言中的ResultSet
对象的形式java.sql.Timestamp
此ResultSet
对象当前行中指定列的值。 如果底层数据库不存储时区信息,则此方法使用给定的日历为时间戳创建适当的毫秒值。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
cal |
Calendar : the java.util.Calendar object to use in constructing the timestamp |
Returns | |
---|---|
Timestamp |
the column value as a java.sql.Timestamp object; if the value is SQL NULL , the value returned is null in the Java programming language |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
Timestamp getTimestamp (int columnIndex)
以Java编程语言中的 ResultSet
对象的形式 java.sql.Timestamp
此 ResultSet
对象当前行中指定列的值。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
Returns | |
---|---|
Timestamp |
the column value; if the value is SQL NULL , the value returned is null |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
Timestamp getTimestamp (String columnLabel, Calendar cal)
以Java编程语言中的ResultSet
对象的形式java.sql.Timestamp
此ResultSet
对象当前行中指定列的值。 如果底层数据库不存储时区信息,则此方法使用给定的日历为时间戳创建适当的毫秒值。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
cal |
Calendar : the java.util.Calendar object to use in constructing the date |
Returns | |
---|---|
Timestamp |
the column value as a java.sql.Timestamp object; if the value is SQL NULL , the value returned is null in the Java programming language |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid or if a database access error occurs or this method is called on a closed result set |
Timestamp getTimestamp (String columnLabel)
以Java编程语言中的 ResultSet
对象的形式 java.sql.Timestamp
此 ResultSet
对象的当前行中指定列的值。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
Timestamp |
the column value; if the value is SQL NULL , the value returned is null |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
int getType ()
检索此ResultSet
对象的类型。 该类型由创建结果集的Statement
对象确定。
Returns | |
---|---|
int |
ResultSet.TYPE_FORWARD_ONLY , ResultSet.TYPE_SCROLL_INSENSITIVE , or ResultSet.TYPE_SCROLL_SENSITIVE |
Throws | |
---|---|
SQLException |
if a database access error occurs or this method is called on a closed result set |
URL getURL (int columnIndex)
以Java编程语言中的 ResultSet
对象的形式 java.net.URL
此 ResultSet
对象的当前行中指定列的值。
Parameters | |
---|---|
columnIndex |
int : the index of the column 1 is the first, 2 is the second,... |
Returns | |
---|---|
URL |
the column value as a java.net.URL object; if the value is SQL NULL , the value returned is null in the Java programming language |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; this method is called on a closed result set or if a URL is malformed |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
URL getURL (String columnLabel)
以Java编程语言中的 ResultSet
对象的形式 java.net.URL
此 ResultSet
对象当前行中指定列的值。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
URL |
the column value as a java.net.URL object; if the value is SQL NULL , the value returned is null in the Java programming language |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; this method is called on a closed result set or if a URL is malformed |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
InputStream getUnicodeStream (int columnIndex)
此方法在API级别1中已弃用。
用getCharacterStream
代替getUnicodeStream
检索此ResultSet
对象当前行中指定列的值,作为两个字节的3个字符的流。 第一个字节是高字节; 第二个字节是低字节。 然后可以从流中读取该块的值。 该方法特别适用于获取大LONGVARCHAR
值。 JDBC驱动程序将执行从数据库格式到Unicode的任何必要转换。
注意:必须在获取任何其他列的值之前读取返回流中的所有数据。 下一次调用getter方法会隐式关闭流。 此外,一个流可以返回0
当方法InputStream.available
被调用时,是否有数据可用。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
Returns | |
---|---|
InputStream |
a Java input stream that delivers the database column value as a stream of two-byte Unicode characters; if the value is SQL NULL , the value returned is null |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
InputStream getUnicodeStream (String columnLabel)
此方法在API级别1中已弃用。
改为使用getCharacterStream
以双字节Unicode字符流的形式检索此ResultSet
对象当前行中指定列的值。 第一个字节是高字节; 第二个字节是低字节。 然后可以从流中读取该块的值。 该方法特别适用于检索较大的LONGVARCHAR
值。 启用JDBC技术的驱动程序将执行从数据库格式到Unicode的任何必要转换。
注意:必须在获取任何其他列的值之前读取返回流中的所有数据。 下一次调用getter方法会隐式关闭流。 此外,一个流可以返回0
当方法InputStream.available
被调用时,是否有数据可用。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Returns | |
---|---|
InputStream |
a Java input stream that delivers the database column value as a stream of two-byte Unicode characters. If the value is SQL NULL , the value returned is null . |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
SQLWarning getWarnings ()
检索此ResultSet
对象通过调用报告的第一个警告。 此ResultSet
对象上的后续警告将被链接到此方法返回的SQLWarning
对象。
每次读取新行时,警告链都会自动清除。 可能未在已关闭的ResultSet
对象上调用此方法; 这样做会导致抛出SQLException
。
注意:此警告链只包含由ResultSet
方法引起的警告。 由Statement
方法引起的任何警告(例如读取OUT参数)将被链接在Statement
对象上。
Returns | |
---|---|
SQLWarning |
the first SQLWarning object reported or null if there are none |
Throws | |
---|---|
SQLException |
if a database access error occurs or this method is called on a closed result set |
void insertRow ()
将插入行的内容插入此ResultSet
对象和数据库中。 调用此方法时,游标必须位于插入行上。
Throws | |
---|---|
SQLException |
if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY , this method is called on a closed result set, if this method is called when the cursor is not on the insert row, or if not all of non-nullable columns in the insert row have been given a non-null value |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
boolean isAfterLast ()
检索光标是否位于此 ResultSet
对象中的最后一行之后。
注意:支持 isAfterLast
方法对于 ResultSet
是可选的,结果集类型为 TYPE_FORWARD_ONLY
Returns | |
---|---|
boolean |
true if the cursor is after the last row; false if the cursor is at any other position or the result set contains no rows |
Throws | |
---|---|
SQLException |
if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
boolean isBeforeFirst ()
检索光标是否位于此 ResultSet
对象的第一行之前。
注:支持为 isBeforeFirst
方法是可选的 ResultSet
s的一个结果集类型 TYPE_FORWARD_ONLY
Returns | |
---|---|
boolean |
true if the cursor is before the first row; false if the cursor is at any other position or the result set contains no rows |
Throws | |
---|---|
SQLException |
if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
boolean isClosed ()
检索此ResultSet
对象是否已关闭。 如果方法关闭已被调用,或者自动关闭,则ResultSet
将关闭。
Returns | |
---|---|
boolean |
true if this ResultSet object is closed; false if it is still open |
Throws | |
---|---|
SQLException |
if a database access error occurs |
boolean isFirst ()
检索光标是否位于此 ResultSet
对象的第一行。
注:支持为 isFirst
方法是可选的 ResultSet
s的一个结果集类型 TYPE_FORWARD_ONLY
Returns | |
---|---|
boolean |
true if the cursor is on the first row; false otherwise |
Throws | |
---|---|
SQLException |
if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
boolean isLast ()
检索光标是否位于此ResultSet
对象的最后一行。 注意:调用方法isLast
可能会很昂贵,因为JDBC驱动程序可能需要提前读取一行以确定当前行是否为结果集中的最后一行。
注意:支持 isLast
方法对于 ResultSet
是可选的,结果集类型为 TYPE_FORWARD_ONLY
Returns | |
---|---|
boolean |
true if the cursor is on the last row; false otherwise |
Throws | |
---|---|
SQLException |
if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
boolean last ()
将光标移到此 ResultSet
对象中的最后一行。
Returns | |
---|---|
boolean |
true if the cursor is on a valid row; false if there are no rows in the result set |
Throws | |
---|---|
SQLException |
if a database access error occurs; this method is called on a closed result set or the result set type is TYPE_FORWARD_ONLY |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void moveToCurrentRow ()
将光标移动到记忆的光标位置,通常是当前行。 如果游标不在插入行上,则此方法不起作用。
Throws | |
---|---|
SQLException |
if a database access error occurs; this method is called on a closed result set or the result set concurrency is CONCUR_READ_ONLY |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void moveToInsertRow ()
将光标移动到插入行。 当光标位于插入行上时,当前光标位置被记住。 插入行是与可更新结果集关联的特殊行。 它本质上是一个缓冲区,在将行插入结果集之前,可以通过调用updater方法来构造新行。 当光标位于插入行上时,只有更新程序,getter和insertRow
方法可能会被调用。 调用结果集中的所有列必须在调用insertRow
之前每次调用此方法时给定一个值。 在可以在列值上调用getter方法之前,必须调用updater方法。
Throws | |
---|---|
SQLException |
if a database access error occurs; this method is called on a closed result set or the result set concurrency is CONCUR_READ_ONLY |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
boolean next ()
将光标从当前位置移动一行。 一个ResultSet
光标最初位于第一行之前; 对方法next
的第一个调用使第一行成为当前行; 第二次调用使第二行成为当前行,依此类推。
当对next
方法的调用返回false
,光标位于最后一行之后。 任何需要当前行的ResultSet
方法调用都会导致抛出SQLException
。 如果结果集类型为TYPE_FORWARD_ONLY
,它是指定的JDBC驱动程序实现是否会返回供应商false
或抛出SQLException
上的后续调用next
。
如果输入流对当前行打开,则调用方法next
将隐式关闭它。 当读取新行时, ResultSet
对象的警告链将被清除。
Returns | |
---|---|
boolean |
true if the new current row is valid; false if there are no more rows |
Throws | |
---|---|
SQLException |
if a database access error occurs or this method is called on a closed result set |
boolean previous ()
将光标移到此 ResultSet
对象中的上一行。
当对previous
方法的调用返回false
,光标位于第一行之前。 任何需要当前行的ResultSet
方法的调用都会导致抛出SQLException
。
如果输入流对当前行打开,则调用方法previous
将隐式关闭它。 当读取新行时, ResultSet
对象的警告更改被清除。
Returns | |
---|---|
boolean |
true if the cursor is now positioned on a valid row; false if the cursor is positioned before the first row |
Throws | |
---|---|
SQLException |
if a database access error occurs; this method is called on a closed result set or the result set type is TYPE_FORWARD_ONLY |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void refreshRow ()
使用数据库中的最新值刷新当前行。 当光标位于插入行上时,不能调用此方法。
refreshRow
方法为应用程序提供了一种方式,可以明确告诉JDBC驱动程序从数据库中重新获取行。 当JDBC驱动程序正在执行高速缓存或预取时,应用程序可能需要调用refreshRow
以从数据库中获取最新的行值。 如果提取大小大于1,则JDBC驱动程序可能实际上一次刷新多行。
所有值都会根据事务隔离级别和光标灵敏度进行重新设置。 如果在调用更新方法之后调用refreshRow
,但在调用方法updateRow
之前,则对该行进行的更新将丢失。 经常调用方法refreshRow
可能会降低性能。
Throws | |
---|---|
SQLException |
if a database access error occurs; this method is called on a closed result set; the result set type is TYPE_FORWARD_ONLY or if this method is called when the cursor is on the insert row |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method or this method is not supported for the specified result set type and result set concurrency. |
boolean relative (int rows)
将光标移动相对的行数,无论是正数还是负数。 试图超出结果集中的第一行/最后一行,将光标定位在第一行/最后一行之前/之后。 调用relative(0)
是有效的,但不会更改光标位置。
注:调用方法 relative(1)
是相同的调用方法 next()
并调用方法 relative(-1)
是相同的调用方法 previous()
。
Parameters | |
---|---|
rows |
int : an int 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 |
Returns | |
---|---|
boolean |
true if the cursor is on a row; false otherwise |
Throws | |
---|---|
SQLException |
if a database access error occurs; this method is called on a closed result set or the result set type is TYPE_FORWARD_ONLY |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
boolean rowDeleted ()
检索一行是否已被删除。 删除的行可能在结果集中留下可见的“洞”。 该方法可用于检测结果集中的孔。 返回的值取决于此ResultSet
对象是否可以检测到删除。
注意:支持 rowDeleted
方法是可选的,结果集并发性为 CONCUR_READ_ONLY
Returns | |
---|---|
boolean |
true if the current row is detected to have been deleted by the owner or another; false otherwise |
Throws | |
---|---|
SQLException |
if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
也可以看看:
boolean rowInserted ()
检索当前行是否有插入。 返回的值取决于是否这ResultSet
对象可以检测可见插入。
注意:支持 rowInserted
方法是可选的,结果集并发性为 CONCUR_READ_ONLY
Returns | |
---|---|
boolean |
true if the current row is detected to have been inserted; false otherwise |
Throws | |
---|---|
SQLException |
if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
也可以看看:
boolean rowUpdated ()
检索当前行是否已更新。 返回的值取决于结果集是否可以检测到更新。
注意:支持 rowUpdated
方法是可选的,结果集并发性为 CONCUR_READ_ONLY
Returns | |
---|---|
boolean |
true if the current row is detected to have been visibly updated by the owner or another; false otherwise |
Throws | |
---|---|
SQLException |
if a database access error occurs or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
也可以看看:
void setFetchDirection (int direction)
给出关于此ResultSet
对象中的行将被处理的方向的提示。 初始值由生成此ResultSet
对象的Statement
对象确定。 读取方向可能随时更改。
Parameters | |
---|---|
direction |
int : an int specifying the suggested fetch direction; one of ResultSet.FETCH_FORWARD , ResultSet.FETCH_REVERSE , or ResultSet.FETCH_UNKNOWN |
Throws | |
---|---|
SQLException |
if a database access error occurs; this method is called on a closed result set or the result set type is TYPE_FORWARD_ONLY and the fetch direction is not FETCH_FORWARD |
void setFetchSize (int rows)
当此ResultSet
对象需要更多行时,向JDBC驱动程序提示应该从数据库中提取的行数。 如果指定的读取大小为零,那么JDBC驱动程序将忽略该值,并可自由地对自己的读取大小进行自己的最佳猜测。 默认值由创建结果集的Statement
对象设置。 提取大小可能会随时更改。
Parameters | |
---|---|
rows |
int : the number of rows to fetch |
Throws | |
---|---|
SQLException |
if a database access error occurs; this method is called on a closed result set or the condition rows >= 0 is not satisfied |
也可以看看:
void updateArray (String columnLabel, Array x)
用java.sql.Array
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
x |
Array : the new column value |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateArray (int columnIndex, Array x)
用java.sql.Array
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
Array : the new column value |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateAsciiStream (int columnIndex, InputStream x)
用ascii流值更新指定的列。 数据将根据需要从流中读取,直到达到流结束。
updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
注意:请查阅您的JDBC驱动程序文档以确定使用带有长度参数的 updateAsciiStream
版本是否更有效。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
InputStream : the new column value |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateAsciiStream (int columnIndex, InputStream x, long length)
使用ascii流值更新指定列,该值将具有指定的字节数。
updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
InputStream : the new column value |
length |
long : the length of the stream |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateAsciiStream (String columnLabel, InputStream x, long length)
使用ascii流值更新指定列,该值将具有指定的字节数。
updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
x |
InputStream : the new column value |
length |
long : the length of the stream |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateAsciiStream (String columnLabel, InputStream x)
用ascii流值更新指定的列。 数据将根据需要从流中读取,直到达到流结束。
updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
注:请查阅您的JDBC驱动程序文档以确定使用带有长度参数的 updateAsciiStream
版本是否更有效。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
x |
InputStream : the new column value |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateAsciiStream (int columnIndex, InputStream x, int length)
使用ascii流值更新指定列,该值将具有指定的字节数。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
InputStream : the new column value |
length |
int : the length of the stream |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateAsciiStream (String columnLabel, InputStream x, int length)
使用ascii流值更新指定列,该值将具有指定的字节数。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
x |
InputStream : the new column value |
length |
int : the length of the stream |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateBigDecimal (int columnIndex, BigDecimal x)
用java.math.BigDecimal
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
BigDecimal : the new column value |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateBigDecimal (String columnLabel, BigDecimal x)
用java.sql.BigDecimal
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
x |
BigDecimal : the new column value |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateBinaryStream (int columnIndex, InputStream x, int length)
用二进制流值更新指定列,该值将具有指定的字节数。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
InputStream : the new column value |
length |
int : the length of the stream |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateBinaryStream (int columnIndex, InputStream x)
用二进制流值更新指定的列。 数据将根据需要从流中读取,直到达到流结束。
updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
注:请查阅您的JDBC驱动程序文档,以确定使用带有长度参数的 updateBinaryStream
版本是否更有效。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
InputStream : the new column value |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateBinaryStream (String columnLabel, InputStream x, long length)
用二进制流值更新指定列,该值将具有指定的字节数。
updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
x |
InputStream : the new column value |
length |
long : the length of the stream |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateBinaryStream (String columnLabel, InputStream x)
用二进制流值更新指定的列。 数据将根据需要从流中读取,直到达到流结束。
updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
注意:请查阅您的JDBC驱动程序文档以确定使用带有长度参数的版本 updateBinaryStream
是否更有效。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
x |
InputStream : the new column value |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateBinaryStream (String columnLabel, InputStream x, int length)
用二进制流值更新指定列,该值将具有指定的字节数。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
x |
InputStream : the new column value |
length |
int : the length of the stream |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateBinaryStream (int columnIndex, InputStream x, long length)
用二进制流值更新指定列,该值将具有指定的字节数。
updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
InputStream : the new column value |
length |
long : the length of the stream |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateBlob (String columnLabel, Blob x)
用java.sql.Blob
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
x |
Blob : the new column value |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateBlob (String columnLabel, InputStream inputStream)
使用给定的输入流更新指定的列。 数据将根据需要从流中读取,直到达到流结束。
updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
注意:请查阅您的JDBC驱动程序文档以确定使用带有长度参数的 updateBlob
版本是否更有效。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
inputStream |
InputStream : An object that contains the data to set the parameter value to. |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateBlob (int columnIndex, Blob x)
用java.sql.Blob
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
Blob : the new column value |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateBlob (String columnLabel, InputStream inputStream, long length)
使用给定的输入流更新指定的列,该输入流将具有指定的字节数。
updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
inputStream |
InputStream : An object that contains the data to set the parameter value to. |
length |
long : the number of bytes in the parameter data. |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateBlob (int columnIndex, InputStream inputStream)
使用给定的输入流更新指定的列。 数据将根据需要从流中读取,直到达到流结束。
updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
注:请查阅您的JDBC驱动程序文档以确定使用带有长度参数的 updateBlob
版本是否更有效。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
inputStream |
InputStream : An object that contains the data to set the parameter value to. |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateBlob (int columnIndex, InputStream inputStream, long length)
使用给定的输入流更新指定的列,该输入流将具有指定的字节数。
updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
inputStream |
InputStream : An object that contains the data to set the parameter value to. |
length |
long : the number of bytes in the parameter data. |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateBoolean (String columnLabel, boolean x)
用boolean
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
x |
boolean : the new column value |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateBoolean (int columnIndex, boolean x)
用boolean
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
boolean : the new column value |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateByte (int columnIndex, byte x)
用byte
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
byte : the new column value |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateByte (String columnLabel, byte x)
用byte
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
x |
byte : the new column value |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateBytes (int columnIndex, byte[] x)
用byte
数组值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
byte : the new column value |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateBytes (String columnLabel, byte[] x)
用字节数组值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
x |
byte : the new column value |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateCharacterStream (String columnLabel, Reader reader, int length)
使用字符流值更新指定的列,该值将具有指定的字节数。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
reader |
Reader : the java.io.Reader object containing the new column value |
length |
int : the length of the stream |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateCharacterStream (String columnLabel, Reader reader, long length)
使用字符流值更新指定的列,该值将具有指定的字节数。
updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
reader |
Reader : the java.io.Reader object containing the new column value |
length |
long : the length of the stream |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateCharacterStream (int columnIndex, Reader x, long length)
使用字符流值更新指定的列,该值将具有指定的字节数。
updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
Reader : the new column value |
length |
long : the length of the stream |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateCharacterStream (int columnIndex, Reader x)
用字符流值更新指定的列。 数据将根据需要从流中读取,直到达到流结束。
updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
注意:请查阅您的JDBC驱动程序文档,以确定使用带有长度参数的 updateCharacterStream
版本是否更有效。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
Reader : the new column value |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateCharacterStream (int columnIndex, Reader x, int length)
使用字符流值更新指定的列,该值将具有指定的字节数。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
Reader : the new column value |
length |
int : the length of the stream |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateCharacterStream (String columnLabel, Reader reader)
用字符流值更新指定的列。 数据将根据需要从流中读取,直到达到流结束。
updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
注意:请查阅您的JDBC驱动程序文档,以确定使用带有长度参数的 updateCharacterStream
版本是否更有效。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
reader |
Reader : the java.io.Reader object containing the new column value |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateClob (int columnIndex, Clob x)
用java.sql.Clob
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
Clob : the new column value |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateClob (String columnLabel, Reader reader)
使用给定的Reader
对象更新指定的列。 数据将根据需要从流中读取,直到达到流结束。 JDBC驱动程序将执行从UNICODE到数据库字符格式的任何必要转换。
updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
注:请查阅您的JDBC驱动程序文档,以确定使用带有长度参数的版本 updateClob
是否更有效。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
reader |
Reader : An object that contains the data to set the parameter value to. |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateClob (String columnLabel, Reader reader, long length)
使用给定的Reader
对象更新指定的列,该对象是给定的字符长度。 当一个非常大的UNICODE值输入到LONGVARCHAR
参数时,通过java.io.Reader
对象发送它可能更实际。 JDBC驱动程序将执行从UNICODE到数据库字符格式的任何必要转换。
updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
reader |
Reader : An object that contains the data to set the parameter value to. |
length |
long : the number of characters in the parameter data. |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateClob (int columnIndex, Reader reader)
使用给定的Reader
对象更新指定的列。 数据将根据需要从流中读取,直到达到流结束。 JDBC驱动程序将执行从UNICODE到数据库字符格式的任何必要转换。
updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
注意:请查阅您的JDBC驱动程序文档以确定使用带有长度参数的 updateClob
版本是否更有效。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
reader |
Reader : An object that contains the data to set the parameter value to. |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateClob (int columnIndex, Reader reader, long length)
使用给定的Reader
对象更新指定的列,该对象是给定的字符长度。 当一个非常大的UNICODE值输入到LONGVARCHAR
参数时,通过java.io.Reader
对象发送它可能更实际。 JDBC驱动程序将执行从UNICODE到数据库字符格式的任何必要转换。
updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
reader |
Reader : An object that contains the data to set the parameter value to. |
length |
long : the number of characters in the parameter data. |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateClob (String columnLabel, Clob x)
用java.sql.Clob
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
x |
Clob : the new column value |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateDate (int columnIndex, Date x)
用java.sql.Date
值更新指定列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
Date : the new column value |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateDate (String columnLabel, Date x)
用java.sql.Date
值更新指定列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
x |
Date : the new column value |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateDouble (String columnLabel, double x)
用double
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
x |
double : the new column value |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateDouble (int columnIndex, double x)
用double
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
double : the new column value |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateFloat (int columnIndex, float x)
用float
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
float : the new column value |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateFloat (String columnLabel, float x)
用float
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
x |
float : the new column value |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateInt (String columnLabel, int x)
用int
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
x |
int : the new column value |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateInt (int columnIndex, int x)
用int
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
int : the new column value |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateLong (int columnIndex, long x)
用long
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
long : the new column value |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateLong (String columnLabel, long x)
用long
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
x |
long : the new column value |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateNCharacterStream (int columnIndex, Reader x, long length)
使用字符流值更新指定的列,该值将具有指定的字节数。 驱动程序将从Java字符格式转换为数据库中的国家字符集。 更新时,它适用于使用NCHAR
, NVARCHAR
和LONGNVARCHAR
列。
updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
Reader : the new column value |
length |
long : the length of the stream |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateNCharacterStream (String columnLabel, Reader reader)
用字符流值更新指定的列。 数据将根据需要从流中读取,直到达到流结束。 驱动程序将从Java字符格式转换为数据库中的国家字符集。 更新时,它适用于使用NCHAR
, NVARCHAR
和LONGNVARCHAR
列。
updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
注意:请查阅您的JDBC驱动程序文档以确定使用带有长度参数的版本 updateNCharacterStream
是否更有效。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
reader |
Reader : the java.io.Reader object containing the new column value |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateNCharacterStream (int columnIndex, Reader x)
用字符流值更新指定的列。 数据将根据需要从流中读取,直到达到流结束。 驱动程序将从Java字符格式转换为数据库中的国家字符集。 更新时,它适用于使用NCHAR
, NVARCHAR
和LONGNVARCHAR
列。
updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
注:请查阅您的JDBC驱动程序文档,以确定使用带有长度参数的 updateNCharacterStream
版本是否更有效。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
Reader : the new column value |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateNCharacterStream (String columnLabel, Reader reader, long length)
使用字符流值更新指定的列,该值将具有指定的字节数。 驱动程序将从Java字符格式转换为数据库中的国家字符集。 更新时,它适用于使用NCHAR
, NVARCHAR
和LONGNVARCHAR
列。
updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
reader |
Reader : the java.io.Reader object containing the new column value |
length |
long : the length of the stream |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateNClob (int columnIndex, Reader reader, long length)
使用给定的Reader
对象更新指定的列,该对象是给定的字符长度。 当一个非常大的UNICODE值输入到LONGVARCHAR
参数时,通过java.io.Reader
对象发送它可能更实际。 JDBC驱动程序将执行从UNICODE到数据库字符格式的任何必要转换。
updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second 2, ... |
reader |
Reader : An object that contains the data to set the parameter value to. |
length |
long : the number of characters in the parameter data. |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; this method is called on a closed result set, if a database access error occurs or the result set concurrency is CONCUR_READ_ONLY |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateNClob (int columnIndex, NClob nClob)
用java.sql.NClob
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second 2, ... |
nClob |
NClob : the value for the column to be updated |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; this method is called on a closed result set; if a database access error occurs or the result set concurrency is CONCUR_READ_ONLY |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateNClob (String columnLabel, NClob nClob)
用java.sql.NClob
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
nClob |
NClob : the value for the column to be updated |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; this method is called on a closed result set; if a database access error occurs or the result set concurrency is CONCUR_READ_ONLY |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateNClob (String columnLabel, Reader reader)
使用给定的Reader
对象更新指定的列。 数据将根据需要从流中读取,直到达到流结束。 JDBC驱动程序将执行从UNICODE到数据库字符格式的任何必要转换。
updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
注:请查阅您的JDBC驱动程序文档以确定使用带有长度参数的 updateNClob
版本是否更有效。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
reader |
Reader : An object that contains the data to set the parameter value to. |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; this method is called on a closed result set; if a database access error occurs or the result set concurrency is CONCUR_READ_ONLY |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateNClob (String columnLabel, Reader reader, long length)
使用给定的Reader
对象更新指定的列,该对象是给定的字符长度。 当一个非常大的UNICODE值输入到LONGVARCHAR
参数时,通过java.io.Reader
对象发送它可能更实用。 JDBC驱动程序将执行从UNICODE到数据库字符格式的任何必要转换。
updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
reader |
Reader : An object that contains the data to set the parameter value to. |
length |
long : the number of characters in the parameter data. |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; this method is called on a closed result set; if a database access error occurs or the result set concurrency is CONCUR_READ_ONLY |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateNClob (int columnIndex, Reader reader)
使用给定的Reader
更新指定的列根据需要从流中读取数据,直到达到流结束。 JDBC驱动程序将执行从UNICODE到数据库字符格式的任何必要转换。
updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
注:请查阅您的JDBC驱动程序文档,以确定使用带有长度参数的 updateNClob
版本是否更有效。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second 2, ... |
reader |
Reader : An object that contains the data to set the parameter value to. |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; this method is called on a closed result set, if a database access error occurs or the result set concurrency is CONCUR_READ_ONLY |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateNString (String columnLabel, String nString)
用String
值更新指定的列。 更新时,它适用于使用NCHAR
, NVARCHAR
和LONGNVARCHAR
列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
nString |
String : the value for the column to be updated |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; this method is called on a closed result set; the result set concurrency is CONCUR_READ_ONLY or if a database access error occurs |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateNString (int columnIndex, String nString)
用String
值更新指定的列。 更新时,它适用于使用NCHAR
, NVARCHAR
和LONGNVARCHAR
列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second 2, ... |
nString |
String : the value for the column to be updated |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; this method is called on a closed result set; the result set concurrency is CONCUR_READ_ONLY or if a database access error occurs |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateNull (int columnIndex)
用null
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateNull (String columnLabel)
用null
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateObject (int columnIndex, Object x)
用Object
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
Object : the new column value |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateObject (int columnIndex, Object x, int scaleOrLength)
用Object
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
如果第二个参数是InputStream
那么该流必须包含scaleOrLength指定的字节数。 如果第二个参数是Reader
那么阅读器必须包含scaleOrLength指定的字符数。 如果这些条件不成立,驱动程序将在语句执行时生成SQLException
。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
Object : the new column value |
scaleOrLength |
int : for an object of java.math.BigDecimal , this is the number of digits after the decimal point. For Java Object types InputStream and Reader , this is the length of the data in the stream or reader. For all other types, this value will be ignored. |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateObject (String columnLabel, Object x, int scaleOrLength)
用Object
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
如果第二个参数是InputStream
那么该流必须包含scaleOrLength指定的字节数。 如果第二个参数是Reader
则阅读器必须包含scaleOrLength指定的字符数。 如果这些条件不成立,驱动程序将在语句执行时生成一个SQLException
。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
x |
Object : the new column value |
scaleOrLength |
int : for an object of java.math.BigDecimal , this is the number of digits after the decimal point. For Java Object types InputStream and Reader , this is the length of the data in the stream or reader. For all other types, this value will be ignored. |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateObject (String columnLabel, Object x)
用Object
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
x |
Object : the new column value |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateRef (int columnIndex, Ref x)
用java.sql.Ref
值更新指定列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
Ref : the new column value |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateRef (String columnLabel, Ref x)
用java.sql.Ref
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
x |
Ref : the new column value |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateRow ()
使用此ResultSet
对象的当前行的新内容更新底层数据库。 当光标位于插入行上时,不能调用此方法。
Throws | |
---|---|
SQLException |
if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY ; this method is called on a closed result set or if this method is called when the cursor is on the insert row |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateRowId (int columnIndex, RowId x)
用RowId
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second 2, ... |
x |
RowId : the column value |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateRowId (String columnLabel, RowId x)
用RowId
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
x |
RowId : the column value |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateSQLXML (int columnIndex, SQLXML xmlObject)
用java.sql.SQLXML
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second 2, ... |
xmlObject |
SQLXML : the value for the column to be updated |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; this method is called on a closed result set; the java.xml.transform.Result , Writer or OutputStream has not been closed for the SQLXML object; if there is an error processing the XML value or the result set concurrency is CONCUR_READ_ONLY . The getCause method of the exception may provide a more detailed exception, for example, if the stream does not contain valid XML. |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateSQLXML (String columnLabel, SQLXML xmlObject)
用java.sql.SQLXML
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
xmlObject |
SQLXML : the column value |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; this method is called on a closed result set; the java.xml.transform.Result , Writer or OutputStream has not been closed for the SQLXML object; if there is an error processing the XML value or the result set concurrency is CONCUR_READ_ONLY . The getCause method of the exception may provide a more detailed exception, for example, if the stream does not contain valid XML. |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateShort (String columnLabel, short x)
用short
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
x |
short : the new column value |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateShort (int columnIndex, short x)
用short
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
short : the new column value |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateString (String columnLabel, String x)
用String
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
x |
String : the new column value |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateString (int columnIndex, String x)
用String
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
String : the new column value |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateTime (int columnIndex, Time x)
用java.sql.Time
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
Time : the new column value |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateTime (String columnLabel, Time x)
用java.sql.Time
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
x |
Time : the new column value |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateTimestamp (String columnLabel, Timestamp x)
用java.sql.Timestamp
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnLabel |
String : the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
x |
Timestamp : the new column value |
Throws | |
---|---|
SQLException |
if the columnLabel is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
void updateTimestamp (int columnIndex, Timestamp x)
用java.sql.Timestamp
值更新指定的列。 updater方法用于更新当前行或插入行中的列值。 updater方法不会更新底层数据库; 而是updateRow
或insertRow
方法来更新数据库。
Parameters | |
---|---|
columnIndex |
int : the first column is 1, the second is 2, ... |
x |
Timestamp : the new column value |
Throws | |
---|---|
SQLException |
if the columnIndex is not valid; if a database access error occurs; the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set |
SQLFeatureNotSupportedException |
if the JDBC driver does not support this method |
boolean wasNull ()
报告最后一列的读取值是否为SQL NULL
。 请注意,您必须首先调用列上的某个getter方法以尝试读取其值,然后调用方法wasNull
以查看读取的值是否为SQL NULL
。
Returns | |
---|---|
boolean |
true if the last column value read was SQL NULL and false otherwise |
Throws | |
---|---|
SQLException |
if a database access error occurs or this method is called on a closed result set |