Dynamic-management structure
If you do not know the number or data types of values sent to or received from the database server, use a dynamic-management structure. A dynamic-management structure allows you to pass a variable-length list of data to the database server, or receive a variable-length list of data from it.
To execute dynamic SQL statements with unknown columns, you can
use either of the following dynamic-management structures in your IBM®
Informix® ESQL/C program:
- A system-descriptor area is a language-independent data structure that is the X/Open standard. You allocate and manipulate it with the SQL statements ALLOCATE DESCRIPTOR, GET DESCRIPTOR, SET DESCRIPTOR, and DEALLOCATE DESCRIPTOR.
- The sqlda structure is a C-language data structure that
you manipulate with the same types of C-language statements that you
would use to allocate and manipulate other C structures (areas that
have the struct data type).
Because this method uses a C-language structure within SQL statements, it is language-dependent and does not conform to X/Open standards.
For a given dynamic SQL statement, the dynamic-management structure
can hold any of the following information:
- The number of unknown columns in the statement
- For each unknown value, the data type and length, space for the data, and information about any associated indicator variable (its data type, length, and data)
The IBM Informix ESQL/C program can then use this information to determine a host variable of appropriate length and type to hold the value.