Provides methods to execute a SQL query to generate a ResultSet, or to execute a prepared SQL statement on an UltraLite database.
public interface PreparedStatement
All members of PreparedStatement interface, including all inherited members.
Name | Description |
---|---|
Closes the PreparedStatement to release the memory resources associated with it. | |
Executes the prepared SQL statement. | |
Executes the prepared SQL SELECT statement and returns a ResultSet. | |
Returns an OutputStream. | |
Returns a Writer. | |
Returns the (base-one) ordinal for the value represented by the name. | |
Returns a text-based description of the SQL query execution plan. | |
Returns a text-based description of the SQL query execution plan, represented as a tree. | |
Returns the ResultSet for a prepared SQL statement. | |
Returns the number of rows inserted, updated or deleted since the last execute statement. | |
Determines if the PreparedStatement contains a ResultSet. | |
Sets a value to the host variable in the SQL statement. | |
Sets a null value to the host variable in the SQL statement that is defined by ordinal. |
The following example demonstrates how to execute a PreparedStatement, check if the execution created a ResultSet, save the ResultSet to a local variable, and close the 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(); When a statement contains expressions, it may contain a host variable wherever a column name could appear. Host variables are entered as either a '?' characters (unnamed host variables) or as ":name" (named host variable). In the example, SELECT * FROM SampleTable WHERE pk > :bound AND pk < ? there are two host variables which may be set using the PreparedStatement that was prepared for the SQL statement in question. |
close method
execute method
executeQuery method
getBlobOutputStream method
getClobWriter method
getOrdinal method
getPlan method
getPlanTree method
getResultSet method
getUpdateCount method
hasResultSet method
set method
setNull method
Discuss this page in DocCommentXchange.
|
Copyright © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0 |