Download Informix CLI Programmer`s Manual, Version 2.8

Transcript
Allocating a Statement Handle
Allocating a Statement Handle
Before your application can submit an SQL statement, it must allocate a
statement handle for the statement. To allocate a statement handle, an application performs the following operations:
1.
Declares a variable of type HSTMT
For example, the application could use the following declaration:
HSTMT hstmt1;
2.
Calls SQLAllocStmt and passes it the address of the variable and the
connection handle (hdbc) with which to associate the statement
The driver allocates memory to store information about the
statement, associates the statement handle with the connection
handle (hdbc), and returns the statement handle in the variable.
Executing an SQL Statement
Your application can submit an SQL statement for execution in the following
ways:
■
Prepared statements call SQLPrepare and then call SQLExecute.
■
Direct statements call SQLExecDirect.
These options are similar, but not identical, to the prepared and immediate
options in embedded SQL. For a comparison of the ODBC functions and
embedded SQL, see Appendix C.
Executing SQL Statements 5-5