diff -cprN head/src/interfaces/ecpg/autoprep.c work/src/interfaces/ecpg/autoprep.c *** head/src/interfaces/ecpg/autoprep.c Thu Jan 1 09:00:00 1970 --- work/src/interfaces/ecpg/autoprep.c Tue Jan 19 13:25:20 2010 *************** *** 0 **** --- 1,299 ---- + /* Processed by ecpg (4.6.0) */ + /* These include files are added by the preprocessor */ + #include + #include + #include + /* End of automatic include section */ + + #line 1 "autoprep.pgc" + #include + #include + #include + + /* test automatic prepare for all statements */ + + #line 1 "./test/regression.h" + + + + + + + #line 6 "autoprep.pgc" + + + int main() { + /* exec sql begin declare section */ + + + + + #line 10 "autoprep.pgc" + int item [ 4 ] , ind [ 4 ] , i = 1 ; + + #line 11 "autoprep.pgc" + int item1 , ind1 ; + + #line 12 "autoprep.pgc" + char sqlstr [ 64 ] = "SELECT item2 FROM T ORDER BY item2 NULLS LAST" ; + /* exec sql end declare section */ + #line 13 "autoprep.pgc" + + + ECPGdebug(1, stderr); + { ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); } + #line 16 "autoprep.pgc" + + + /* exec sql whenever sql_warning sqlprint ; */ + #line 18 "autoprep.pgc" + + /* exec sql whenever sqlerror sqlprint ; */ + #line 19 "autoprep.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table T ( Item1 int , Item2 int )", ECPGt_EOIT, ECPGt_EORT); + #line 21 "autoprep.pgc" + + if (sqlca.sqlwarn[0] == 'W') sqlprint(); + #line 21 "autoprep.pgc" + + if (sqlca.sqlcode < 0) sqlprint();} + #line 21 "autoprep.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_prepnormal, "insert into T values ( 1 , null )", ECPGt_EOIT, ECPGt_EORT); + #line 23 "autoprep.pgc" + + if (sqlca.sqlwarn[0] == 'W') sqlprint(); + #line 23 "autoprep.pgc" + + if (sqlca.sqlcode < 0) sqlprint();} + #line 23 "autoprep.pgc" + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_prepnormal, "insert into T values ( 1 , $1 )", + ECPGt_int,&(i),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); + #line 24 "autoprep.pgc" + + if (sqlca.sqlwarn[0] == 'W') sqlprint(); + #line 24 "autoprep.pgc" + + if (sqlca.sqlcode < 0) sqlprint();} + #line 24 "autoprep.pgc" + + i++; + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_prepnormal, "insert into T values ( 1 , $1 )", + ECPGt_int,&(i),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); + #line 26 "autoprep.pgc" + + if (sqlca.sqlwarn[0] == 'W') sqlprint(); + #line 26 "autoprep.pgc" + + if (sqlca.sqlcode < 0) sqlprint();} + #line 26 "autoprep.pgc" + + { ECPGprepare(__LINE__, NULL, 0, "i", " insert into T values ( 1 , 2 ) "); + #line 27 "autoprep.pgc" + + if (sqlca.sqlwarn[0] == 'W') sqlprint(); + #line 27 "autoprep.pgc" + + if (sqlca.sqlcode < 0) sqlprint();} + #line 27 "autoprep.pgc" + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "i", ECPGt_EOIT, ECPGt_EORT); + #line 28 "autoprep.pgc" + + if (sqlca.sqlwarn[0] == 'W') sqlprint(); + #line 28 "autoprep.pgc" + + if (sqlca.sqlcode < 0) sqlprint();} + #line 28 "autoprep.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_prepnormal, "select Item2 from T order by Item2 nulls last", ECPGt_EOIT, + ECPGt_int,(item),(long)1,(long)4,sizeof(int), + ECPGt_int,(ind),(long)1,(long)4,sizeof(int), ECPGt_EORT); + #line 30 "autoprep.pgc" + + if (sqlca.sqlwarn[0] == 'W') sqlprint(); + #line 30 "autoprep.pgc" + + if (sqlca.sqlcode < 0) sqlprint();} + #line 30 "autoprep.pgc" + + + for (i=0; i<4; i++) + printf("item[%d] = %d\n", i, ind[i] ? -1 : item[i]); + + /* declare C cursor for select Item1 from T */ + #line 35 "autoprep.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare C cursor for select Item1 from T", ECPGt_EOIT, ECPGt_EORT); + #line 37 "autoprep.pgc" + + if (sqlca.sqlwarn[0] == 'W') sqlprint(); + #line 37 "autoprep.pgc" + + if (sqlca.sqlcode < 0) sqlprint();} + #line 37 "autoprep.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch 1 in C", ECPGt_EOIT, + ECPGt_int,&(i),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT); + #line 39 "autoprep.pgc" + + if (sqlca.sqlwarn[0] == 'W') sqlprint(); + #line 39 "autoprep.pgc" + + if (sqlca.sqlcode < 0) sqlprint();} + #line 39 "autoprep.pgc" + + printf("i = %d\n", i); + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close C", ECPGt_EOIT, ECPGt_EORT); + #line 42 "autoprep.pgc" + + if (sqlca.sqlwarn[0] == 'W') sqlprint(); + #line 42 "autoprep.pgc" + + if (sqlca.sqlcode < 0) sqlprint();} + #line 42 "autoprep.pgc" + + + { ECPGprepare(__LINE__, NULL, 0, "stmt1", sqlstr); + #line 44 "autoprep.pgc" + + if (sqlca.sqlwarn[0] == 'W') sqlprint(); + #line 44 "autoprep.pgc" + + if (sqlca.sqlcode < 0) sqlprint();} + #line 44 "autoprep.pgc" + + + /* declare cur1 cursor for $1 */ + #line 46 "autoprep.pgc" + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur1 cursor for $1", + ECPGt_char_variable,(ECPGprepared_statement(NULL, "stmt1", __LINE__)),(long)1,(long)1,(1)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); + #line 48 "autoprep.pgc" + + if (sqlca.sqlwarn[0] == 'W') sqlprint(); + #line 48 "autoprep.pgc" + + if (sqlca.sqlcode < 0) sqlprint();} + #line 48 "autoprep.pgc" + + + /* exec sql whenever not found break ; */ + #line 50 "autoprep.pgc" + + + i = 0; + while (1) + { + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur1", ECPGt_EOIT, + ECPGt_int,&(item1),(long)1,(long)1,sizeof(int), + ECPGt_int,&(ind1),(long)1,(long)1,sizeof(int), ECPGt_EORT); + #line 55 "autoprep.pgc" + + if (sqlca.sqlcode == ECPG_NOT_FOUND) break; + #line 55 "autoprep.pgc" + + if (sqlca.sqlwarn[0] == 'W') sqlprint(); + #line 55 "autoprep.pgc" + + if (sqlca.sqlcode < 0) sqlprint();} + #line 55 "autoprep.pgc" + + printf("item[%d] = %d\n", i, ind1 ? -1 : item1); + i++; + } + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur1", ECPGt_EOIT, ECPGt_EORT); + #line 60 "autoprep.pgc" + + if (sqlca.sqlwarn[0] == 'W') sqlprint(); + #line 60 "autoprep.pgc" + + if (sqlca.sqlcode < 0) sqlprint();} + #line 60 "autoprep.pgc" + + + { ECPGdisconnect(__LINE__, "ALL"); + #line 62 "autoprep.pgc" + + if (sqlca.sqlwarn[0] == 'W') sqlprint(); + #line 62 "autoprep.pgc" + + if (sqlca.sqlcode < 0) sqlprint();} + #line 62 "autoprep.pgc" + + + /* + * tests for reconnection + */ + + { ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); + #line 68 "autoprep.pgc" + + if (sqlca.sqlwarn[0] == 'W') sqlprint(); + #line 68 "autoprep.pgc" + + if (sqlca.sqlcode < 0) sqlprint();} + #line 68 "autoprep.pgc" + + + /* exec sql whenever not found stop ; */ + #line 70 "autoprep.pgc" + + + memset(item, 0, sizeof(item)); + memset(ind, 0, sizeof(ind)); + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_prepnormal, "select Item2 from T order by Item2 nulls last", ECPGt_EOIT, + ECPGt_int,(item),(long)1,(long)4,sizeof(int), + ECPGt_int,(ind),(long)1,(long)4,sizeof(int), ECPGt_EORT); + #line 75 "autoprep.pgc" + + if (sqlca.sqlcode == ECPG_NOT_FOUND) exit (1); + #line 75 "autoprep.pgc" + + if (sqlca.sqlwarn[0] == 'W') sqlprint(); + #line 75 "autoprep.pgc" + + if (sqlca.sqlcode < 0) sqlprint();} + #line 75 "autoprep.pgc" + + + for (i=0; i<4; i++) + printf("item[%d] = %d\n", i, ind[i] ? -1 : item[i]); + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table T", ECPGt_EOIT, ECPGt_EORT); + #line 80 "autoprep.pgc" + + if (sqlca.sqlwarn[0] == 'W') sqlprint(); + #line 80 "autoprep.pgc" + + if (sqlca.sqlcode < 0) sqlprint();} + #line 80 "autoprep.pgc" + + + { ECPGdisconnect(__LINE__, "ALL"); + #line 82 "autoprep.pgc" + + if (sqlca.sqlwarn[0] == 'W') sqlprint(); + #line 82 "autoprep.pgc" + + if (sqlca.sqlcode < 0) sqlprint();} + #line 82 "autoprep.pgc" + + + return 0; + } diff -cprN head/src/interfaces/ecpg/autoprep.pgc work/src/interfaces/ecpg/autoprep.pgc *** head/src/interfaces/ecpg/autoprep.pgc Thu Jan 1 09:00:00 1970 --- work/src/interfaces/ecpg/autoprep.pgc Tue Jan 19 13:27:24 2010 *************** *** 0 **** --- 1,83 ---- + #include + #include + #include + + /* test automatic prepare for all statements */ + EXEC SQL INCLUDE test/regression; + + int main() { + EXEC SQL BEGIN DECLARE SECTION; + int item[4], ind[4], i = 1; + int item1, ind1; + char sqlstr[64] = "SELECT item2 FROM T ORDER BY item2 NULLS LAST"; + EXEC SQL END DECLARE SECTION; + + ECPGdebug(1, stderr); + EXEC SQL CONNECT TO REGRESSDB1; + + EXEC SQL WHENEVER SQLWARNING SQLPRINT; + EXEC SQL WHENEVER SQLERROR SQLPRINT; + + EXEC SQL CREATE TABLE T ( Item1 int, Item2 int ); + + EXEC SQL INSERT INTO T VALUES ( 1, null ); + EXEC SQL INSERT INTO T VALUES ( 1, :i ); + i++; + EXEC SQL INSERT INTO T VALUES ( 1, :i ); + EXEC SQL PREPARE I AS INSERT INTO T VALUES ( 1, 2 ); + EXEC SQL EXECUTE I; + + EXEC SQL SELECT Item2 INTO :item:ind FROM T ORDER BY Item2 NULLS LAST; + + for (i=0; i<4; i++) + printf("item[%d] = %d\n", i, ind[i] ? -1 : item[i]); + + EXEC SQL DECLARE C CURSOR FOR SELECT Item1 FROM T; + + EXEC SQL OPEN C; + + EXEC SQL FETCH 1 IN C INTO :i; + printf("i = %d\n", i); + + EXEC SQL CLOSE C; + + EXEC SQL PREPARE stmt1 FROM :sqlstr; + + EXEC SQL DECLARE cur1 CURSOR FOR stmt1; + + EXEC SQL OPEN cur1; + + EXEC SQL WHENEVER NOT FOUND DO BREAK; + + i = 0; + while (1) + { + EXEC SQL FETCH cur1 INTO :item1:ind1; + printf("item[%d] = %d\n", i, ind1 ? -1 : item1); + i++; + } + + EXEC SQL CLOSE cur1; + + EXEC SQL DISCONNECT ALL; + + /* tests for reconnection */ + + EXEC SQL CONNECT TO REGRESSDB1; + + EXEC SQL WHENEVER NOT FOUND STOP; + + memset(item, 0, sizeof(item)); + memset(ind, 0, sizeof(ind)); + + EXEC SQL SELECT Item2 INTO :item:ind FROM T ORDER BY Item2 NULLS LAST; + + for (i=0; i<4; i++) + printf("item[%d] = %d\n", i, ind[i] ? -1 : item[i]); + + EXEC SQL DROP TABLE T; + + EXEC SQL DISCONNECT ALL; + + return 0; + } diff -cprN head/src/interfaces/ecpg/test/expected/preproc-autoprep.c work/src/interfaces/ecpg/test/expected/preproc-autoprep.c *** head/src/interfaces/ecpg/test/expected/preproc-autoprep.c Thu Dec 17 09:42:41 2009 --- work/src/interfaces/ecpg/test/expected/preproc-autoprep.c Tue Jan 19 13:40:54 2010 *************** *** 23,29 **** #line 6 "autoprep.pgc" ! int main() { /* exec sql begin declare section */ --- 23,29 ---- #line 6 "autoprep.pgc" ! void test(void) { /* exec sql begin declare section */ *************** if (sqlca.sqlwarn[0] == 'W') sqlprint(); *** 246,251 **** --- 246,256 ---- if (sqlca.sqlcode < 0) sqlprint();} #line 64 "autoprep.pgc" + } + + int main() { + test(); + test(); /* retry */ return 0; } diff -cprN head/src/interfaces/ecpg/test/expected/preproc-autoprep.stderr work/src/interfaces/ecpg/test/expected/preproc-autoprep.stderr *** head/src/interfaces/ecpg/test/expected/preproc-autoprep.stderr Thu Dec 17 09:42:41 2009 --- work/src/interfaces/ecpg/test/expected/preproc-autoprep.stderr Tue Jan 19 14:05:14 2010 *************** *** 158,160 **** --- 158,320 ---- [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_finish: connection regress1 closed [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ECPGdebug: set to 1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ECPGconnect: opening database regress1 on port + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 21: query: create table T ( Item1 int , Item2 int ); with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 21: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 21: OK: CREATE TABLE + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_auto_prepare on line 23: statement found in cache; entry 15328 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ECPGprepare on line 23: name ecpg1; query: "insert into T values ( 1 , null )" + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 23: query: insert into T values ( 1 , null ); with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 23: using PQexecPrepared for "insert into T values ( 1 , null )" + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 23: OK: INSERT 0 1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_auto_prepare on line 24: statement found in cache; entry 1640 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ECPGprepare on line 24: name ecpg2; query: "insert into T values ( 1 , $1 )" + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 24: query: insert into T values ( 1 , $1 ); with 1 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 24: using PQexecPrepared for "insert into T values ( 1 , $1 )" + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: free_params on line 24: parameter 1 = 1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 24: OK: INSERT 0 1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_auto_prepare on line 26: statement found in cache; entry 1640 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 26: query: insert into T values ( 1 , $1 ); with 1 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 26: using PQexecPrepared for "insert into T values ( 1 , $1 )" + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: free_params on line 26: parameter 1 = 2 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 26: OK: INSERT 0 1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ECPGprepare on line 27: name i; query: " insert into T values ( 1 , 2 ) " + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 28: query: insert into T values ( 1 , 2 ) ; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 28: using PQexecPrepared for " insert into T values ( 1 , 2 ) " + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 28: OK: INSERT 0 1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_auto_prepare on line 30: statement found in cache; entry 13056 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ECPGprepare on line 30: name ecpg3; query: "select Item2 from T order by Item2 nulls last" + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 30: query: select Item2 from T order by Item2 nulls last; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 30: using PQexecPrepared for "select Item2 from T order by Item2 nulls last" + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 30: correctly got 4 tuples with 1 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 30: RESULT: 1 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 30: RESULT: 2 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 30: RESULT: 2 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 30: RESULT: offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 37: query: declare C cursor for select Item1 from T; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 37: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 37: OK: DECLARE CURSOR + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 39: query: fetch 1 in C; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 39: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 39: correctly got 1 tuples with 1 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 39: RESULT: 1 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 42: query: close C; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 42: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 42: OK: CLOSE CURSOR + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ECPGprepare on line 44: name stmt1; query: "SELECT item2 FROM T ORDER BY item2 NULLS LAST" + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 48: query: declare cur1 cursor for SELECT item2 FROM T ORDER BY item2 NULLS LAST; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 48: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 48: OK: DECLARE CURSOR + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 55: query: fetch cur1; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 55: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 55: correctly got 1 tuples with 1 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 55: RESULT: 1 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 55: query: fetch cur1; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 55: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 55: correctly got 1 tuples with 1 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 55: RESULT: 2 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 55: query: fetch cur1; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 55: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 55: correctly got 1 tuples with 1 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 55: RESULT: 2 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 55: query: fetch cur1; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 55: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 55: correctly got 1 tuples with 1 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 55: RESULT: offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 55: query: fetch cur1; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 55: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 55: correctly got 0 tuples with 1 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: raising sqlcode 100 on line 55: no data found on line 55 + [NO_PID]: sqlca: code: 100, state: 02000 + [NO_PID]: ecpg_execute on line 60: query: close cur1; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 60: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 60: OK: CLOSE CURSOR + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 62: query: drop table T; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 62: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 62: OK: DROP TABLE + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ECPGdeallocate on line 0: name stmt1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ECPGdeallocate on line 0: name ecpg3 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ECPGdeallocate on line 0: name i + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ECPGdeallocate on line 0: name ecpg2 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ECPGdeallocate on line 0: name ecpg1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_finish: connection regress1 closed + [NO_PID]: sqlca: code: 0, state: 00000 diff -cprN head/src/interfaces/ecpg/test/expected/preproc-autoprep.stdout work/src/interfaces/ecpg/test/expected/preproc-autoprep.stdout *** head/src/interfaces/ecpg/test/expected/preproc-autoprep.stdout Thu Dec 17 09:42:41 2009 --- work/src/interfaces/ecpg/test/expected/preproc-autoprep.stdout Tue Jan 19 13:42:37 2010 *************** item[0] = 1 *** 7,9 **** --- 7,18 ---- item[1] = 2 item[2] = 2 item[3] = -1 + item[0] = 1 + item[1] = 2 + item[2] = 2 + item[3] = -1 + i = 1 + item[0] = 1 + item[1] = 2 + item[2] = 2 + item[3] = -1 diff -cprN head/src/interfaces/ecpg/test/preproc/autoprep.pgc work/src/interfaces/ecpg/test/preproc/autoprep.pgc *** head/src/interfaces/ecpg/test/preproc/autoprep.pgc Thu Dec 17 09:42:41 2009 --- work/src/interfaces/ecpg/test/preproc/autoprep.pgc Tue Jan 19 13:35:21 2010 *************** *** 5,11 **** /* test automatic prepare for all statements */ EXEC SQL INCLUDE ../regression; ! int main() { EXEC SQL BEGIN DECLARE SECTION; int item[4], ind[4], i = 1; int item1, ind1; --- 5,11 ---- /* test automatic prepare for all statements */ EXEC SQL INCLUDE ../regression; ! void test(void) { EXEC SQL BEGIN DECLARE SECTION; int item[4], ind[4], i = 1; int item1, ind1; *************** int main() { *** 62,67 **** --- 62,72 ---- EXEC SQL DROP TABLE T; EXEC SQL DISCONNECT ALL; + } + + int main() { + test(); + test(); /* retry */ return 0; }