HP NonStop SQL/MP Programming Manual page 255

For c
Table of Contents

Advertisement

Dynamic SQL Operations
Example 10-8. Detailed Dynamic SQL Program (page 14 of 22)
787
788
789
790
791
792
/* ---------------------------------------------------- */
793
/* DECIMAL is supported; if your database has DECIMAL
794
/* items, you might not want to translate to 32-bit
795
/* integers as this program does
796
case _SQLDT_DEC_U :
797
798
/* The following types are unsupported: */
799
case _SQLDT_DEC_LSS :
800
case _SQLDT_DEC_LSE :
801
case _SQLDT_DEC_TSS :
802
case _SQLDT_DEC_TSE :
803
804
/*-------------------------------------------- */
805
/* Map to _SQLDT_32BIT_S type
806
/* Length info must be set to 4 bytes for
807
/* scale information to be set to 0
808
/* Note: for DECIMAL, you might want to save
809
/* the scale information instead of setting
810
/* to zero as this program does
811
/*-------------------------------------------- */
812
sqlda->sqlvar[i].data_type = _SQLDT_32BIT_S;
813
sqlda->sqlvar[i].data_len = 4;
814
815
break;
816
817
/* ---------------------------------------------------- */
818
default: /* UNSUPPORTED types or do not need adjustments */
819
820
break;
821
822
/* ---------------------------------------------------- */
823
} /* switch stmt */
824
825
} /* for loop */
826
827
return (0);
828
829
} /* end adjust_sqlda_scale_types
831
832
/* *************************************************** */
833
/* FUNCTION setupvarbuffers
834
/* This function takes an SQLDA as a parameter and,
835
/* for sqlda.num_entries, allocates the data buffers
836
/* for appropriate lengths. For each sqlvar,
837
/* sqlda.sqlvar[i].var_ptr is set to point to that
838
/* buffer
839
/*
840
/* The sqlda is also changed by altering unsupported
841
/* data types to the nearest equivalent data types
842
/* and by setting scale information to 0
843
/*
844
/* sqlda.num_entries is assumed to have a valid value. */
845
/*
846
/* Return: 0 if successful
847
/* -1 if failure
848
/*
849
HP NonStop SQL/MP Programming Manual for C—429847-008
sqlda->sqlvar[i].data_len = sqlda->sqlvar[i].data_len & 0377;
break;
/* (Nothing to be done) */
/* DECIMAL unsigned
/* DECIMAL LSS
/* DECIMAL LSE
/* DECIMAL TSS
/* DECIMAL TSE
/* and scale is 0 */
10-57
Detailed Dynamic SQL Program
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/

Advertisement

Table of Contents
loading

Table of Contents