HP NonStop SQL/MP Programming Manual page 260

For c
Table of Contents

Advertisement

Dynamic SQL Operations
Example 10-8. Detailed Dynamic SQL Program (page 19 of 22)
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 ( "
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 ( "
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
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 ("
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
1146
1147
if (sqlcode != 0)
1148
{ /* display error/warnings */
1149
printf ("\n"); fflush( stdout );
1150
SQLCADISPLAY ( (int *) &sqlca );
1151
if (sqlcode < 0)
1152
1153
1154
HP NonStop SQL/MP Programming Manual for C—429847-008
Process stopped.");
NAMES INTO :*cname_i ;
{
exec sql rollback work;
goto enter_input;
Process stopped.");
Process stopped.");
Process stopped.");
/* errors present
/* abort transaction */
/* try again
10-62
Detailed Dynamic SQL Program
*/
*/
*/

Advertisement

Table of Contents
loading

Table of Contents