SQL in SQL APIs

ESQL products are Informix® SQL APIs (application programming interfaces). Informix® produces an SQL API for the C programming language.

The following figure shows how an SQL API product works. You write a source program in which you treat SQL statements as executable code. Your source program is processed by an embedded SQL preprocessor, a program that locates the embedded SQL statements and converts them into a series of procedure calls and special data structures.
Figure 1. Overview of processing a program with embedded SQL statements
This figure is described in the surrounding text.

The converted source program then passes through the programming language compiler. The compiler output becomes an executable program after it is linked with a static or dynamic library of SQL API procedures. When the program runs, the SQL API library procedures are called; they set up communication with the database server to carry out the SQL operations.

If you link your executable program to a threading library package, you can develop Informix® ESQL/C multithreaded applications. A multithreaded application can have many threads of control. It separates a process into multiple execution threads, each of which runs independently. The major advantage of a multithreaded Informix® ESQL/C application is that each thread can have many active connections to a database server simultaneously. While a nonthreaded Informix® ESQL/C application can establish many connections to one or more databases, it can have only one connection active at a time. A multithreaded Informix® ESQL/C application can have one active connection per thread and many threads per application.

For more information on multithreaded applications, see the Informix® ESQL/C Programmer's Manual.