📄 jdbcresultset.java
字号:
* Retrieves the value of the designated column in the current row
* of this <code>ResultSet</code> object as a <code>java.sql.Time</code>
* object in the Java programming language. <p>
* <!-- end generic documentation -->
*
* @param columnName the SQL name of the column
* @return the column value;
* if the value is SQL <code>NULL</code>,
* the value returned is <code>null</code>
* @exception SQLException if a database access error occurs
*/
public Time getTime(String columnName) throws SQLException {
return getTime(findColumn(columnName));
}
/**
* <!-- start generic documentation -->
* Retrieves the value of the designated column in the current row
* of this <code>ResultSet</code> object as
* a <code>java.sql.Timestamp</code> object. <p>
* <!-- end generic documentation -->
*
* @param columnName the SQL name of the column
* @return the column value; if the value is SQL <code>NULL</code>, the
* value returned is <code>null</code>
* @exception SQLException if a database access error occurs
*/
public Timestamp getTimestamp(String columnName) throws SQLException {
return getTimestamp(findColumn(columnName));
}
/**
* <!-- start generic documentation -->
* Retrieves the value of the designated column in the current row
* of this <code>ResultSet</code> object as a stream of
* ASCII characters. The value can then be read in chunks from the
* stream. This method is particularly
* suitable for retrieving large <code>LONGVARCHAR</code> values.
* The JDBC driver will
* do any necessary conversion from the database format into ASCII.
*
* <P><B>Note:</B> All the data in the returned stream must be
* read prior to getting the value of any other column. The next
* call to a getter method implicitly closes the stream. Also, a
* stream may return <code>0</code> when the method <code>available</code>
* is called whether there is data available or not. <p>
* <!-- end generic documentation -->
*
* @param columnName the SQL name of the column
* @return a Java input stream that delivers the database column value
* as a stream of one-byte ASCII characters.
* If the value is SQL <code>NULL</code>,
* the value returned is <code>null</code>.
* @exception SQLException if a database access error occurs
* @see #getAsciiStream(int)
*/
public java.io.InputStream getAsciiStream(String columnName)
throws SQLException {
return getAsciiStream(findColumn(columnName));
}
/**
* <!-- start generic documentation -->
* Retrieves the value of the designated column in the current row
* of this <code>ResultSet</code> object as a stream of two-byte
* Unicode characters. The first byte is the high byte; the second
* byte is the low byte.
*
* The value can then be read in chunks from the
* stream. This method is particularly
* suitable for retrieving large <code>LONGVARCHAR</code> values.
* The JDBC technology-enabled driver will
* do any necessary conversion from the database format into Unicode.
*
* <P><B>Note:</B> All the data in the returned stream must be
* read prior to getting the value of any other column. The next
* call to a getter method implicitly closes the stream.
* Also, a stream may return <code>0</code> when the method
* <code>InputStream.available</code> is called, whether there
* is data available or not. <p>
* <!-- end generic documentation -->
*
* @param columnName the SQL name of the column
* @return a Java input stream that delivers the database column value
* as a stream of two-byte Unicode characters.
* If the value is SQL <code>NULL</code>, the value returned
* is <code>null</code>.
* @exception SQLException if a database access error occurs
* @deprecated use <code>getCharacterStream</code> instead
* @see #getUnicodeStream(int)
*/
//#ifdef DEPRECATEDJDBC
public java.io.InputStream getUnicodeStream(String columnName)
throws SQLException {
return getUnicodeStream(findColumn(columnName));
}
//#endif
/**
* <!-- start generic documentation -->
* Retrieves the value of the designated column in the current row
* of this <code>ResultSet</code> object as a stream of uninterpreted
* <code>byte</code>s.
* The value can then be read in chunks from the
* stream. This method is particularly
* suitable for retrieving large <code>LONGVARBINARY</code>
* values.
*
* <P><B>Note:</B> All the data in the returned stream must be
* read prior to getting the value of any other column. The next
* call to a getter method implicitly closes the stream. Also, a
* stream may return <code>0</code> when the method <code>available</code>
* is called whether there is data available or not. <p>
* <!-- end generic documentation -->
*
* @param columnName the SQL name of the column
* @return a Java input stream that delivers the database column value
* as a stream of uninterpreted bytes;
* if the value is SQL <code>NULL</code>, the result is <code>null</code>
* @exception SQLException if a database access error occurs
*/
public java.io.InputStream getBinaryStream(String columnName)
throws SQLException {
return getBinaryStream(findColumn(columnName));
}
//=====================================================================
// Advanced features:
//=====================================================================
/**
* <!-- start generic documentation -->
* Retrieves the first warning reported by calls on this
* <code>ResultSet</code> object.
* Subsequent warnings on this <code>ResultSet</code> object
* will be chained to the <code>SQLWarning</code> object that
* this method returns.
*
* <P>The warning chain is automatically cleared each time a new
* row is read. This method may not be called on a <code>ResultSet</code>
* object that has been closed; doing so will cause an
* <code>SQLException</code> to be thrown.
* <P>
* <B>Note:</B> This warning chain only covers warnings caused
* by <code>ResultSet</code> methods. Any warning caused by
* <code>Statement</code> methods
* (such as reading OUT parameters) will be chained on the
* <code>Statement</code> object. <p>
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* Up to and including 1.7.1, HSQLDB does not produce
* <code>SQLWarning</code> objects. This method always returns
* <code>null</code>.
* </div>
* <!-- end release-specific documentation -->
*
* @return the first <code>SQLWarning</code> object reported or
* <code>null</code> if there are none <p>
*
* Up to and including 1.7.1, HSQLDB always returns null. <p>
* @exception SQLException if a database access error occurs or this
* method is called on a closed result set
*/
public SQLWarning getWarnings() throws SQLException {
return null;
}
/**
* <!-- start generic documentation -->
* Clears all warnings reported on this <code>ResultSet</code> object.
* After this method is called, the method <code>getWarnings</code>
* returns <code>null</code> until a new warning is
* reported for this <code>ResultSet</code> object. <p>
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* Including 1.7.1, HSQLDB does not produce <code>SQLWarning</code>
* objects on any ResultSet object warning chain; calls to this method
* are ignored.
* </div>
* <!-- end release-specific documentation -->
*
* @exception SQLException if a database access error occurs
*/
public void clearWarnings() throws SQLException {}
/**
* <!-- start generic documentation -->
* Retrieves the name of the SQL cursor used by this
* <code>ResultSet</code> object.
*
* <P>In SQL, a result table is retrieved through a cursor that is
* named. The current row of a result set can be updated or deleted
* using a positioned update/delete statement that references the
* cursor name. To insure that the cursor has the proper isolation
* level to support update, the cursor's <code>SELECT</code> statement
* should be of the form <code>SELECT FOR UPDATE</code>. If
* <code>FOR UPDATE</code> is omitted, the positioned updates may fail.
*
* <P>The JDBC API supports this SQL feature by providing the name of the
* SQL cursor used by a <code>ResultSet</code> object.
* The current row of a <code>ResultSet</code> object
* is also the current row of this SQL cursor.
*
* <P><B>Note:</B> If positioned update is not supported, a
* <code>SQLException</code> is thrown. <p>
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* Including 1.7.2, HSQLDB does not support this feature. <p>
*
* Calling this method always throws an <code>SQLException</code>,
* stating that the operation is not supported.
* </div>
* <!-- end release-specific documentation -->
*
* @return the SQL name for this <code>ResultSet</code> object's cursor
* @exception SQLException if a database access error occurs
*/
public String getCursorName() throws SQLException {
throw Util.notSupported;
}
/**
* <!-- start generic documentation -->
* Retrieves the number, types and properties of
* this <code>ResultSet</code> object's columns. <p>
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* <B>Example:</B> <p>
*
* The following code fragment creates a <code>ResultSet</code> object rs,
* creates a <code>ResultSetMetaData</code> object rsmd, and uses rsmd
* to find out how many columns rs has and whether the first column
* in rs can be used in a <code>WHERE</code> clause. <p>
*
* <pre class="JavaCodeExample">
* ResultSet rs = stmt.<b>executeQuery</b>(<span class="JavaStringLiteral">"SELECT a, b, c FROM TABLE2"</span>);
* ResultSetMetaData rsmd = rs.<b>getMetaData</b>();<br>
* int numberOfColumns = rsmd.<b>getColumnCount</b>();<br>
* boolean b = rsmd.<b>isSearchable</b>(1);<br>
* </pre>
*
* <hr>
*
* <B>Warning:</B> <p>
*
* Including 1.7.1, HSQLDB did not generate accurate
* <code>ResultSetMetaData</code>. Below were the the most important
* methods to consider: <p>
*
* <ol>
* <li>isAutoIncrement(int) <i>always</i> returned <code>false</code></li>
* <li>isCurrency(int) <i>always</i> returned <code>false</code></li>
* <li>isNullable(int) <i>always</i> returned
* <code>columnNullableUnknown</code></li>
* <li>getColumnDisplaySize(int) returned zero for all valid column
* numbers</li>
* <li>getSchemaName(int) <i>always</i> returned
* <span class="JavaStringLiteral">""</span></li>
* <li>getPrecision(int) <i>always</i> returned zero</li>
* <li>getScale(int) <i>always</i> returned zero</li>
* <li>getCatalogName(int) <i>always</i> returned
* <span class="JavaStringLiteral">""</span></li>
* </ol> <p>
*
* <hr>
*
* Starting with 1.7.2, ResultSetMetaData has been split out into its own
* interface implemenation (jdbcResultSetMetaData), support has been
* improved considerably for a number of methods and behaviour has
* been altered slightly in many areas.
* </div>
* <!-- end release-specific documentation -->
*
* @return the description of this <code>ResultSet</code> object's columns
* @exception SQLException if a database access error occurs
* @see jdbcResultSetMetaData
*/
public ResultSetMetaData getMetaData() throws SQLException {
if (rsmd == null) {
rsmd = new jdbcResultSetMetaData(this, connProperties);
}
return rsmd;
}
/**
* <!-- start gene
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -