EasyManua.ls Logo

HP NonStop SQL/MP

HP NonStop SQL/MP
331 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Dynamic SQL Operations
HP NonStop SQL/MP Programming Manual for C429847-008
10-7
SQLDA Structure, Names Buffer, and Collation
Buffer
Example 10-1 shows a version 315 SQLDA structure, names buffer, and collation
buffer. For version 1 and 2 SQLDA structures, see Appendix D, Converting C
Programs.
Calculating the Lengths of the Names and Collation Buffers
NonStop SQL/MP returns a name to the names buffer as a VARCHAR item. The
C compiler determines length in bytes of the names buffer using this formula:
length = (name-string-size + 11) * sqlvar-count
The 11 bytes added to name-string-size is derived from the length (2 bytes), table
name (8 bytes), and period separator (1 byte).
Use the SQLDA_NAMESBUF_OVHD_LEN identifier for this value.
NonStop SQL/MP returns a collation name to the collation buffer as a VARCHAR item.
The C compiler determines the length in bytes of the collation buffer as follows:
collation-buffer-length =
( max-collation-size + 4 ) * sqlvar-count
The 4 bytes added to max-collation-size is the length (len) field in the
VARCHAR item. Use the SQLDA_COLLBUF_OVHD_LEN identifier for this value.
Example 10-1. SQLDA Structure and Buffers
struct SQLDA_TYPE
{
char eye_catcher[2];
short num_entries;
struct SQLVAR_TYPE
{
short data_type;
short data_len;
short precision;
short null_info;
long var_ptr;
long ind_ptr;
long cprl_ptr;
long reserved;
} sqlvar[sqlvar-count];
} sqlda-name;
char names_buffer [name-string-size];
char collation_buffer [collation-buffer-length];

Table of Contents

Related product manuals