diff options
Diffstat (limited to 'src/interfaces/ecpg/test/expected/preproc-variable.c')
-rw-r--r-- | src/interfaces/ecpg/test/expected/preproc-variable.c | 87 |
1 files changed, 47 insertions, 40 deletions
diff --git a/src/interfaces/ecpg/test/expected/preproc-variable.c b/src/interfaces/ecpg/test/expected/preproc-variable.c index 6a63f5699d8..9f8b36d8a7b 100644 --- a/src/interfaces/ecpg/test/expected/preproc-variable.c +++ b/src/interfaces/ecpg/test/expected/preproc-variable.c @@ -70,11 +70,12 @@ main (void) + #line 27 "variable.pgc" struct personal_struct { #line 25 "variable.pgc" - struct varchar_name_25 { int len; char arr[ BUFFERSIZ ]; } name ; + struct varchar_name_1 { int len; char arr[ BUFFERSIZ ]; } name ; #line 26 "variable.pgc" struct birthinfo birth ; @@ -91,27 +92,33 @@ main (void) #line 31 "variable.pgc" ind ind_children ; -/* exec sql end declare section */ + struct t1 { #line 32 "variable.pgc" + struct varchar_name_2 { int len; char arr[ BUFFERSIZ ]; } name ; + } ; struct t2 { +#line 32 "variable.pgc" + struct varchar_name_3 { int len; char arr[ BUFFERSIZ ]; } name ; + } ;/* exec sql end declare section */ +#line 33 "variable.pgc" -#line 34 "variable.pgc" +#line 35 "variable.pgc" char * married = NULL ; -#line 34 "variable.pgc" +#line 35 "variable.pgc" -#line 35 "variable.pgc" +#line 36 "variable.pgc" long ind_married ; -#line 35 "variable.pgc" +#line 36 "variable.pgc" -#line 36 "variable.pgc" +#line 37 "variable.pgc" ind children ; -#line 36 "variable.pgc" +#line 37 "variable.pgc" char msg[128]; @@ -120,78 +127,78 @@ main (void) strcpy(msg, "connect"); { ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); -#line 43 "variable.pgc" +#line 44 "variable.pgc" if (sqlca.sqlcode < 0) exit (1);} -#line 43 "variable.pgc" +#line 44 "variable.pgc" strcpy(msg, "set"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT); -#line 46 "variable.pgc" +#line 47 "variable.pgc" if (sqlca.sqlcode < 0) exit (1);} -#line 46 "variable.pgc" +#line 47 "variable.pgc" strcpy(msg, "create"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table family ( name char ( 8 ) , born integer , age smallint , married date , children integer )", ECPGt_EOIT, ECPGt_EORT); -#line 49 "variable.pgc" +#line 50 "variable.pgc" if (sqlca.sqlcode < 0) exit (1);} -#line 49 "variable.pgc" +#line 50 "variable.pgc" strcpy(msg, "insert"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into family ( name , married , children ) values ( 'Mum' , '19870714' , 3 )", ECPGt_EOIT, ECPGt_EORT); -#line 52 "variable.pgc" - -if (sqlca.sqlcode < 0) exit (1);} -#line 52 "variable.pgc" - - { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into family ( name , born , married , children ) values ( 'Dad' , '19610721' , '19870714' , 3 )", ECPGt_EOIT, ECPGt_EORT); #line 53 "variable.pgc" if (sqlca.sqlcode < 0) exit (1);} #line 53 "variable.pgc" - { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into family ( name , age ) values ( 'Child 1' , 16 )", ECPGt_EOIT, ECPGt_EORT); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into family ( name , born , married , children ) values ( 'Dad' , '19610721' , '19870714' , 3 )", ECPGt_EOIT, ECPGt_EORT); #line 54 "variable.pgc" if (sqlca.sqlcode < 0) exit (1);} #line 54 "variable.pgc" - { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into family ( name , age ) values ( 'Child 2' , 14 )", ECPGt_EOIT, ECPGt_EORT); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into family ( name , age ) values ( 'Child 1' , 16 )", ECPGt_EOIT, ECPGt_EORT); #line 55 "variable.pgc" if (sqlca.sqlcode < 0) exit (1);} #line 55 "variable.pgc" - { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into family ( name , age ) values ( 'Child 3' , 9 )", ECPGt_EOIT, ECPGt_EORT); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into family ( name , age ) values ( 'Child 2' , 14 )", ECPGt_EOIT, ECPGt_EORT); #line 56 "variable.pgc" if (sqlca.sqlcode < 0) exit (1);} #line 56 "variable.pgc" + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into family ( name , age ) values ( 'Child 3' , 9 )", ECPGt_EOIT, ECPGt_EORT); +#line 57 "variable.pgc" + +if (sqlca.sqlcode < 0) exit (1);} +#line 57 "variable.pgc" + strcpy(msg, "commit"); { ECPGtrans(__LINE__, NULL, "commit"); -#line 59 "variable.pgc" +#line 60 "variable.pgc" if (sqlca.sqlcode < 0) exit (1);} -#line 59 "variable.pgc" +#line 60 "variable.pgc" strcpy(msg, "open"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur cursor for select name , born , age , married , children from family", ECPGt_EOIT, ECPGt_EORT); -#line 62 "variable.pgc" +#line 63 "variable.pgc" if (sqlca.sqlcode < 0) exit (1);} -#line 62 "variable.pgc" +#line 63 "variable.pgc" /* exec sql whenever not found break ; */ -#line 64 "variable.pgc" +#line 65 "variable.pgc" p=&personal; @@ -200,7 +207,7 @@ if (sqlca.sqlcode < 0) exit (1);} while (1) { strcpy(msg, "fetch"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur", ECPGt_EOIT, - ECPGt_varchar,&(p->name),(long)BUFFERSIZ,(long)1,sizeof(struct varchar_name_25), + ECPGt_varchar,&(p->name),(long)BUFFERSIZ,(long)1,sizeof(struct varchar_name_1), ECPGt_int,&(i->ind_name),(long)1,(long)1,sizeof(int), ECPGt_long,&(p->birth.born),(long)1,(long)1,sizeof(long), ECPGt_long,&(i->ind_birth.born),(long)1,(long)1,sizeof(long), @@ -210,13 +217,13 @@ if (sqlca.sqlcode < 0) exit (1);} ECPGt_long,&(ind_married),(long)1,(long)1,sizeof(long), ECPGt_int,&(children.integer),(long)1,(long)1,sizeof(int), ECPGt_short,&(ind_children.smallint),(long)1,(long)1,sizeof(short), ECPGt_EORT); -#line 71 "variable.pgc" +#line 72 "variable.pgc" if (sqlca.sqlcode == ECPG_NOT_FOUND) break; -#line 71 "variable.pgc" +#line 72 "variable.pgc" if (sqlca.sqlcode < 0) exit (1);} -#line 71 "variable.pgc" +#line 72 "variable.pgc" printf("%8.8s", personal.name.arr); if (i->ind_birth.born >= 0) @@ -235,34 +242,34 @@ if (sqlca.sqlcode < 0) exit (1);} strcpy(msg, "close"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur", ECPGt_EOIT, ECPGt_EORT); -#line 88 "variable.pgc" +#line 89 "variable.pgc" if (sqlca.sqlcode < 0) exit (1);} -#line 88 "variable.pgc" +#line 89 "variable.pgc" strcpy(msg, "drop"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table family", ECPGt_EOIT, ECPGt_EORT); -#line 91 "variable.pgc" +#line 92 "variable.pgc" if (sqlca.sqlcode < 0) exit (1);} -#line 91 "variable.pgc" +#line 92 "variable.pgc" strcpy(msg, "commit"); { ECPGtrans(__LINE__, NULL, "commit"); -#line 94 "variable.pgc" +#line 95 "variable.pgc" if (sqlca.sqlcode < 0) exit (1);} -#line 94 "variable.pgc" +#line 95 "variable.pgc" strcpy(msg, "disconnect"); { ECPGdisconnect(__LINE__, "CURRENT"); -#line 97 "variable.pgc" +#line 98 "variable.pgc" if (sqlca.sqlcode < 0) exit (1);} -#line 97 "variable.pgc" +#line 98 "variable.pgc" return (0); |