Home | Previous Page | Next Page   Programming with SQL > SQL in Programs >

SQL in SQL APIs

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

Figure 354 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 354. Overview of Processing a Program with Embedded SQL Statements
begin figure description - This figure is described in the surrounding text. - end figure description

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 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 ESQL/C application is that each thread can have many active connections to a database server simultaneously. While a nonthreaded ESQL/C application can establish many connections to one or more databases, it can have only one connection active at a time. A multithreaded ESQL/C application can have one active connection per thread and many threads per application.

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

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]