Host Language Variables and Dynamic ESQL

Dynamic ESQL uses SQL Descriptor Areas to exchange data between your application and ESQL. If you use SQL Descriptor Areas, you do not have to declare host variables in your application even if you use the preprocessor. The preprocessor converts any host language variables that you declare and use in dynamic ESQL into SQL descriptor references. For more information on using SQL descriptor areas and host language variables in dynamic ESQL, see the "Using Dynamic Embedded SQL" section.

The SQL Declare section has the following syntax:

SYNTAX
EXEC SQL BEGIN DECLARE SECTION;

    host-variable-declaration;
    host-variable-declaration;
             .
             .
             .
    host-variable-declaration;

EXEC SQL END DECLARE SECTION; 

Each host-variable-declaration in the section is a standard C Language variable declaration, as in the following example:

EXEC SQL BEGIN DECLARE SECTION;
    char name[30];
    long  custnum, maxcred, hicustnum;
    char city[20], state[3];
EXEC SQL END DECLARE SECTION; 

Like any C variable declaration, you can place the SQL Declare section anywhere before the ESQL statements that refer to it and in the same function or module scope as these statements. For an example, see Step 1 of Figure 2–1 and Figure 2–2.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095