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-16
Null Values
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.
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'; /* Parameter had no name */
else
{
lastchar = input_namesbuf_ptr + (name_len - 1);
if (*lastchar == ' ') /* last character is blank */
/* SQL inserts blanks to make */
/* the length fall on an even */
/* byte boundary if the name */
/* had an odd number of */
/* characters. */
{
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_info indicates whether the input parameter or output variable can contain a
null value.
ind_ptr 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.
Example 10-2. Getting Parameter Values (page2of2)

Table of Contents

Related product manuals