Example 10-1. Sqlda Structure And Buffers - HP NonStop SQL/MP Programming Manual

For c
Table of Contents

Advertisement

Dynamic SQL Operations
Example 10-1
buffer. For version 1 and 2 SQLDA structures, see
Programs.

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
long
long
long reserved;
} sqlvar[sqlvar-count];
} sqlda-name;
char names_buffer [name-string-size];
char collation_buffer [collation-buffer-length];
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 =
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.
HP NonStop SQL/MP Programming Manual for C—429847-008
shows a version 315 SQLDA structure, names buffer, and collation
var_ptr;
ind_ptr;
cprl_ptr;
( max-collation-size + 4 ) * sqlvar-count
SQLDA Structure, Names Buffer, and Collation
Appendix D, Converting C
10-7
Buffer

Advertisement

Table of Contents
loading

Table of Contents