Null Values - HP NonStop SQL/MP Programming Manual

For c
Table of Contents

Advertisement

Dynamic SQL Operations
Example 10-2. Getting Parameter Values (page 2 of 2)
for (i=0; i < num_entries; i++)
{
/* Set pointer to the length prefix in names buffer:
len_ptr = (int *)input_namesbuf_ptr;
name_len = *len_ptr;
/* Move pointer past the length prefix and onto a name: */
input_namesbuf_ptr += 2; /* Store null-terminated parameter
name in name_array:
if (name_len == 0 )
name_array[0] = '\0';
else
{
lastchar = input_namesbuf_ptr + (name_len - 1);
if (*lastchar == ' ') /* last character is blank
{
strncpy (name_array, input_namesbuf_ptr, name_len - 1);
name_array[name_len] = '\0';
}
else
{
strncpy (name_array, input_namesbuf_ptr, name_len);
name_array[name_len] = '\0';
}
} /* end else; read and store named parameter
/* Use a switch statement to check the data type, prompt*/
/* the user for input, (using the parameter name in
/* name_array), call a function to read the value
/* input by the user (see sample program for code) .
output_namesbuf_ptr = lastchar + 1;
} /* end of for loop */
}

Null Values

The input and output SQLDA structures have the null_info and ind_ptr fields,
which are used for handling null values. Your program accesses these fields in the
SQLVAR array in the same way in which you access var_ptr.
null_info indicates whether the input parameter or output variable can contain a
ind_ptr
HP NonStop SQL/MP Programming Manual for C—429847-008
*/
null value.
points to a flag that indicates whether the input parameter or output
variable is null. If the parameter or output variable is not null, the
var_ptr field specifies the value.
/* Parameter had no name
/* SQL inserts blanks to make */
/* the length fall on an even */
/* byte boundary if the name
/* had an odd number of
/* characters.
10-16
Null Values
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/

Advertisement

Table of Contents
loading

Table of Contents