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 #249 background imageLoading...
Page #249 background image
Dynamic SQL Operations
HP NonStop SQL/MP Programming Manual for C—429847-008
10-51
Detailed Dynamic SQL Program
425 len_ptr = (short *) sqlda->sqlvar[i].var_ptr;
426 *len_ptr = data_read; /* #chars for the varchar buffer */
427
428 break;
429
430 /* ------------------------------------------------- */
431 case _SQLDT_16BIT_S : /* 16 bit signed numeric */
432 case _SQLDT_16BIT_U : /* 16 bit unsigned numeric */
433 case _SQLDT_32BIT_S : /* 32 bit signed numeric */
434 case _SQLDT_32BIT_U : /* 16 bit unsigned numeric */
435
436 if (name_len > 0)
437 printf("Please enter numeric value for ?%s: ", name_array);
438 else
439 printf("Please enter a numeric value: ");
440
441 if ( get_string( data_array, data_array_size,
442 1, PARAM_TERMINATOR ) < 0 )
443 { /* input info too long; or some problem */
444 printf("\n**** Error: Input number is too big.\n");
445 fflush(stdout);
446 return (-1);
447 }
448
449 /* Convert input number to appropriate numeric form. */
450
451 switch (sqlda->sqlvar[i].data_type) {
452 /* ----------------------------------------------- */
453 case _SQLDT_16BIT_S : /* 16 bit signed numeric */
454 in_out_ptrs.smallint_ptr =
455 (short *) sqlda->sqlvar[i].var_ptr;
456 *in_out_ptrs.smallint_ptr = atoi( data_array );
457 break;
458
459 /* ----------------------------------------------- */
460 case _SQLDT_16BIT_U : /* 16 bit unsigned numeric */
461 in_out_ptrs.usmallint_ptr =
462 (unsigned short *) sqlda->sqlvar[i].var_ptr;
463 *in_out_ptrs.usmallint_ptr =
464 (unsigned short) atol( data_array );
465 break;
466
467 /* ----------------------------------------------- */
468 case _SQLDT_32BIT_S : /* 32 bit signed numeric */
469 in_out_ptrs.integer_ptr =
470 (long *) sqlda->sqlvar[i].var_ptr;
471 *in_out_ptrs.integer_ptr = atol( data_array );
472 break;
473
474 /* ----------------------------------------------- */
475 case _SQLDT_32BIT_U : /* 32 bit unsigned numeric */
476 in_out_ptrs.uinteger_ptr =
477 (unsigned long *) sqlda->sqlvar[i].var_ptr;
478 dummy = NULL;
479 *in_out_ptrs.uinteger_ptr = strtoul (data_array, &dummy, 10);
480
481 break;
482
483 /* ------------------------------------------- */
484 } /* end: inner switch */
485
486 break;
Example 10-8. Detailed Dynamic SQL Program (page 8 of 22)

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