SQL/MP Programming Manual for C

Converting C Programs
HP NonStop SQL/MP Programming Manual for C429847-008
D-6
Generating a Version 1 SQLDA Structure
Generating a Version 1 SQLDA Structure
If you are converting a program to use the INCLUDE STRUCTURES directive, but you
require a version 1 SQLDA structure, follow these steps:
1. If necessary, remove the RELEASE1 option from the SQL compiler directive or the
INCLUDE SQLDA directive. The C compiler returns an error if you specify the
RELEASE1 option and the INCLUDE STRUCTURES directive.
2. If you specified the RELEASE1 option in an INCLUDE SQLDA directive, remove
any _R1 suffixes you appended to SQLDA field names.
3. Add an INCLUDE STRUCTURES directive with the ALL VERSION 1 option:
EXEC SQL INCLUDE STRUCTURES ALL VERSION 1;
Or specify only the SQLDA VERSION 1 option:
EXEC SQL INCLUDE STRUCTURES SQLDA VERSION 1;
Example D-2 shows a version 1 SQLDA structure.
Table D-3
describes the fields in a version 1 SQLDA structure.
Example D-2. Version 1 SQLDA Structure
#define SQLDA_EYE_CATCHER "DA" /* can have _R1 appended */
struct SQLDA_TYPE /* can have _R1 appended */
{
char eye_catcher[2];
short num_entries;
struct SQLVAR_TYPE /* can have _R1 appended */
{
short data_type;
short data_len;
short null_info;
long var_ptr;
long reserved;
} sqlvar[sqlvar_count];
} sqlda-name;
char names-buffer-name[ length + 1 ];
Table D-3. Version 1 SQLDA Structure Fields (page 1 of 2)
Field Name Description
eye_catcher
Identifying field that a program must initialize as D1 for version 1 or DA
for version 2. SQL/MP statements do not return values to eye_catcher.
num_entries
Number of input parameters or output variables the SQLDA structure can
accommodate.
sqlvar
Group item that describes input parameters or database columns. The
DESCRIBE INPUT and DESCRIBE statements return one sqlvar entry
for each input parameter or each output variable.