7#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
49#define CURNAME "mycur"
66 char * stmt1 =
"SELECT id, t FROM t1" ;
78 struct varchar_1 {
int len;
char arr[ 50 ]; } curname4 ;
99 strcpy(msg,
"connect");
100 {
ECPGconnect(__LINE__, 0,
"ecpg1_regression" , NULL, NULL ,
"test1", 0);
103if (
sqlca.sqlcode < 0) exit (1);}
106 {
ECPGconnect(__LINE__, 0,
"ecpg2_regression" , NULL, NULL ,
"test2", 0);
109if (
sqlca.sqlcode < 0) exit (1);}
117if (
sqlca.sqlcode < 0) exit (1);}
121 strcpy(msg,
"create");
125if (
sqlca.sqlcode < 0) exit (1);}
131if (
sqlca.sqlcode < 0) exit (1);}
135 strcpy(msg,
"insert");
136 {
ECPGdo(__LINE__, 0, 1,
"test1", 0,
ECPGst_normal,
"insert into t1 ( id , t ) values ( default , 'a' )",
ECPGt_EOIT,
ECPGt_EORT);
139if (
sqlca.sqlcode < 0) exit (1);}
142 {
ECPGdo(__LINE__, 0, 1,
"test1", 0,
ECPGst_normal,
"insert into t1 ( id , t ) values ( default , 'b' )",
ECPGt_EOIT,
ECPGt_EORT);
145if (
sqlca.sqlcode < 0) exit (1);}
148 {
ECPGdo(__LINE__, 0, 1,
"test1", 0,
ECPGst_normal,
"insert into t1 ( id , t ) values ( default , 'c' )",
ECPGt_EOIT,
ECPGt_EORT);
151if (
sqlca.sqlcode < 0) exit (1);}
154 {
ECPGdo(__LINE__, 0, 1,
"test1", 0,
ECPGst_normal,
"insert into t1 ( id , t ) values ( default , 'd' )",
ECPGt_EOIT,
ECPGt_EORT);
157if (
sqlca.sqlcode < 0) exit (1);}
160 {
ECPGdo(__LINE__, 0, 1,
"test2", 0,
ECPGst_normal,
"insert into t1 ( id , t ) values ( default , 'e' )",
ECPGt_EOIT,
ECPGt_EORT);
163if (
sqlca.sqlcode < 0) exit (1);}
167 strcpy(msg,
"commit");
168 {
ECPGtrans(__LINE__,
"test1",
"commit");
171if (
sqlca.sqlcode < 0) exit (1);}
174 {
ECPGtrans(__LINE__,
"test2",
"commit");
177if (
sqlca.sqlcode < 0) exit (1);}
183 strcpy(msg,
"declare");
188if (
sqlca.sqlcode < 0) exit (1);
195 {
ECPGdo(__LINE__, 0, 1,
"test1", 0,
ECPGst_normal,
"declare $0 cursor for select id , t from t1",
196 ECPGt_char,&(curname1),(
long)0,(
long)1,(1)*
sizeof(
char),
200if (
sqlca.sqlcode < 0) exit (1);}
204 strcpy(msg,
"fetch from");
206 ECPGt_char,&(curname1),(
long)0,(
long)1,(1)*
sizeof(
char),
208 ECPGt_int,&(
id),(
long)1,(
long)1,
sizeof(
int),
210 ECPGt_char,(t),(
long)64,(
long)1,(64)*
sizeof(
char),
214if (
sqlca.sqlcode < 0) exit (1);}
219 strcpy(msg,
"fetch");
221 ECPGt_char,&(curname1),(
long)0,(
long)1,(1)*
sizeof(
char),
223 ECPGt_int,&(
id),(
long)1,(
long)1,
sizeof(
int),
225 ECPGt_char,(t),(
long)64,(
long)1,(64)*
sizeof(
char),
229if (
sqlca.sqlcode < 0) exit (1);}
234 strcpy(msg,
"fetch 1 from");
236 ECPGt_char,&(curname1),(
long)0,(
long)1,(1)*
sizeof(
char),
238 ECPGt_int,&(
id),(
long)1,(
long)1,
sizeof(
int),
240 ECPGt_char,(t),(
long)64,(
long)1,(64)*
sizeof(
char),
244if (
sqlca.sqlcode < 0) exit (1);}
249 strcpy(msg,
"fetch :count from");
252 ECPGt_int,&(count),(
long)1,(
long)1,
sizeof(
int),
254 ECPGt_char,&(curname1),(
long)0,(
long)1,(1)*
sizeof(
char),
256 ECPGt_int,&(
id),(
long)1,(
long)1,
sizeof(
int),
258 ECPGt_char,(t),(
long)64,(
long)1,(64)*
sizeof(
char),
262if (
sqlca.sqlcode < 0) exit (1);}
267 strcpy(msg,
"move in");
269 ECPGt_char,&(curname1),(
long)0,(
long)1,(1)*
sizeof(
char),
273if (
sqlca.sqlcode < 0) exit (1);}
277 strcpy(msg,
"fetch 1");
279 ECPGt_char,&(curname1),(
long)0,(
long)1,(1)*
sizeof(
char),
281 ECPGt_int,&(
id),(
long)1,(
long)1,
sizeof(
int),
283 ECPGt_char,(t),(
long)64,(
long)1,(64)*
sizeof(
char),
287if (
sqlca.sqlcode < 0) exit (1);}
292 strcpy(msg,
"fetch :count");
295 ECPGt_int,&(count),(
long)1,(
long)1,
sizeof(
int),
297 ECPGt_char,&(curname1),(
long)0,(
long)1,(1)*
sizeof(
char),
299 ECPGt_int,&(
id),(
long)1,(
long)1,
sizeof(
int),
301 ECPGt_char,(t),(
long)64,(
long)1,(64)*
sizeof(
char),
305if (
sqlca.sqlcode < 0) exit (1);}
310 strcpy(msg,
"close");
312 ECPGt_char,&(curname1),(
long)0,(
long)1,(1)*
sizeof(
char),
316if (
sqlca.sqlcode < 0) exit (1);}
322 strcpy(msg,
"declare");
324 ECPGset_var( 2, ( t ), __LINE__);\
325 ECPGset_var( 3, &(
id ), __LINE__);\
327#line 105 "cursor.pgc"
329if (
sqlca.sqlcode < 0) exit (1);
330#line 105 "cursor.pgc"
332#line 105 "cursor.pgc"
336 {
ECPGdo(__LINE__, 0, 1,
"test1", 0,
ECPGst_normal,
"declare $0 cursor for select id , t from t1",
337 ECPGt_char,&(curname2),(
long)0,(
long)1,(1)*
sizeof(
char),
339 ECPGt_int,&(
id),(
long)1,(
long)1,
sizeof(
int),
341 ECPGt_char,(t),(
long)64,(
long)1,(64)*
sizeof(
char),
343#line 108 "cursor.pgc"
345if (
sqlca.sqlcode < 0) exit (1);}
346#line 108 "cursor.pgc"
349 strcpy(msg,
"fetch from");
351 ECPGt_char,&(curname2),(
long)0,(
long)1,(1)*
sizeof(
char),
353 ECPGt_int,&(
id),(
long)1,(
long)1,
sizeof(
int),
355 ECPGt_char,(t),(
long)64,(
long)1,(64)*
sizeof(
char),
357#line 111 "cursor.pgc"
359if (
sqlca.sqlcode < 0) exit (1);}
360#line 111 "cursor.pgc"
364 strcpy(msg,
"fetch");
366 ECPGt_char,&(curname2),(
long)0,(
long)1,(1)*
sizeof(
char),
368 ECPGt_int,&(
id),(
long)1,(
long)1,
sizeof(
int),
370 ECPGt_char,(t),(
long)64,(
long)1,(64)*
sizeof(
char),
372#line 115 "cursor.pgc"
374if (
sqlca.sqlcode < 0) exit (1);}
375#line 115 "cursor.pgc"
379 strcpy(msg,
"fetch 1 from");
381 ECPGt_char,&(curname2),(
long)0,(
long)1,(1)*
sizeof(
char),
383 ECPGt_int,&(
id),(
long)1,(
long)1,
sizeof(
int),
385 ECPGt_char,(t),(
long)64,(
long)1,(64)*
sizeof(
char),
387#line 119 "cursor.pgc"
389if (
sqlca.sqlcode < 0) exit (1);}
390#line 119 "cursor.pgc"
394 strcpy(msg,
"fetch :count from");
397 ECPGt_int,&(count),(
long)1,(
long)1,
sizeof(
int),
399 ECPGt_char,&(curname2),(
long)0,(
long)1,(1)*
sizeof(
char),
401 ECPGt_int,&(
id),(
long)1,(
long)1,
sizeof(
int),
403 ECPGt_char,(t),(
long)64,(
long)1,(64)*
sizeof(
char),
405#line 124 "cursor.pgc"
407if (
sqlca.sqlcode < 0) exit (1);}
408#line 124 "cursor.pgc"
414 ECPGt_char,&(curname2),(
long)0,(
long)1,(1)*
sizeof(
char),
416 ECPGt_int,&(
id),(
long)1,(
long)1,
sizeof(
int),
418 ECPGt_char,(t),(
long)64,(
long)1,(64)*
sizeof(
char),
420#line 128 "cursor.pgc"
422if (
sqlca.sqlcode < 0) exit (1);}
423#line 128 "cursor.pgc"
426 strcpy(msg,
"fetch 1");
428 ECPGt_char,&(curname2),(
long)0,(
long)1,(1)*
sizeof(
char),
430 ECPGt_int,&(
id),(
long)1,(
long)1,
sizeof(
int),
432 ECPGt_char,(t),(
long)64,(
long)1,(64)*
sizeof(
char),
434#line 131 "cursor.pgc"
436if (
sqlca.sqlcode < 0) exit (1);}
437#line 131 "cursor.pgc"
441 strcpy(msg,
"fetch :count");
444 ECPGt_int,&(count),(
long)1,(
long)1,
sizeof(
int),
446 ECPGt_char,&(curname2),(
long)0,(
long)1,(1)*
sizeof(
char),
448 ECPGt_int,&(
id),(
long)1,(
long)1,
sizeof(
int),
450 ECPGt_char,(t),(
long)64,(
long)1,(64)*
sizeof(
char),
452#line 136 "cursor.pgc"
454if (
sqlca.sqlcode < 0) exit (1);}
455#line 136 "cursor.pgc"
459 strcpy(msg,
"close");
461 ECPGt_char,&(curname2),(
long)0,(
long)1,(1)*
sizeof(
char),
463#line 140 "cursor.pgc"
465if (
sqlca.sqlcode < 0) exit (1);}
466#line 140 "cursor.pgc"
471 strcpy(msg,
"prepare");
472 {
ECPGprepare(__LINE__,
"test1", 0,
"st_id1", stmt1);
473#line 145 "cursor.pgc"
475if (
sqlca.sqlcode < 0) exit (1);}
476#line 145 "cursor.pgc"
478 {
ECPGprepare(__LINE__,
"test2", 0,
"st_id1", stmt1);
479#line 146 "cursor.pgc"
481if (
sqlca.sqlcode < 0) exit (1);}
482#line 146 "cursor.pgc"
485 strcpy(msg,
"declare");
488#line 149 "cursor.pgc"
490if (
sqlca.sqlcode < 0) exit (1);
491#line 149 "cursor.pgc"
493#line 149 "cursor.pgc"
497#line 150 "cursor.pgc"
499if (
sqlca.sqlcode < 0) exit (1);
500#line 150 "cursor.pgc"
502#line 150 "cursor.pgc"
507 ECPGt_char,&(curname3),(
long)0,(
long)1,(1)*
sizeof(
char),
511#line 153 "cursor.pgc"
513if (
sqlca.sqlcode < 0) exit (1);}
514#line 153 "cursor.pgc"
517 ECPGt_char,&(curname5),(
long)0,(
long)1,(1)*
sizeof(
char),
521#line 154 "cursor.pgc"
523if (
sqlca.sqlcode < 0) exit (1);}
524#line 154 "cursor.pgc"
527 strcpy(msg,
"fetch");
529 ECPGt_char,&(curname5),(
long)0,(
long)1,(1)*
sizeof(
char),
531 ECPGt_int,&(
id),(
long)1,(
long)1,
sizeof(
int),
533 ECPGt_char,(t),(
long)64,(
long)1,(64)*
sizeof(
char),
535#line 157 "cursor.pgc"
537if (
sqlca.sqlcode < 0) exit (1);}
538#line 157 "cursor.pgc"
542 strcpy(msg,
"fetch from");
544 ECPGt_char,&(curname3),(
long)0,(
long)1,(1)*
sizeof(
char),
546 ECPGt_int,&(
id),(
long)1,(
long)1,
sizeof(
int),
548 ECPGt_char,(t),(
long)64,(
long)1,(64)*
sizeof(
char),
550#line 161 "cursor.pgc"
552if (
sqlca.sqlcode < 0) exit (1);}
553#line 161 "cursor.pgc"
557 strcpy(msg,
"fetch 1 from");
559 ECPGt_char,&(curname3),(
long)0,(
long)1,(1)*
sizeof(
char),
561 ECPGt_int,&(
id),(
long)1,(
long)1,
sizeof(
int),
563 ECPGt_char,(t),(
long)64,(
long)1,(64)*
sizeof(
char),
565#line 165 "cursor.pgc"
567if (
sqlca.sqlcode < 0) exit (1);}
568#line 165 "cursor.pgc"
572 strcpy(msg,
"fetch :count from");
575 ECPGt_int,&(count),(
long)1,(
long)1,
sizeof(
int),
577 ECPGt_char,&(curname3),(
long)0,(
long)1,(1)*
sizeof(
char),
579 ECPGt_int,&(
id),(
long)1,(
long)1,
sizeof(
int),
581 ECPGt_char,(t),(
long)64,(
long)1,(64)*
sizeof(
char),
583#line 170 "cursor.pgc"
585if (
sqlca.sqlcode < 0) exit (1);}
586#line 170 "cursor.pgc"
592 ECPGt_char,&(curname3),(
long)0,(
long)1,(1)*
sizeof(
char),
594#line 174 "cursor.pgc"
596if (
sqlca.sqlcode < 0) exit (1);}
597#line 174 "cursor.pgc"
600 strcpy(msg,
"fetch 1");
602 ECPGt_char,&(curname3),(
long)0,(
long)1,(1)*
sizeof(
char),
604 ECPGt_int,&(
id),(
long)1,(
long)1,
sizeof(
int),
606 ECPGt_char,(t),(
long)64,(
long)1,(64)*
sizeof(
char),
608#line 177 "cursor.pgc"
610if (
sqlca.sqlcode < 0) exit (1);}
611#line 177 "cursor.pgc"
615 strcpy(msg,
"fetch :count");
618 ECPGt_int,&(count),(
long)1,(
long)1,
sizeof(
int),
620 ECPGt_char,&(curname3),(
long)0,(
long)1,(1)*
sizeof(
char),
622 ECPGt_int,&(
id),(
long)1,(
long)1,
sizeof(
int),
624 ECPGt_char,(t),(
long)64,(
long)1,(64)*
sizeof(
char),
626#line 182 "cursor.pgc"
628if (
sqlca.sqlcode < 0) exit (1);}
629#line 182 "cursor.pgc"
633 strcpy(msg,
"close");
635 ECPGt_char,&(curname3),(
long)0,(
long)1,(1)*
sizeof(
char),
637#line 186 "cursor.pgc"
639if (
sqlca.sqlcode < 0) exit (1);}
640#line 186 "cursor.pgc"
643 ECPGt_char,&(curname5),(
long)0,(
long)1,(1)*
sizeof(
char),
645#line 187 "cursor.pgc"
647if (
sqlca.sqlcode < 0) exit (1);}
648#line 187 "cursor.pgc"
651 strcpy(msg,
"deallocate prepare");
653#line 190 "cursor.pgc"
655if (
sqlca.sqlcode < 0) exit (1);}
656#line 190 "cursor.pgc"
659#line 191 "cursor.pgc"
661if (
sqlca.sqlcode < 0) exit (1);}
662#line 191 "cursor.pgc"
668 curname4.len = strlen(
CURNAME);
671 strcpy(msg,
"prepare");
672 {
ECPGprepare(__LINE__,
"test1", 0,
"st_id2", stmt1);
673#line 200 "cursor.pgc"
675if (
sqlca.sqlcode < 0) exit (1);}
676#line 200 "cursor.pgc"
679 strcpy(msg,
"declare");
682#line 203 "cursor.pgc"
684if (
sqlca.sqlcode < 0) exit (1);
685#line 203 "cursor.pgc"
687#line 203 "cursor.pgc"
692 ECPGt_varchar,&(curname4),(
long)50,(
long)1,
sizeof(
struct varchar_1),
696#line 206 "cursor.pgc"
698if (
sqlca.sqlcode < 0) exit (1);}
699#line 206 "cursor.pgc"
702 strcpy(msg,
"fetch from");
704 ECPGt_varchar,&(curname4),(
long)50,(
long)1,
sizeof(
struct varchar_1),
706 ECPGt_int,&(
id),(
long)1,(
long)1,
sizeof(
int),
708 ECPGt_char,(t),(
long)64,(
long)1,(64)*
sizeof(
char),
710#line 209 "cursor.pgc"
712if (
sqlca.sqlcode < 0) exit (1);}
713#line 209 "cursor.pgc"
717 strcpy(msg,
"fetch");
719 ECPGt_varchar,&(curname4),(
long)50,(
long)1,
sizeof(
struct varchar_1),
721 ECPGt_int,&(
id),(
long)1,(
long)1,
sizeof(
int),
723 ECPGt_char,(t),(
long)64,(
long)1,(64)*
sizeof(
char),
725#line 213 "cursor.pgc"
727if (
sqlca.sqlcode < 0) exit (1);}
728#line 213 "cursor.pgc"
732 strcpy(msg,
"fetch 1 from");
734 ECPGt_varchar,&(curname4),(
long)50,(
long)1,
sizeof(
struct varchar_1),
736 ECPGt_int,&(
id),(
long)1,(
long)1,
sizeof(
int),
738 ECPGt_char,(t),(
long)64,(
long)1,(64)*
sizeof(
char),
740#line 217 "cursor.pgc"
742if (
sqlca.sqlcode < 0) exit (1);}
743#line 217 "cursor.pgc"
747 strcpy(msg,
"fetch :count from");
750 ECPGt_int,&(count),(
long)1,(
long)1,
sizeof(
int),
752 ECPGt_varchar,&(curname4),(
long)50,(
long)1,
sizeof(
struct varchar_1),
754 ECPGt_int,&(
id),(
long)1,(
long)1,
sizeof(
int),
756 ECPGt_char,(t),(
long)64,(
long)1,(64)*
sizeof(
char),
758#line 222 "cursor.pgc"
760if (
sqlca.sqlcode < 0) exit (1);}
761#line 222 "cursor.pgc"
767 ECPGt_varchar,&(curname4),(
long)50,(
long)1,
sizeof(
struct varchar_1),
769#line 226 "cursor.pgc"
771if (
sqlca.sqlcode < 0) exit (1);}
772#line 226 "cursor.pgc"
775 strcpy(msg,
"fetch 1");
777 ECPGt_varchar,&(curname4),(
long)50,(
long)1,
sizeof(
struct varchar_1),
779 ECPGt_int,&(
id),(
long)1,(
long)1,
sizeof(
int),
781 ECPGt_char,(t),(
long)64,(
long)1,(64)*
sizeof(
char),
783#line 229 "cursor.pgc"
785if (
sqlca.sqlcode < 0) exit (1);}
786#line 229 "cursor.pgc"
790 strcpy(msg,
"fetch :count");
793 ECPGt_int,&(count),(
long)1,(
long)1,
sizeof(
int),
795 ECPGt_varchar,&(curname4),(
long)50,(
long)1,
sizeof(
struct varchar_1),
797 ECPGt_int,&(
id),(
long)1,(
long)1,
sizeof(
int),
799 ECPGt_char,(t),(
long)64,(
long)1,(64)*
sizeof(
char),
801#line 234 "cursor.pgc"
803if (
sqlca.sqlcode < 0) exit (1);}
804#line 234 "cursor.pgc"
808 strcpy(msg,
"close");
810 ECPGt_varchar,&(curname4),(
long)50,(
long)1,
sizeof(
struct varchar_1),
812#line 238 "cursor.pgc"
814if (
sqlca.sqlcode < 0) exit (1);}
815#line 238 "cursor.pgc"
818 strcpy(msg,
"deallocate prepare");
820#line 241 "cursor.pgc"
822if (
sqlca.sqlcode < 0) exit (1);}
823#line 241 "cursor.pgc"
830#line 246 "cursor.pgc"
832if (
sqlca.sqlcode < 0) exit (1);}
833#line 246 "cursor.pgc"
836#line 247 "cursor.pgc"
838if (
sqlca.sqlcode < 0) exit (1);}
839#line 247 "cursor.pgc"
842 strcpy(msg,
"commit");
843 {
ECPGtrans(__LINE__,
"test1",
"commit");
844#line 250 "cursor.pgc"
846if (
sqlca.sqlcode < 0) exit (1);}
847#line 250 "cursor.pgc"
850 strcpy(msg,
"disconnect");
852#line 253 "cursor.pgc"
854if (
sqlca.sqlcode < 0) exit (1);}
855#line 253 "cursor.pgc"
bool ECPGdisconnect(int lineno, const char *connection_name)
bool ECPGconnect(int lineno, int c, const char *name, const char *user, const char *passwd, const char *connection_name, int autocommit)
bool ECPGdo(const int lineno, const int compat, const int force_indicator, const char *connection_name, const bool questionmarks, const int st, const char *query,...)
void ECPGset_var(int number, void *pointer, int lineno)
bool ECPGtrans(int lineno, const char *connection_name, const char *transaction)
char * ECPGprepared_statement(const char *connection_name, const char *name, int lineno)
bool ECPGprepare(int lineno, const char *connection_name, const bool questionmarks, const char *name, const char *variable)
bool ECPGdeallocate(int lineno, int c, const char *connection_name, const char *name)