INFORMIX
Informix-ESQL/C Programmer's Manual
Chapter 14: Using Dynamic SQL
Home Contents Index Master Index New Book

Using OPTOFC and Deferred-PREPARE Together

To achieve the most optimized number of messages between the client application and the database server, use the Optimize OPEN, FETCH, CLOSE feature and the Deferred-PREPARE feature together. However, keep the following requirements in mind when you use these two optimization features together:

    ESQL/C does not send the PREPARE, DECLARE, and OPEN statements to the database server until it executes the FETCH statement. Therefore, any errors that any of these statements generate are not available until the database server executes the FETCH statement.

    Typical use of the DESCRIBE statement is to execute it after the PREPARE to determine information about the prepared statement. However, with both the OPTOFC and Deferred-PREPARE features enabled, ESQL/C does not send the DESCRIBE statement to the database until it reaches the FETCH statement. To allow you to obtain information about the prepared statement, ESQL/C executes a statement similar to the SET DESCRIPTOR statement to obtain data type, length, and other system-descriptor fields for the prepared statement. You can then use the GET DESCRIPTOR statement after the FETCH to obtain this information.

Tip: To obtain the maximum optimization, use the OPTOFC, deferred-PREPARE and AUTOFREE features together. For more information on the AUTOFREE feature, see "Automatically Freeing a Cursor".



Informix-ESQL/C Programmer's Manual, version 9.1
Copyright © 1998, Informix Software, Inc. All rights reserved.