Databases Reference
In-Depth Information
errorFound: {
printf("\n Error: Problem occurred. Sqlcode: %d Sqlstate:
%s\n",sqlca.sqlcode, sqlca.sqlstate);
return;
}
PIDNotFound: {
printf("\n Error: Product ID was not found. \n");
return;
}
}
4.3.17 The SQL Descriptor Area (SQLDA)
The SQL Descriptor Area (SQLDA) is a structure that can provide information
about dynamic SQL statements that are prepared and executed. With
DESCRIBE, PREPARE, OPEN, FETCH, CALL, and EXECUTE statements, an
application can retrieve information about the prepared statement, or input and
output parameters of the SQL statement. In PREPARE and DESCRIBE, an
SQLDA provides information to an application program about a prepared
statement. In OPEN, EXECUTE, FETCH, and CALL, an SQLDA describes host
variables.
The SQLDA is made up of header and SQLVAR describing its structure. Within
it, there can be multiple SQLVAR elements defined. An individual SQLVAR
structure can hold information regarding:
A column of a table in a DESCRIBE or PREPARE statement
A variable in a FETCH, EXECUTE, CALL, or OPEN statement
The fields, which describe the SQLDA, contain information on the size of the
structure, whether the SQLDA has doubled in size (which will happen if LOB
objects are used), the number of SQLVAR elements allocated, and the number
of columns/variables in the SQL statement.
Depending on whether the SQLDA is being used to store input or output
information of an SQL statement, SQLVAR elements can contain information
about data types, lengths, column names, code pages, and much more.
To define the SQLDA, we can add the following statement to our program:
EXEC SQL INCLUDE SQLDA;
Search WWH ::




Custom Search