提供多种方法,用于按行遍历表并访问列数据。
public interface ResultSet
ResultSet 接口的所有成员,包括所有继承的成员。
名称 | 说明 |
---|---|
关闭 ResultSet,以释放与其相关的内存资源。 | |
返回长二进制类型的 InputStream,包括基于文件的长二进制。 | |
返回布尔值。 | |
返回一个字节数组。 | |
返回读取器。 | |
返回 java.util.Date。 | |
返回 DecimalNumber。 | |
返回基于列编号的双精度值。 | |
返回浮点值。 | |
返回整数值。 | |
返回长整数值。 | |
返回由字符串表示的值的序数(基数为 1)。 | |
返回包含 ResultSet 的元数据的 ResultSetMetadata。 | |
获取结果集列的实际大小。 | |
返回字符串值。 | |
返回 UUIDValue 值。 | |
测试位于指定列编号处的值是否为空值。 | |
读取 ResultSet 中的下一行数据。 | |
读取 ResultSet 中的前一行数据。 |
可以通过使用 execute 或 executeQuery 方法执行带有 SQL SELECT 语句的 PreparedStatement 生成 ResultSet。
以下示例演示了如何执行新 PreparedStatement、通过 ResultSet 读取行,以及如何访问指定列中的数据。
// Define a new SQL SELECT statement. String sql_string = "SELECT column1, column2 FROM SampleTable"; // Create a new PreparedStatement from an existing connection. PreparedStatement ps = conn.prepareStatement(sql_string); // Create a new ResultSet to contain the query results of the SQL statement. ResultSet rs = ps.executeQuery(); // Check if the PreparedStatement contains a ResultSet. if (ps.hasResultSet()) { // Retrieve the column1 value from the first row using getString. String row1_col1 = rs.getString(1); // Get the next row in the table. if (rs.next) { // Retrieve the value of column1 from the second row. String row2_col1 = rs.getString(1); } } rs.close(); ps.close(); |
close 方法
getBlobInputStream 方法
getBoolean 方法
getBytes 方法
getClobReader 方法
getDate 方法
getDecimalNumber 方法
getDouble 方法
getFloat 方法
getInt 方法
getLong 方法
getOrdinal 方法
getResultSetMetadata 方法
getSize 方法
getString 方法
getUUIDValue 方法
isNull 方法
next 方法
previous 方法
![]() |
使用DocCommentXchange 讨论此页。
|
版权 © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0 |