EasyManuals Logo

HP NonStop SQL/MP User Manual

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
Page #216 background imageLoading...
Page #216 background image
Dynamic SQL Operations
HP NonStop SQL/MP Programming Manual for C—429847-008
10-18
Dynamic Allocation of Memory
Null Values and the Names Buffer
If your program processes indicator parameters, the names of the indicator parameters
are included in the names buffer after DESCRIBE INPUT runs. The ind_ptr field
points to the length field for the first indicator parameter name in the names buffer. This
behavior is parallel to that of var_ptr after DESCRIBE INPUT or DESCRIBE.
Figure 10-1 is a diagram of the names buffer immediately after the DESCRIBE INPUT
statement runs when indicator parameters are present for two parameters, where len
is a two-byte length, name is a parameter name, ind_len is the length of an indicator
parameter name, and ind_name is an indicator parameter name. Each instance of
ind_ptr points to the length field for the corresponding indicator parameter name.
Like input parameter and output variable names, indicator variable names are blank
padded to even lengths.
When you are reading through the names buffer to prompt the user for parameter
names, you might need to be aware of the indicator fields and perform tasks like the
following:
1. Check the null_info field.
2. If null_info is -1, read the length field for the indicator.
3. Add this length field to the pointer or index to skip to the next name in the names
buffer.
Dynamic Allocation of Memory
A C program can dynamically allocate memory for input parameters and output
variables at run time by following these steps:
1. Make sure that your program uses the large memory module (which is the default).
The XMEM pragma causes the C compiler to use the large-memory model.
2. Declare a template for the SQLDA structure and names buffer using the INCLUDE
SQLDA directive. Use a value of 1 for the SQLDA and names buffer sizes and
Figure 10-1. DESCRIBE INPUT’s Effect on Names Buffer
VAR-PTR of
SQLVAR(1)
IND-PTR of
SQLVAR(1)
VAR-PTR of
SQLVAR(2)
IND-PTR of
SQLVAR(2)
len1 name1 ind-len-1 ind-name-1 len2 name2 ind-len-2 ind-name-2
VST008.vsd

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the HP NonStop SQL/MP and is the answer not in the manual?

HP NonStop SQL/MP Specifications

General IconGeneral
BrandHP
ModelNonStop SQL/MP
CategorySoftware
LanguageEnglish

Related product manuals