EasyManua.ls Logo

HP NonStop SQL/MP - Page 261

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-63
Detailed Dynamic SQL Program
1155 }
1156 }
1157
1158 /***************************************************************/
1159 /* Input parameter values from terminal */
1160 /* Initialize SQLDA var-ptr to point to input data buffer */
1161 /***************************************************************/
1162 if ( setupvarbuffers( sda_i ) != 0 )
1163 { printf( "**** Error: Problem in allocating input param buffers.\n");
1164 fflush (stdout);
1165 exec sql rollback work;
1166 goto enter_input;
1167 }
1168
1169 if ( request_invars( sda_i, (char *) cname_i ) < 0)
1170 {
1171 exec sql rollback work;
1172 goto enter_input; /* try again */
1173 }
1174
1175 } /* if in_numvars > 0 */
1176
1177 /*****************************************************/
1178 /* Get information on output variables */
1179 /*****************************************************/
1180 if (out_numvars > 0) {
1181
1182 exec sql DESCRIBE S1 INTO :*sda_o
1183 NAMES INTO :*cname_o ;
1184
1185 if (sqlcode != 0)
1186 { /* display error/warnings */
1187 printf ("\n"); fflush( stdout );
1188 SQLCADISPLAY ( (int *) &sqlca );
1189 if (sqlcode < 0) /* errors present */
1190 {
1191 exec sql rollback work; /* abort transaction */
1192 goto enter_input; /* try again */
1193 }
1194 }
1195
1196 /***************************************************************/
1197 /* Allocate output data buffers and update output sqlda */
1198 /* Initialize SQLDA var-ptr to point to output data buffer */
1199 /***************************************************************/
1200 if ( setupvarbuffers( sda_o ) != 0 )
1201 { printf( "**** Error: Problem in allocating output buffers\n");
1202 fflush (stdout);
1203 exec sql rollback work;
1204 goto enter_input;
1205 }
1206
1207 } /* if out_numvars > 0 */
1208
1209 if (out_numvars > 0)
1210 { /*************************************************/
1211 /* SELECT statement */
1212 /*************************************************/
1213
Example 10-8. Detailed Dynamic SQL Program (page 20 of 22)

Table of Contents

Related product manuals