Executes a prepared SQL query by specifying its syntax and an optional parameter array.
Syntax
void executePreparedSQL(String query) void executePreparedSQL(String query, Vector queryParameters)
Parameters
Return values
None.
Exceptions
CwDBSQLException - If a database error occurs.
Notes
The executePreparedSQL() method sends the specified query string as a prepared SQL statement to the database associated with the current connection. The first time it executes, this query is sent as a string to the database, which compiles the string into an executable form (called a prepared statement), executes the SQL statement, and returns this prepared statement to executePreparedSQL(). The executePreparedSQL() method saves this prepared statement in memory. Use executePreparedSQL() for SQL statements that you need to execute multiple times. The executeSQL() method does not save the prepared statement and is therefore useful for queries you need to execute only once.
The SQL statements you can execute include the following (as long as you have the necessary database permissions):
Use the hasMoreRows() and nextRow() methods to access the retrieved data.
If the connection uses explicit transaction bracketing, you must explicitly start each transaction with beginTransaction() and end it with either commit() or rollback().
To execute stored procedures with OUT parameters, use the executeStoredProcedure() method. For more information, see "Calling stored procedures with executeStoredProcedure()".
See also
beginTransaction(), commit(), executeSQL(), executeStoredProcedure(), getDBConnection(), hasMoreRows(), nextRow(), rollBack()