00001
00002
00003 #include <ecpglib.h>
00004 #include <ecpgerrno.h>
00005 #include <sqlca.h>
00006
00007 #define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
00008
00009 #line 1 "cursor.pgc"
00010 #include <stdlib.h>
00011 #include <string.h>
00012
00013
00014 #line 1 "regression.h"
00015
00016
00017
00018
00019
00020
00021 #line 4 "cursor.pgc"
00022
00023
00024
00025 #line 6 "cursor.pgc"
00026
00027
00028
00029 #line 8 "cursor.pgc"
00030
00031 typedef char* c;
00032
00033
00034
00035
00036
00037
00038
00039
00040 #line 11 "cursor.pgc"
00041
00042 typedef union { int integer; short smallint; } ind;
00043
00044 #define BUFFERSIZ 8
00045
00046 #line 15 "cursor.pgc"
00047
00048
00049 #define CURNAME "mycur"
00050
00051 int
00052 main (void)
00053 {
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065 #line 23 "cursor.pgc"
00066 char * stmt1 = "SELECT id, t FROM t1" ;
00067
00068 #line 24 "cursor.pgc"
00069 char * curname1 = CURNAME ;
00070
00071 #line 25 "cursor.pgc"
00072 char * curname2 = CURNAME ;
00073
00074 #line 26 "cursor.pgc"
00075 char * curname3 = CURNAME ;
00076
00077 #line 27 "cursor.pgc"
00078 struct varchar_1 { int len; char arr[ 50 ]; } curname4 ;
00079
00080 #line 28 "cursor.pgc"
00081 char * curname5 = CURNAME ;
00082
00083 #line 29 "cursor.pgc"
00084 int count ;
00085
00086 #line 30 "cursor.pgc"
00087 int id ;
00088
00089 #line 31 "cursor.pgc"
00090 char t [ 64 ] ;
00091
00092 #line 32 "cursor.pgc"
00093
00094
00095 char msg[128];
00096
00097 ECPGdebug(1, stderr);
00098
00099 strcpy(msg, "connect");
00100 { ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , "test1", 0);
00101 #line 39 "cursor.pgc"
00102
00103 if (sqlca.sqlcode < 0) exit (1);}
00104 #line 39 "cursor.pgc"
00105
00106 { ECPGconnect(__LINE__, 0, "connectdb" , NULL, NULL , "test2", 0);
00107 #line 40 "cursor.pgc"
00108
00109 if (sqlca.sqlcode < 0) exit (1);}
00110 #line 40 "cursor.pgc"
00111
00112
00113 strcpy(msg, "set");
00114 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);
00115 #line 43 "cursor.pgc"
00116
00117 if (sqlca.sqlcode < 0) exit (1);}
00118 #line 43 "cursor.pgc"
00119
00120
00121 strcpy(msg, "create");
00122 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "create table t1 ( id serial primary key , t text )", ECPGt_EOIT, ECPGt_EORT);
00123 #line 46 "cursor.pgc"
00124
00125 if (sqlca.sqlcode < 0) exit (1);}
00126 #line 46 "cursor.pgc"
00127
00128 { ECPGdo(__LINE__, 0, 1, "test2", 0, ECPGst_normal, "create table t1 ( id serial primary key , t text )", ECPGt_EOIT, ECPGt_EORT);
00129 #line 47 "cursor.pgc"
00130
00131 if (sqlca.sqlcode < 0) exit (1);}
00132 #line 47 "cursor.pgc"
00133
00134
00135 strcpy(msg, "insert");
00136 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "insert into t1 ( id , t ) values ( default , 'a' )", ECPGt_EOIT, ECPGt_EORT);
00137 #line 50 "cursor.pgc"
00138
00139 if (sqlca.sqlcode < 0) exit (1);}
00140 #line 50 "cursor.pgc"
00141
00142 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "insert into t1 ( id , t ) values ( default , 'b' )", ECPGt_EOIT, ECPGt_EORT);
00143 #line 51 "cursor.pgc"
00144
00145 if (sqlca.sqlcode < 0) exit (1);}
00146 #line 51 "cursor.pgc"
00147
00148 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "insert into t1 ( id , t ) values ( default , 'c' )", ECPGt_EOIT, ECPGt_EORT);
00149 #line 52 "cursor.pgc"
00150
00151 if (sqlca.sqlcode < 0) exit (1);}
00152 #line 52 "cursor.pgc"
00153
00154 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "insert into t1 ( id , t ) values ( default , 'd' )", ECPGt_EOIT, ECPGt_EORT);
00155 #line 53 "cursor.pgc"
00156
00157 if (sqlca.sqlcode < 0) exit (1);}
00158 #line 53 "cursor.pgc"
00159
00160 { ECPGdo(__LINE__, 0, 1, "test2", 0, ECPGst_normal, "insert into t1 ( id , t ) values ( default , 'e' )", ECPGt_EOIT, ECPGt_EORT);
00161 #line 54 "cursor.pgc"
00162
00163 if (sqlca.sqlcode < 0) exit (1);}
00164 #line 54 "cursor.pgc"
00165
00166
00167 strcpy(msg, "commit");
00168 { ECPGtrans(__LINE__, "test1", "commit");
00169 #line 57 "cursor.pgc"
00170
00171 if (sqlca.sqlcode < 0) exit (1);}
00172 #line 57 "cursor.pgc"
00173
00174 { ECPGtrans(__LINE__, "test2", "commit");
00175 #line 58 "cursor.pgc"
00176
00177 if (sqlca.sqlcode < 0) exit (1);}
00178 #line 58 "cursor.pgc"
00179
00180
00181
00182
00183 strcpy(msg, "declare");
00184 ECPGset_var( 0, &( curname1 ), __LINE__);\
00185
00186 #line 64 "cursor.pgc"
00187
00188
00189 strcpy(msg, "open");
00190 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "declare $0 cursor for select id , t from t1",
00191 ECPGt_char,&(curname1),(long)0,(long)1,(1)*sizeof(char),
00192 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
00193 #line 67 "cursor.pgc"
00194
00195 if (sqlca.sqlcode < 0) exit (1);}
00196 #line 67 "cursor.pgc"
00197
00198
00199 strcpy(msg, "fetch from");
00200 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch forward from $0",
00201 ECPGt_char,&(curname1),(long)0,(long)1,(1)*sizeof(char),
00202 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
00203 ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
00204 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00205 ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
00206 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
00207 #line 70 "cursor.pgc"
00208
00209 if (sqlca.sqlcode < 0) exit (1);}
00210 #line 70 "cursor.pgc"
00211
00212 printf("%d %s\n", id, t);
00213
00214 strcpy(msg, "fetch");
00215 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch forward $0",
00216 ECPGt_char,&(curname1),(long)0,(long)1,(1)*sizeof(char),
00217 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
00218 ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
00219 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00220 ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
00221 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
00222 #line 74 "cursor.pgc"
00223
00224 if (sqlca.sqlcode < 0) exit (1);}
00225 #line 74 "cursor.pgc"
00226
00227 printf("%d %s\n", id, t);
00228
00229 strcpy(msg, "fetch 1 from");
00230 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch 1 from $0",
00231 ECPGt_char,&(curname1),(long)0,(long)1,(1)*sizeof(char),
00232 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
00233 ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
00234 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00235 ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
00236 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
00237 #line 78 "cursor.pgc"
00238
00239 if (sqlca.sqlcode < 0) exit (1);}
00240 #line 78 "cursor.pgc"
00241
00242 printf("%d %s\n", id, t);
00243
00244 strcpy(msg, "fetch :count from");
00245 count = 1;
00246 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch $0 from $0",
00247 ECPGt_int,&(count),(long)1,(long)1,sizeof(int),
00248 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00249 ECPGt_char,&(curname1),(long)0,(long)1,(1)*sizeof(char),
00250 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
00251 ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
00252 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00253 ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
00254 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
00255 #line 83 "cursor.pgc"
00256
00257 if (sqlca.sqlcode < 0) exit (1);}
00258 #line 83 "cursor.pgc"
00259
00260 printf("%d %s\n", id, t);
00261
00262 strcpy(msg, "move in");
00263 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "move absolute 0 in $0",
00264 ECPGt_char,&(curname1),(long)0,(long)1,(1)*sizeof(char),
00265 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
00266 #line 87 "cursor.pgc"
00267
00268 if (sqlca.sqlcode < 0) exit (1);}
00269 #line 87 "cursor.pgc"
00270
00271
00272 strcpy(msg, "fetch 1");
00273 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch 1 $0",
00274 ECPGt_char,&(curname1),(long)0,(long)1,(1)*sizeof(char),
00275 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
00276 ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
00277 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00278 ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
00279 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
00280 #line 90 "cursor.pgc"
00281
00282 if (sqlca.sqlcode < 0) exit (1);}
00283 #line 90 "cursor.pgc"
00284
00285 printf("%d %s\n", id, t);
00286
00287 strcpy(msg, "fetch :count");
00288 count = 1;
00289 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch $0 $0",
00290 ECPGt_int,&(count),(long)1,(long)1,sizeof(int),
00291 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00292 ECPGt_char,&(curname1),(long)0,(long)1,(1)*sizeof(char),
00293 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
00294 ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
00295 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00296 ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
00297 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
00298 #line 95 "cursor.pgc"
00299
00300 if (sqlca.sqlcode < 0) exit (1);}
00301 #line 95 "cursor.pgc"
00302
00303 printf("%d %s\n", id, t);
00304
00305 strcpy(msg, "close");
00306 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "close $0",
00307 ECPGt_char,&(curname1),(long)0,(long)1,(1)*sizeof(char),
00308 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
00309 #line 99 "cursor.pgc"
00310
00311 if (sqlca.sqlcode < 0) exit (1);}
00312 #line 99 "cursor.pgc"
00313
00314
00315
00316
00317 strcpy(msg, "declare");
00318 ECPGset_var( 1, &( curname2 ), __LINE__);\
00319 ECPGset_var( 2, ( t ), __LINE__);\
00320 ECPGset_var( 3, &( id ), __LINE__);\
00321
00322 #line 105 "cursor.pgc"
00323
00324
00325 strcpy(msg, "open");
00326 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "declare $0 cursor for select id , t from t1",
00327 ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
00328 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
00329 ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
00330 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00331 ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
00332 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
00333 #line 108 "cursor.pgc"
00334
00335 if (sqlca.sqlcode < 0) exit (1);}
00336 #line 108 "cursor.pgc"
00337
00338
00339 strcpy(msg, "fetch from");
00340 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch from $0",
00341 ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
00342 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
00343 ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
00344 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00345 ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
00346 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
00347 #line 111 "cursor.pgc"
00348
00349 if (sqlca.sqlcode < 0) exit (1);}
00350 #line 111 "cursor.pgc"
00351
00352 printf("%d %s\n", id, t);
00353
00354 strcpy(msg, "fetch");
00355 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch $0",
00356 ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
00357 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
00358 ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
00359 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00360 ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
00361 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
00362 #line 115 "cursor.pgc"
00363
00364 if (sqlca.sqlcode < 0) exit (1);}
00365 #line 115 "cursor.pgc"
00366
00367 printf("%d %s\n", id, t);
00368
00369 strcpy(msg, "fetch 1 from");
00370 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch 1 from $0",
00371 ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
00372 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
00373 ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
00374 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00375 ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
00376 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
00377 #line 119 "cursor.pgc"
00378
00379 if (sqlca.sqlcode < 0) exit (1);}
00380 #line 119 "cursor.pgc"
00381
00382 printf("%d %s\n", id, t);
00383
00384 strcpy(msg, "fetch :count from");
00385 count = 1;
00386 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch $0 from $0",
00387 ECPGt_int,&(count),(long)1,(long)1,sizeof(int),
00388 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00389 ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
00390 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
00391 ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
00392 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00393 ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
00394 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
00395 #line 124 "cursor.pgc"
00396
00397 if (sqlca.sqlcode < 0) exit (1);}
00398 #line 124 "cursor.pgc"
00399
00400 printf("%d %s\n", id, t);
00401
00402 strcpy(msg, "move");
00403 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "move absolute 0 $0",
00404 ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
00405 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
00406 ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
00407 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00408 ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
00409 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
00410 #line 128 "cursor.pgc"
00411
00412 if (sqlca.sqlcode < 0) exit (1);}
00413 #line 128 "cursor.pgc"
00414
00415
00416 strcpy(msg, "fetch 1");
00417 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch 1 $0",
00418 ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
00419 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
00420 ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
00421 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00422 ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
00423 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
00424 #line 131 "cursor.pgc"
00425
00426 if (sqlca.sqlcode < 0) exit (1);}
00427 #line 131 "cursor.pgc"
00428
00429 printf("%d %s\n", id, t);
00430
00431 strcpy(msg, "fetch :count");
00432 count = 1;
00433 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch $0 $0",
00434 ECPGt_int,&(count),(long)1,(long)1,sizeof(int),
00435 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00436 ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
00437 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
00438 ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
00439 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00440 ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
00441 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
00442 #line 136 "cursor.pgc"
00443
00444 if (sqlca.sqlcode < 0) exit (1);}
00445 #line 136 "cursor.pgc"
00446
00447 printf("%d %s\n", id, t);
00448
00449 strcpy(msg, "close");
00450 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "close $0",
00451 ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
00452 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
00453 #line 140 "cursor.pgc"
00454
00455 if (sqlca.sqlcode < 0) exit (1);}
00456 #line 140 "cursor.pgc"
00457
00458
00459
00460
00461 strcpy(msg, "prepare");
00462 { ECPGprepare(__LINE__, "test1", 0, "st_id1", stmt1);
00463 #line 145 "cursor.pgc"
00464
00465 if (sqlca.sqlcode < 0) exit (1);}
00466 #line 145 "cursor.pgc"
00467
00468 { ECPGprepare(__LINE__, "test2", 0, "st_id1", stmt1);
00469 #line 146 "cursor.pgc"
00470
00471 if (sqlca.sqlcode < 0) exit (1);}
00472 #line 146 "cursor.pgc"
00473
00474
00475 strcpy(msg, "declare");
00476 ECPGset_var( 4, &( curname3 ), __LINE__);\
00477
00478 #line 149 "cursor.pgc"
00479
00480 ECPGset_var( 5, &( curname5 ), __LINE__);\
00481
00482 #line 150 "cursor.pgc"
00483
00484
00485 strcpy(msg, "open");
00486 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "declare $0 cursor for $1",
00487 ECPGt_char,&(curname3),(long)0,(long)1,(1)*sizeof(char),
00488 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00489 ECPGt_char_variable,(ECPGprepared_statement("test1", "st_id1", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
00490 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
00491 #line 153 "cursor.pgc"
00492
00493 if (sqlca.sqlcode < 0) exit (1);}
00494 #line 153 "cursor.pgc"
00495
00496 { ECPGdo(__LINE__, 0, 1, "test2", 0, ECPGst_normal, "declare $0 cursor for $1",
00497 ECPGt_char,&(curname5),(long)0,(long)1,(1)*sizeof(char),
00498 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00499 ECPGt_char_variable,(ECPGprepared_statement("test2", "st_id1", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
00500 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
00501 #line 154 "cursor.pgc"
00502
00503 if (sqlca.sqlcode < 0) exit (1);}
00504 #line 154 "cursor.pgc"
00505
00506
00507 strcpy(msg, "fetch");
00508 { ECPGdo(__LINE__, 0, 1, "test2", 0, ECPGst_normal, "fetch $0",
00509 ECPGt_char,&(curname5),(long)0,(long)1,(1)*sizeof(char),
00510 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
00511 ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
00512 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00513 ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
00514 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
00515 #line 157 "cursor.pgc"
00516
00517 if (sqlca.sqlcode < 0) exit (1);}
00518 #line 157 "cursor.pgc"
00519
00520 printf("%d %s\n", id, t);
00521
00522 strcpy(msg, "fetch from");
00523 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch from $0",
00524 ECPGt_char,&(curname3),(long)0,(long)1,(1)*sizeof(char),
00525 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
00526 ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
00527 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00528 ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
00529 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
00530 #line 161 "cursor.pgc"
00531
00532 if (sqlca.sqlcode < 0) exit (1);}
00533 #line 161 "cursor.pgc"
00534
00535 printf("%d %s\n", id, t);
00536
00537 strcpy(msg, "fetch 1 from");
00538 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch 1 from $0",
00539 ECPGt_char,&(curname3),(long)0,(long)1,(1)*sizeof(char),
00540 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
00541 ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
00542 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00543 ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
00544 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
00545 #line 165 "cursor.pgc"
00546
00547 if (sqlca.sqlcode < 0) exit (1);}
00548 #line 165 "cursor.pgc"
00549
00550 printf("%d %s\n", id, t);
00551
00552 strcpy(msg, "fetch :count from");
00553 count = 1;
00554 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch $0 from $0",
00555 ECPGt_int,&(count),(long)1,(long)1,sizeof(int),
00556 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00557 ECPGt_char,&(curname3),(long)0,(long)1,(1)*sizeof(char),
00558 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
00559 ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
00560 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00561 ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
00562 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
00563 #line 170 "cursor.pgc"
00564
00565 if (sqlca.sqlcode < 0) exit (1);}
00566 #line 170 "cursor.pgc"
00567
00568 printf("%d %s\n", id, t);
00569
00570 strcpy(msg, "move");
00571 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "move absolute 0 $0",
00572 ECPGt_char,&(curname3),(long)0,(long)1,(1)*sizeof(char),
00573 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
00574 #line 174 "cursor.pgc"
00575
00576 if (sqlca.sqlcode < 0) exit (1);}
00577 #line 174 "cursor.pgc"
00578
00579
00580 strcpy(msg, "fetch 1");
00581 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch 1 $0",
00582 ECPGt_char,&(curname3),(long)0,(long)1,(1)*sizeof(char),
00583 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
00584 ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
00585 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00586 ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
00587 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
00588 #line 177 "cursor.pgc"
00589
00590 if (sqlca.sqlcode < 0) exit (1);}
00591 #line 177 "cursor.pgc"
00592
00593 printf("%d %s\n", id, t);
00594
00595 strcpy(msg, "fetch :count");
00596 count = 1;
00597 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch $0 $0",
00598 ECPGt_int,&(count),(long)1,(long)1,sizeof(int),
00599 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00600 ECPGt_char,&(curname3),(long)0,(long)1,(1)*sizeof(char),
00601 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
00602 ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
00603 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00604 ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
00605 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
00606 #line 182 "cursor.pgc"
00607
00608 if (sqlca.sqlcode < 0) exit (1);}
00609 #line 182 "cursor.pgc"
00610
00611 printf("%d %s\n", id, t);
00612
00613 strcpy(msg, "close");
00614 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "close $0",
00615 ECPGt_char,&(curname3),(long)0,(long)1,(1)*sizeof(char),
00616 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
00617 #line 186 "cursor.pgc"
00618
00619 if (sqlca.sqlcode < 0) exit (1);}
00620 #line 186 "cursor.pgc"
00621
00622 { ECPGdo(__LINE__, 0, 1, "test2", 0, ECPGst_normal, "close $0",
00623 ECPGt_char,&(curname5),(long)0,(long)1,(1)*sizeof(char),
00624 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
00625 #line 187 "cursor.pgc"
00626
00627 if (sqlca.sqlcode < 0) exit (1);}
00628 #line 187 "cursor.pgc"
00629
00630
00631 strcpy(msg, "deallocate prepare");
00632 { ECPGdeallocate(__LINE__, 0, "test1", "st_id1");
00633 #line 190 "cursor.pgc"
00634
00635 if (sqlca.sqlcode < 0) exit (1);}
00636 #line 190 "cursor.pgc"
00637
00638 { ECPGdeallocate(__LINE__, 0, "test2", "st_id1");
00639 #line 191 "cursor.pgc"
00640
00641 if (sqlca.sqlcode < 0) exit (1);}
00642 #line 191 "cursor.pgc"
00643
00644
00645
00646
00647
00648 curname4.len = strlen(CURNAME);
00649 strcpy(curname4.arr, CURNAME);
00650
00651 strcpy(msg, "prepare");
00652 { ECPGprepare(__LINE__, "test1", 0, "st_id2", stmt1);
00653 #line 200 "cursor.pgc"
00654
00655 if (sqlca.sqlcode < 0) exit (1);}
00656 #line 200 "cursor.pgc"
00657
00658
00659 strcpy(msg, "declare");
00660 ECPGset_var( 6, &( curname4 ), __LINE__);\
00661
00662 #line 203 "cursor.pgc"
00663
00664
00665 strcpy(msg, "open");
00666 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "declare $0 cursor for $1",
00667 ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_1),
00668 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00669 ECPGt_char_variable,(ECPGprepared_statement("test1", "st_id2", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
00670 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
00671 #line 206 "cursor.pgc"
00672
00673 if (sqlca.sqlcode < 0) exit (1);}
00674 #line 206 "cursor.pgc"
00675
00676
00677 strcpy(msg, "fetch from");
00678 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch from $0",
00679 ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_1),
00680 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
00681 ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
00682 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00683 ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
00684 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
00685 #line 209 "cursor.pgc"
00686
00687 if (sqlca.sqlcode < 0) exit (1);}
00688 #line 209 "cursor.pgc"
00689
00690 printf("%d %s\n", id, t);
00691
00692 strcpy(msg, "fetch");
00693 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch $0",
00694 ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_1),
00695 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
00696 ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
00697 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00698 ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
00699 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
00700 #line 213 "cursor.pgc"
00701
00702 if (sqlca.sqlcode < 0) exit (1);}
00703 #line 213 "cursor.pgc"
00704
00705 printf("%d %s\n", id, t);
00706
00707 strcpy(msg, "fetch 1 from");
00708 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch 1 from $0",
00709 ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_1),
00710 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
00711 ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
00712 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00713 ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
00714 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
00715 #line 217 "cursor.pgc"
00716
00717 if (sqlca.sqlcode < 0) exit (1);}
00718 #line 217 "cursor.pgc"
00719
00720 printf("%d %s\n", id, t);
00721
00722 strcpy(msg, "fetch :count from");
00723 count = 1;
00724 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch $0 from $0",
00725 ECPGt_int,&(count),(long)1,(long)1,sizeof(int),
00726 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00727 ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_1),
00728 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
00729 ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
00730 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00731 ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
00732 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
00733 #line 222 "cursor.pgc"
00734
00735 if (sqlca.sqlcode < 0) exit (1);}
00736 #line 222 "cursor.pgc"
00737
00738 printf("%d %s\n", id, t);
00739
00740 strcpy(msg, "move");
00741 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "move absolute 0 $0",
00742 ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_1),
00743 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
00744 #line 226 "cursor.pgc"
00745
00746 if (sqlca.sqlcode < 0) exit (1);}
00747 #line 226 "cursor.pgc"
00748
00749
00750 strcpy(msg, "fetch 1");
00751 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch 1 $0",
00752 ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_1),
00753 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
00754 ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
00755 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00756 ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
00757 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
00758 #line 229 "cursor.pgc"
00759
00760 if (sqlca.sqlcode < 0) exit (1);}
00761 #line 229 "cursor.pgc"
00762
00763 printf("%d %s\n", id, t);
00764
00765 strcpy(msg, "fetch :count");
00766 count = 1;
00767 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch $0 $0",
00768 ECPGt_int,&(count),(long)1,(long)1,sizeof(int),
00769 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00770 ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_1),
00771 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
00772 ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
00773 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00774 ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
00775 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
00776 #line 234 "cursor.pgc"
00777
00778 if (sqlca.sqlcode < 0) exit (1);}
00779 #line 234 "cursor.pgc"
00780
00781 printf("%d %s\n", id, t);
00782
00783 strcpy(msg, "close");
00784 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "close $0",
00785 ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_1),
00786 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
00787 #line 238 "cursor.pgc"
00788
00789 if (sqlca.sqlcode < 0) exit (1);}
00790 #line 238 "cursor.pgc"
00791
00792
00793 strcpy(msg, "deallocate prepare");
00794 { ECPGdeallocate(__LINE__, 0, "test1", "st_id2");
00795 #line 241 "cursor.pgc"
00796
00797 if (sqlca.sqlcode < 0) exit (1);}
00798 #line 241 "cursor.pgc"
00799
00800
00801
00802
00803 strcpy(msg, "drop");
00804 { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "drop table t1", ECPGt_EOIT, ECPGt_EORT);
00805 #line 246 "cursor.pgc"
00806
00807 if (sqlca.sqlcode < 0) exit (1);}
00808 #line 246 "cursor.pgc"
00809
00810 { ECPGdo(__LINE__, 0, 1, "test2", 0, ECPGst_normal, "drop table t1", ECPGt_EOIT, ECPGt_EORT);
00811 #line 247 "cursor.pgc"
00812
00813 if (sqlca.sqlcode < 0) exit (1);}
00814 #line 247 "cursor.pgc"
00815
00816
00817 strcpy(msg, "commit");
00818 { ECPGtrans(__LINE__, "test1", "commit");
00819 #line 250 "cursor.pgc"
00820
00821 if (sqlca.sqlcode < 0) exit (1);}
00822 #line 250 "cursor.pgc"
00823
00824
00825 strcpy(msg, "disconnect");
00826 { ECPGdisconnect(__LINE__, "ALL");
00827 #line 253 "cursor.pgc"
00828
00829 if (sqlca.sqlcode < 0) exit (1);}
00830 #line 253 "cursor.pgc"
00831
00832
00833 return (0);
00834 }