Elements of Prepared Execution

Prepared execution of an SQL request includes two basic phases:

  1. A preparation phase, in which the statement is compiled using the PREPARE statement (or the sqldynprep() ESQL-LIB function).
  2. An execution phase, in which the statement is executed using either the dynamic OPEN or EXECUTE statement (both supported by the sqldynexec() ESQL-LIB function).
NOTE: Immediate execution combines these two phases to execute an SQL request into one step. Without any further steps to manage execution, the request is prepared, executed, and discarded. To execute the same request again, repeat both phases. This is efficient for statements (such as DDL statements) that perform one task without having to exchange data with the application. This is also why prepared execution provides no benefit for such statements, where the extra data and execution management is not required or used.

Depending on the type of SQL request you are executing, there can be additional tasks to set up input and output data structures, and to manage execution of the request. ESQL provides a number of Progress/ESQL statements and ESQL-LIB functions to carry out these tasks. For a description of the Progress/ESQL statements provided for prepared execution, see the "Dynamic ESQL Statements for Prepared Execution" section in this chapter. For more information on ESQL-LIB functions, see ESQL-LIB Reference."


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095