Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (中文) » UltraLiteJ » UltraLiteJ 参考 » UltraLiteJ API 参考

 

PreparedStatement 接口

提供若干方法,用于执行 SQL 查询以生成 ResultSet,或用于对 UltraLite 数据库执行准备的 SQL 语句。

语法
public PreparedStatement
基类
注释

以下示例演示了如何执行 PreparedStatement、检查执行过程是否创建了 ResultSet、将 ResultSet 保存到局部变量,以及如何关闭 PreparedStatement:

// Create a new PreparedStatement object from an existing connection.
String sql_string = "SELECT * FROM SampleTable";
PreparedStatement ps = conn.prepareStatement(sql_string);

// result returns true if the execute statement runs successfully.
boolean result = ps.execute();

// Check if the PreparedStatement contains a ResultSet.
if (ps.hasResultSet()) {
    // Store the ResultSet in the rs variable.
    ResultSet rs = ps.getResultSet();
}

// Close the PreparedStatement to release resources.
ps.close();
成员

PreparedStatement 的所有成员,包括所有继承的成员。


close 方法
execute 方法
executeQuery 方法
getPlan 方法
getResultSet 方法
getUpdateCount 方法
hasResultSet 方法