| 1 |
/* Processed by ecpg (regression mode) */ |
| 2 |
/* These include files are added by the preprocessor */ |
| 3 |
#include <ecpglib.h> |
| 4 |
#include <ecpgerrno.h> |
| 5 |
#include <sqlca.h> |
| 6 |
/* End of automatic include section */ |
| 7 |
#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y)) |
| 8 |
|
| 9 |
#line 1 "sqlda.pgc" |
| 10 |
#include <stdlib.h> |
| 11 |
#include <string.h> |
| 12 |
#include <limits.h> |
| 13 |
#include "ecpg_config.h" |
| 14 |
|
| 15 |
|
| 16 |
#line 1 "regression.h" |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
#line 6 "sqlda.pgc" |
| 24 |
|
| 25 |
|
| 26 |
#line 1 "sqlda.h" |
| 27 |
#ifndef ECPG_SQLDA_H |
| 28 |
#define ECPG_SQLDA_H |
| 29 |
|
| 30 |
#ifdef _ECPG_INFORMIX_H |
| 31 |
|
| 32 |
#include "sqlda-compat.h" |
| 33 |
typedef struct sqlvar_compat sqlvar_t; |
| 34 |
typedef struct sqlda_compat sqlda_t; |
| 35 |
|
| 36 |
#else |
| 37 |
|
| 38 |
#include "sqlda-native.h" |
| 39 |
typedef struct sqlvar_struct sqlvar_t; |
| 40 |
typedef struct sqlda_struct sqlda_t; |
| 41 |
|
| 42 |
#endif |
| 43 |
|
| 44 |
#endif /* ECPG_SQLDA_H */ |
| 45 |
|
| 46 |
#line 7 "sqlda.pgc" |
| 47 |
|
| 48 |
|
| 49 |
#line 1 "pgtypes_numeric.h" |
| 50 |
#ifndef PGTYPES_NUMERIC |
| 51 |
#define PGTYPES_NUMERIC |
| 52 |
|
| 53 |
#include <pgtypes.h> |
| 54 |
|
| 55 |
#define NUMERIC_POS 0x0000 |
| 56 |
#define NUMERIC_NEG 0x4000 |
| 57 |
#define NUMERIC_NAN 0xC000 |
| 58 |
#define NUMERIC_NULL 0xF000 |
| 59 |
#define NUMERIC_MAX_PRECISION 1000 |
| 60 |
#define NUMERIC_MAX_DISPLAY_SCALE NUMERIC_MAX_PRECISION |
| 61 |
#define NUMERIC_MIN_DISPLAY_SCALE 0 |
| 62 |
#define NUMERIC_MIN_SIG_DIGITS 16 |
| 63 |
|
| 64 |
#define DECSIZE 30 |
| 65 |
|
| 66 |
typedef unsigned char NumericDigit; |
| 67 |
typedef struct |
| 68 |
{ |
| 69 |
int ndigits; /* number of digits in digits[] - can be 0! */ |
| 70 |
int weight; /* weight of first digit */ |
| 71 |
int rscale; /* result scale */ |
| 72 |
int dscale; /* display scale */ |
| 73 |
int sign; /* NUMERIC_POS, NUMERIC_NEG, or NUMERIC_NAN */ |
| 74 |
NumericDigit *buf; /* start of alloc'd space for digits[] */ |
| 75 |
NumericDigit *digits; /* decimal digits */ |
| 76 |
} numeric; |
| 77 |
|
| 78 |
typedef struct |
| 79 |
{ |
| 80 |
int ndigits; /* number of digits in digits[] - can be 0! */ |
| 81 |
int weight; /* weight of first digit */ |
| 82 |
int rscale; /* result scale */ |
| 83 |
int dscale; /* display scale */ |
| 84 |
int sign; /* NUMERIC_POS, NUMERIC_NEG, or NUMERIC_NAN */ |
| 85 |
NumericDigit digits[DECSIZE]; /* decimal digits */ |
| 86 |
} decimal; |
| 87 |
|
| 88 |
#ifdef __cplusplus |
| 89 |
extern "C" |
| 90 |
{ |
| 91 |
#endif |
| 92 |
|
| 93 |
numeric *PGTYPESnumeric_new(void); |
| 94 |
decimal *PGTYPESdecimal_new(void); |
| 95 |
void PGTYPESnumeric_free(numeric *var); |
| 96 |
void PGTYPESdecimal_free(decimal *var); |
| 97 |
numeric *PGTYPESnumeric_from_asc(char *str, char **endptr); |
| 98 |
char *PGTYPESnumeric_to_asc(numeric *num, int dscale); |
| 99 |
int PGTYPESnumeric_add(numeric *var1, numeric *var2, numeric *result); |
| 100 |
int PGTYPESnumeric_sub(numeric *var1, numeric *var2, numeric *result); |
| 101 |
int PGTYPESnumeric_mul(numeric *var1, numeric *var2, numeric *result); |
| 102 |
int PGTYPESnumeric_div(numeric *var1, numeric *var2, numeric *result); |
| 103 |
int PGTYPESnumeric_cmp(numeric *var1, numeric *var2); |
| 104 |
int PGTYPESnumeric_from_int(signed int int_val, numeric *var); |
| 105 |
int PGTYPESnumeric_from_long(signed long int long_val, numeric *var); |
| 106 |
int PGTYPESnumeric_copy(numeric *src, numeric *dst); |
| 107 |
int PGTYPESnumeric_from_double(double d, numeric *dst); |
| 108 |
int PGTYPESnumeric_to_double(numeric *nv, double *dp); |
| 109 |
int PGTYPESnumeric_to_int(numeric *nv, int *ip); |
| 110 |
int PGTYPESnumeric_to_long(numeric *nv, long *lp); |
| 111 |
int PGTYPESnumeric_to_decimal(numeric *src, decimal *dst); |
| 112 |
int PGTYPESnumeric_from_decimal(decimal *src, numeric *dst); |
| 113 |
|
| 114 |
#ifdef __cplusplus |
| 115 |
} |
| 116 |
#endif |
| 117 |
|
| 118 |
#endif /* PGTYPES_NUMERIC */ |
| 119 |
|
| 120 |
#line 8 "sqlda.pgc" |
| 121 |
|
| 122 |
|
| 123 |
/* exec sql whenever sqlerror stop ; */ |
| 124 |
#line 10 "sqlda.pgc" |
| 125 |
|
| 126 |
|
| 127 |
/* These shouldn't be under DECLARE SECTION */ |
| 128 |
sqlda_t *inp_sqlda, *outp_sqlda, *outp_sqlda1; |
| 129 |
|
| 130 |
static void |
| 131 |
dump_sqlda(sqlda_t *sqlda) |
| 132 |
{ |
| 133 |
int i; |
| 134 |
|
| 135 |
if (sqlda == NULL) |
| 136 |
{ |
| 137 |
printf("dump_sqlda called with NULL sqlda\n"); |
| 138 |
return; |
| 139 |
} |
| 140 |
|
| 141 |
for (i = 0; i < sqlda->sqld; i++) |
| 142 |
{ |
| 143 |
if (sqlda->sqlvar[i].sqlind && *(sqlda->sqlvar[i].sqlind) == -1) |
| 144 |
printf("name sqlda descriptor: '%s' value NULL'\n", sqlda->sqlvar[i].sqlname.data); |
| 145 |
else |
| 146 |
switch (sqlda->sqlvar[i].sqltype) |
| 147 |
{ |
| 148 |
case ECPGt_char: |
| 149 |
printf("name sqlda descriptor: '%s' value '%s'\n", sqlda->sqlvar[i].sqlname.data, sqlda->sqlvar[i].sqldata); |
| 150 |
break; |
| 151 |
case ECPGt_int: |
| 152 |
printf("name sqlda descriptor: '%s' value %d\n", sqlda->sqlvar[i].sqlname.data, *(int *)sqlda->sqlvar[i].sqldata); |
| 153 |
break; |
| 154 |
case ECPGt_long: |
| 155 |
printf("name sqlda descriptor: '%s' value %ld\n", sqlda->sqlvar[i].sqlname.data, *(long int *)sqlda->sqlvar[i].sqldata); |
| 156 |
break; |
| 157 |
case ECPGt_long_long: |
| 158 |
printf("name sqlda descriptor: '%s' value %lld\n", |
| 159 |
sqlda->sqlvar[i].sqlname.data, *(long long int *)sqlda->sqlvar[i].sqldata); |
| 160 |
break; |
| 161 |
case ECPGt_double: |
| 162 |
printf("name sqlda descriptor: '%s' value %f\n", sqlda->sqlvar[i].sqlname.data, *(double *)sqlda->sqlvar[i].sqldata); |
| 163 |
break; |
| 164 |
case ECPGt_numeric: |
| 165 |
{ |
| 166 |
char *val; |
| 167 |
|
| 168 |
val = PGTYPESnumeric_to_asc((numeric*)sqlda->sqlvar[i].sqldata, -1); |
| 169 |
printf("name sqlda descriptor: '%s' value NUMERIC '%s'\n", sqlda->sqlvar[i].sqlname.data, val); |
| 170 |
PGTYPESchar_free(val); |
| 171 |
break; |
| 172 |
} |
| 173 |
} |
| 174 |
} |
| 175 |
} |
| 176 |
|
| 177 |
int |
| 178 |
main (void) |
| 179 |
{ |
| 180 |
/* exec sql begin declare section */ |
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
#line 66 "sqlda.pgc" |
| 187 |
char * stmt1 = "SELECT * FROM t1" ; |
| 188 |
|
| 189 |
#line 67 "sqlda.pgc" |
| 190 |
char * stmt2 = "SELECT * FROM t1 WHERE id = ?" ; |
| 191 |
|
| 192 |
#line 68 "sqlda.pgc" |
| 193 |
int rec ; |
| 194 |
|
| 195 |
#line 69 "sqlda.pgc" |
| 196 |
int id ; |
| 197 |
/* exec sql end declare section */ |
| 198 |
#line 70 "sqlda.pgc" |
| 199 |
|
| 200 |
|
| 201 |
char msg[128]; |
| 202 |
|
| 203 |
ECPGdebug(1, stderr); |
| 204 |
|
| 205 |
strcpy(msg, "connect"); |
| 206 |
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , "regress1", 0); |
| 207 |
#line 77 "sqlda.pgc" |
| 208 |
|
| 209 |
if (sqlca.sqlcode < 0) exit (1);} |
| 210 |
#line 77 "sqlda.pgc" |
| 211 |
|
| 212 |
|
| 213 |
strcpy(msg, "set"); |
| 214 |
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT); |
| 215 |
#line 80 "sqlda.pgc" |
| 216 |
|
| 217 |
if (sqlca.sqlcode < 0) exit (1);} |
| 218 |
#line 80 "sqlda.pgc" |
| 219 |
|
| 220 |
|
| 221 |
strcpy(msg, "create"); |
| 222 |
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table t1 ( id integer , t text , d1 numeric , d2 float8 , c char ( 10 ) , big bigint )", ECPGt_EOIT, ECPGt_EORT); |
| 223 |
#line 90 "sqlda.pgc" |
| 224 |
|
| 225 |
if (sqlca.sqlcode < 0) exit (1);} |
| 226 |
#line 90 "sqlda.pgc" |
| 227 |
|
| 228 |
|
| 229 |
strcpy(msg, "insert"); |
| 230 |
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into t1 values ( 1 , 'a' , 1.0 , 1 , 'a' , 1111111111111111111 ) , ( 2 , null , null , null , null , null ) , ( 3 , 'c' , 0.0 , 3 , 'c' , 3333333333333333333 ) , ( 4 , 'd' , 'NaN' , 4 , 'd' , 4444444444444444444 ) , ( 5 , 'e' , 0.001234 , 5 , 'e' , 5555555555555555555 )", ECPGt_EOIT, ECPGt_EORT); |
| 231 |
#line 98 "sqlda.pgc" |
| 232 |
|
| 233 |
if (sqlca.sqlcode < 0) exit (1);} |
| 234 |
#line 98 "sqlda.pgc" |
| 235 |
|
| 236 |
|
| 237 |
strcpy(msg, "commit"); |
| 238 |
{ ECPGtrans(__LINE__, NULL, "commit"); |
| 239 |
#line 101 "sqlda.pgc" |
| 240 |
|
| 241 |
if (sqlca.sqlcode < 0) exit (1);} |
| 242 |
#line 101 "sqlda.pgc" |
| 243 |
|
| 244 |
|
| 245 |
/* SQLDA test for getting all records from a table */ |
| 246 |
|
| 247 |
outp_sqlda = NULL; |
| 248 |
|
| 249 |
strcpy(msg, "prepare"); |
| 250 |
{ ECPGprepare(__LINE__, NULL, 0, "st_id1", stmt1); |
| 251 |
#line 108 "sqlda.pgc" |
| 252 |
|
| 253 |
if (sqlca.sqlcode < 0) exit (1);} |
| 254 |
#line 108 "sqlda.pgc" |
| 255 |
|
| 256 |
|
| 257 |
strcpy(msg, "declare"); |
| 258 |
/* declare mycur1 cursor for $1 */ |
| 259 |
#line 111 "sqlda.pgc" |
| 260 |
|
| 261 |
|
| 262 |
strcpy(msg, "open"); |
| 263 |
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare mycur1 cursor for $1", |
| 264 |
ECPGt_char_variable,(ECPGprepared_statement(NULL, "st_id1", __LINE__)),(long)1,(long)1,(1)*sizeof(char), |
| 265 |
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); |
| 266 |
#line 114 "sqlda.pgc" |
| 267 |
|
| 268 |
if (sqlca.sqlcode < 0) exit (1);} |
| 269 |
#line 114 "sqlda.pgc" |
| 270 |
|
| 271 |
|
| 272 |
/* exec sql whenever not found break ; */ |
| 273 |
#line 116 "sqlda.pgc" |
| 274 |
|
| 275 |
|
| 276 |
rec = 0; |
| 277 |
while (1) |
| 278 |
{ |
| 279 |
strcpy(msg, "fetch"); |
| 280 |
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch 1 from mycur1", ECPGt_EOIT, |
| 281 |
ECPGt_sqlda, &outp_sqlda, 0L, 0L, 0L, |
| 282 |
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT); |
| 283 |
#line 122 "sqlda.pgc" |
| 284 |
|
| 285 |
if (sqlca.sqlcode == ECPG_NOT_FOUND) break; |
| 286 |
#line 122 "sqlda.pgc" |
| 287 |
|
| 288 |
if (sqlca.sqlcode < 0) exit (1);} |
| 289 |
#line 122 "sqlda.pgc" |
| 290 |
|
| 291 |
|
| 292 |
printf("FETCH RECORD %d\n", ++rec); |
| 293 |
dump_sqlda(outp_sqlda); |
| 294 |
} |
| 295 |
|
| 296 |
/* exec sql whenever not found continue ; */ |
| 297 |
#line 128 "sqlda.pgc" |
| 298 |
|
| 299 |
|
| 300 |
strcpy(msg, "close"); |
| 301 |
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close mycur1", ECPGt_EOIT, ECPGt_EORT); |
| 302 |
#line 131 "sqlda.pgc" |
| 303 |
|
| 304 |
if (sqlca.sqlcode < 0) exit (1);} |
| 305 |
#line 131 "sqlda.pgc" |
| 306 |
|
| 307 |
|
| 308 |
strcpy(msg, "deallocate"); |
| 309 |
{ ECPGdeallocate(__LINE__, 0, NULL, "st_id1"); |
| 310 |
#line 134 "sqlda.pgc" |
| 311 |
|
| 312 |
if (sqlca.sqlcode < 0) exit (1);} |
| 313 |
#line 134 "sqlda.pgc" |
| 314 |
|
| 315 |
|
| 316 |
free(outp_sqlda); |
| 317 |
|
| 318 |
/* SQLDA test for getting ALL records into the sqlda list */ |
| 319 |
|
| 320 |
outp_sqlda = NULL; |
| 321 |
|
| 322 |
strcpy(msg, "prepare"); |
| 323 |
{ ECPGprepare(__LINE__, NULL, 0, "st_id2", stmt1); |
| 324 |
#line 143 "sqlda.pgc" |
| 325 |
|
| 326 |
if (sqlca.sqlcode < 0) exit (1);} |
| 327 |
#line 143 "sqlda.pgc" |
| 328 |
|
| 329 |
|
| 330 |
strcpy(msg, "declare"); |
| 331 |
/* declare mycur2 cursor for $1 */ |
| 332 |
#line 146 "sqlda.pgc" |
| 333 |
|
| 334 |
|
| 335 |
strcpy(msg, "open"); |
| 336 |
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare mycur2 cursor for $1", |
| 337 |
ECPGt_char_variable,(ECPGprepared_statement(NULL, "st_id2", __LINE__)),(long)1,(long)1,(1)*sizeof(char), |
| 338 |
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); |
| 339 |
#line 149 "sqlda.pgc" |
| 340 |
|
| 341 |
if (sqlca.sqlcode < 0) exit (1);} |
| 342 |
#line 149 "sqlda.pgc" |
| 343 |
|
| 344 |
|
| 345 |
strcpy(msg, "fetch"); |
| 346 |
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch all from mycur2", ECPGt_EOIT, |
| 347 |
ECPGt_sqlda, &outp_sqlda, 0L, 0L, 0L, |
| 348 |
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT); |
| 349 |
#line 152 "sqlda.pgc" |
| 350 |
|
| 351 |
if (sqlca.sqlcode < 0) exit (1);} |
| 352 |
#line 152 "sqlda.pgc" |
| 353 |
|
| 354 |
|
| 355 |
outp_sqlda1 = outp_sqlda; |
| 356 |
rec = 0; |
| 357 |
while (outp_sqlda1) |
| 358 |
{ |
| 359 |
sqlda_t *ptr; |
| 360 |
printf("FETCH RECORD %d\n", ++rec); |
| 361 |
dump_sqlda(outp_sqlda1); |
| 362 |
|
| 363 |
ptr = outp_sqlda1; |
| 364 |
outp_sqlda1 = outp_sqlda1->desc_next; |
| 365 |
free(ptr); |
| 366 |
} |
| 367 |
|
| 368 |
strcpy(msg, "close"); |
| 369 |
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close mycur2", ECPGt_EOIT, ECPGt_EORT); |
| 370 |
#line 168 "sqlda.pgc" |
| 371 |
|
| 372 |
if (sqlca.sqlcode < 0) exit (1);} |
| 373 |
#line 168 "sqlda.pgc" |
| 374 |
|
| 375 |
|
| 376 |
strcpy(msg, "deallocate"); |
| 377 |
{ ECPGdeallocate(__LINE__, 0, NULL, "st_id2"); |
| 378 |
#line 171 "sqlda.pgc" |
| 379 |
|
| 380 |
if (sqlca.sqlcode < 0) exit (1);} |
| 381 |
#line 171 "sqlda.pgc" |
| 382 |
|
| 383 |
|
| 384 |
/* SQLDA test for getting one record using an input descriptor */ |
| 385 |
|
| 386 |
/* |
| 387 |
* Input sqlda has to be built manually |
| 388 |
* sqlda_t contains 1 sqlvar_t structure already. |
| 389 |
*/ |
| 390 |
inp_sqlda = (sqlda_t *)malloc(sizeof(sqlda_t)); |
| 391 |
memset(inp_sqlda, 0, sizeof(sqlda_t)); |
| 392 |
inp_sqlda->sqln = 1; |
| 393 |
|
| 394 |
inp_sqlda->sqlvar[0].sqltype = ECPGt_int; |
| 395 |
inp_sqlda->sqlvar[0].sqldata = (char *)&id; |
| 396 |
|
| 397 |
printf("EXECUTE RECORD 4\n"); |
| 398 |
|
| 399 |
id = 4; |
| 400 |
|
| 401 |
outp_sqlda = NULL; |
| 402 |
|
| 403 |
strcpy(msg, "prepare"); |
| 404 |
{ ECPGprepare(__LINE__, NULL, 0, "st_id3", stmt2); |
| 405 |
#line 193 "sqlda.pgc" |
| 406 |
|
| 407 |
if (sqlca.sqlcode < 0) exit (1);} |
| 408 |
#line 193 "sqlda.pgc" |
| 409 |
|
| 410 |
|
| 411 |
strcpy(msg, "execute"); |
| 412 |
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "st_id3", |
| 413 |
ECPGt_sqlda, &inp_sqlda, 0L, 0L, 0L, |
| 414 |
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, |
| 415 |
ECPGt_sqlda, &outp_sqlda, 0L, 0L, 0L, |
| 416 |
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT); |
| 417 |
#line 196 "sqlda.pgc" |
| 418 |
|
| 419 |
if (sqlca.sqlcode < 0) exit (1);} |
| 420 |
#line 196 "sqlda.pgc" |
| 421 |
|
| 422 |
|
| 423 |
dump_sqlda(outp_sqlda); |
| 424 |
|
| 425 |
strcpy(msg, "deallocate"); |
| 426 |
{ ECPGdeallocate(__LINE__, 0, NULL, "st_id3"); |
| 427 |
#line 201 "sqlda.pgc" |
| 428 |
|
| 429 |
if (sqlca.sqlcode < 0) exit (1);} |
| 430 |
#line 201 "sqlda.pgc" |
| 431 |
|
| 432 |
|
| 433 |
free(inp_sqlda); |
| 434 |
free(outp_sqlda); |
| 435 |
|
| 436 |
/* SQLDA test for getting one record using an input descriptor |
| 437 |
* on a named connection |
| 438 |
*/ |
| 439 |
|
| 440 |
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , "con2", 0); |
| 441 |
#line 210 "sqlda.pgc" |
| 442 |
|
| 443 |
if (sqlca.sqlcode < 0) exit (1);} |
| 444 |
#line 210 "sqlda.pgc" |
| 445 |
|
| 446 |
|
| 447 |
/* |
| 448 |
* Input sqlda has to be built manually |
| 449 |
* sqlda_t contains 1 sqlvar_t structure already. |
| 450 |
*/ |
| 451 |
inp_sqlda = (sqlda_t *)malloc(sizeof(sqlda_t)); |
| 452 |
memset(inp_sqlda, 0, sizeof(sqlda_t)); |
| 453 |
inp_sqlda->sqln = 1; |
| 454 |
|
| 455 |
inp_sqlda->sqlvar[0].sqltype = ECPGt_int; |
| 456 |
inp_sqlda->sqlvar[0].sqldata = (char *)&id; |
| 457 |
|
| 458 |
printf("EXECUTE RECORD 4\n"); |
| 459 |
|
| 460 |
id = 4; |
| 461 |
|
| 462 |
outp_sqlda = NULL; |
| 463 |
|
| 464 |
strcpy(msg, "prepare"); |
| 465 |
{ ECPGprepare(__LINE__, "con2", 0, "st_id4", stmt2); |
| 466 |
#line 230 "sqlda.pgc" |
| 467 |
|
| 468 |
if (sqlca.sqlcode < 0) exit (1);} |
| 469 |
#line 230 "sqlda.pgc" |
| 470 |
|
| 471 |
|
| 472 |
strcpy(msg, "execute"); |
| 473 |
{ ECPGdo(__LINE__, 0, 1, "con2", 0, ECPGst_execute, "st_id4", |
| 474 |
ECPGt_sqlda, &inp_sqlda, 0L, 0L, 0L, |
| 475 |
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, |
| 476 |
ECPGt_sqlda, &outp_sqlda, 0L, 0L, 0L, |
| 477 |
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT); |
| 478 |
#line 233 "sqlda.pgc" |
| 479 |
|
| 480 |
if (sqlca.sqlcode < 0) exit (1);} |
| 481 |
#line 233 "sqlda.pgc" |
| 482 |
|
| 483 |
|
| 484 |
dump_sqlda(outp_sqlda); |
| 485 |
|
| 486 |
strcpy(msg, "commit"); |
| 487 |
{ ECPGtrans(__LINE__, "con2", "commit"); |
| 488 |
#line 238 "sqlda.pgc" |
| 489 |
|
| 490 |
if (sqlca.sqlcode < 0) exit (1);} |
| 491 |
#line 238 "sqlda.pgc" |
| 492 |
|
| 493 |
|
| 494 |
strcpy(msg, "deallocate"); |
| 495 |
{ ECPGdeallocate(__LINE__, 0, NULL, "st_id4"); |
| 496 |
#line 241 "sqlda.pgc" |
| 497 |
|
| 498 |
if (sqlca.sqlcode < 0) exit (1);} |
| 499 |
#line 241 "sqlda.pgc" |
| 500 |
|
| 501 |
|
| 502 |
free(inp_sqlda); |
| 503 |
free(outp_sqlda); |
| 504 |
|
| 505 |
strcpy(msg, "disconnect"); |
| 506 |
{ ECPGdisconnect(__LINE__, "con2"); |
| 507 |
#line 247 "sqlda.pgc" |
| 508 |
|
| 509 |
if (sqlca.sqlcode < 0) exit (1);} |
| 510 |
#line 247 "sqlda.pgc" |
| 511 |
|
| 512 |
|
| 513 |
/* End test */ |
| 514 |
|
| 515 |
strcpy(msg, "drop"); |
| 516 |
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table t1", ECPGt_EOIT, ECPGt_EORT); |
| 517 |
#line 252 "sqlda.pgc" |
| 518 |
|
| 519 |
if (sqlca.sqlcode < 0) exit (1);} |
| 520 |
#line 252 "sqlda.pgc" |
| 521 |
|
| 522 |
|
| 523 |
strcpy(msg, "commit"); |
| 524 |
{ ECPGtrans(__LINE__, NULL, "commit"); |
| 525 |
#line 255 "sqlda.pgc" |
| 526 |
|
| 527 |
if (sqlca.sqlcode < 0) exit (1);} |
| 528 |
#line 255 "sqlda.pgc" |
| 529 |
|
| 530 |
|
| 531 |
strcpy(msg, "disconnect"); |
| 532 |
{ ECPGdisconnect(__LINE__, "CURRENT"); |
| 533 |
#line 258 "sqlda.pgc" |
| 534 |
|
| 535 |
if (sqlca.sqlcode < 0) exit (1);} |
| 536 |
#line 258 "sqlda.pgc" |
| 537 |
|
| 538 |
|
| 539 |
return 0; |
| 540 |
} |