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 #260 background imageLoading...
Page #260 background image
Dynamic SQL Operations
HP NonStop SQL/MP Programming Manual for C—429847-008
10-62
Detailed Dynamic SQL Program
1095 if (in_numvars > 0)
1096 if ( (sda_i = allocate_sqlda( in_numvars )) == NULL )
1097 {
1098 printf ("\n**** Error: Memory allocation failure for input
sqlda.\n");
1099 printf ( " Process stopped.");
1100 fflush (stdout);
1101 goto exit;
1102 }
1103
1104 if (out_numvars > 0)
1105 if ( (sda_o = allocate_sqlda( out_numvars )) == NULL )
1106 {
1107 printf ("\n**** Error: Memory allocation failure for output
sqlda.\n");
1108 printf ( " Process stopped.");
1109 fflush (stdout);
1110 if (sda_i != NULL) free( (char *) sda_i);
1111 goto exit;
1112 }
1113
1114 if (in_nameslen > 0)
1115 if ( (cname_i = (arrayptr) malloc( in_nameslen )) == NULL )
1116 {
1117 printf("\n**** Error: Memory allocation failure for input names
buffer.");
1118 printf("\n Process stopped.");
1119 fflush (stdout);
1120 if (sda_i != NULL) free( (char *) sda_i);
1121 if (sda_o != NULL) free( (char *) sda_o);
1122 goto exit;
1123 }
1124
1125 if (out_nameslen > 0)
1126 if ( (cname_o = (arrayptr) malloc( out_nameslen )) == NULL )
1127 {
1128 printf ("\n");
1129 printf ("**** Error: Memory allocation failure for output names
buffer.");
1130 printf ("\n");
1131 printf (" Process stopped.");
1132 fflush (stdout);
1133 if (sda_i != NULL) free( (char *) sda_i);
1134 if (sda_o != NULL) free( (char *) sda_o);
1135 if (cname_i != NULL) free( (char *) cname_i );
1136 goto exit;
1137 }
1138
1139 /*****************************************************/
1140 /* Get information on input variables (if any) */
1141 /*****************************************************/
1142 if (in_numvars > 0) {
1143
1144 exec sql DESCRIBE INPUT S1 INTO :*sda_i
1145 NAMES INTO :*cname_i ;
1146
1147 if (sqlcode != 0)
1148 { /* display error/warnings */
1149 printf ("\n"); fflush( stdout );
1150 SQLCADISPLAY ( (int *) &sqlca );
1151 if (sqlcode < 0) /* errors present */
1152 {
1153 exec sql rollback work; /* abort transaction */
1154 goto enter_input; /* try again */
Example 10-8. Detailed Dynamic SQL Program (page 19 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