EasyManua.ls Logo

HP NonStop SQL/MP - Page 255

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-57
Detailed Dynamic SQL Program
787 sqlda->sqlvar[i].data_len = sqlda->sqlvar[i].data_len & 0377;
788
789
790 break;
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 : /* DECIMAL unsigned */
797
798 /* The following types are unsupported: */
799 case _SQLDT_DEC_LSS : /* DECIMAL LSS */
800 case _SQLDT_DEC_LSE : /* DECIMAL LSE */
801 case _SQLDT_DEC_TSS : /* DECIMAL TSS */
802 case _SQLDT_DEC_TSE : /* DECIMAL 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; /* and scale is 0 */
814
815 break;
816
817 /* ---------------------------------------------------- */
818 default: /* UNSUPPORTED types or do not need adjustments */
819
820 break; /* (Nothing to be done) */
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
Example 10-8. Detailed Dynamic SQL Program (page 14 of 22)

Table of Contents

Related product manuals