INFORMIX
DataBlade API Programmer's Manual
Chapter 6: Sending SQL Statements
Home Contents Index Master Index New Book

SQL Statements Within the Same Function

In a client application, the effects of one part of an mi_exec() function are not visible to other parts. Therefore, if one SQL statement depends on an earlier one, they should not both be in the same call to mi_exec(). For example, the following statement causes an error:

The error occurs because the INSERT statement cannot see the result of the CREATE TABLE statement. The solution is to call mi_exec() twice, as follows:


 Example: send_statement

The following user-defined function, send_statement(), takes an existing open connection and an SQL statement string as arguments and executes the statement in the database server with the mi_exec() function. It calls another user-defined function, get_results(), to examine the results. For more information on how to process results, see "Processing Results".




DataBlade API Programmer's Manual, version 9.1
Copyright © 1998, Informix Software, Inc. All rights reserved.