diff options
Diffstat (limited to '')
6 files changed, 132 insertions, 2 deletions
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-intoasc.c b/src/interfaces/ecpg/test/expected/compat_informix-intoasc.c new file mode 100644 index 0000000..3098880 --- /dev/null +++ b/src/interfaces/ecpg/test/expected/compat_informix-intoasc.c @@ -0,0 +1,40 @@ +/* Processed by ecpg (regression mode) */ +/* These include files are added by the preprocessor */ +#include <ecpglib.h> +#include <ecpgerrno.h> +#include <sqlca.h> +/* Needed for informix compatibility */ +#include <ecpg_informix.h> +/* End of automatic include section */ +#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y)) + +#line 1 "intoasc.pgc" +#include <stdio.h> +#include <stdlib.h> + +#include "pgtypes_interval.h" + +/* exec sql begin declare section */ + + + +#line 7 "intoasc.pgc" + char dirty_str [ 100 ] = "aaaaaaaaa_bbbbbbbb_ccccccccc_ddddddddd_" ; + +#line 8 "intoasc.pgc" + interval * interval_ptr ; +/* exec sql end declare section */ +#line 9 "intoasc.pgc" + + +int main() +{ + interval_ptr = (interval *) malloc(sizeof(interval)); + interval_ptr->time = 100000000; + interval_ptr->month = 240; + + printf("dirty_str contents before intoasc: %s\n", dirty_str); + intoasc(interval_ptr, dirty_str); + printf("dirty_str contents after intoasc: %s\n", dirty_str); + return 0; +} diff --git a/src/interfaces/ecpg/test/expected/compat_informix-intoasc.stderr b/src/interfaces/ecpg/test/expected/compat_informix-intoasc.stderr new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/interfaces/ecpg/test/expected/compat_informix-intoasc.stderr diff --git a/src/interfaces/ecpg/test/expected/compat_informix-intoasc.stdout b/src/interfaces/ecpg/test/expected/compat_informix-intoasc.stdout new file mode 100644 index 0000000..0769465 --- /dev/null +++ b/src/interfaces/ecpg/test/expected/compat_informix-intoasc.stdout @@ -0,0 +1,2 @@ +dirty_str contents before intoasc: aaaaaaaaa_bbbbbbbb_ccccccccc_ddddddddd_ +dirty_str contents after intoasc: @ 20 years 1 min 40 secs diff --git a/src/interfaces/ecpg/test/expected/sql-define.c b/src/interfaces/ecpg/test/expected/sql-define.c index 29583ec..e97caec 100644 --- a/src/interfaces/ecpg/test/expected/sql-define.c +++ b/src/interfaces/ecpg/test/expected/sql-define.c @@ -6,6 +6,21 @@ /* End of automatic include section */ #define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y)) +#line 1 "define_prelim.pgc" +/* + * Test that the effects of these commands don't carry over to the next + * file named on the ecpg command line. + */ + + +/* Processed by ecpg (regression mode) */ +/* These include files are added by the preprocessor */ +#include <ecpglib.h> +#include <ecpgerrno.h> +#include <sqlca.h> +/* End of automatic include section */ +#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y)) + #line 1 "define.pgc" #line 1 "sqlca.h" @@ -195,11 +210,57 @@ if (sqlca.sqlcode < 0) sqlprint ( );} + /* test handling of a macro defined on the command line */ + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select 123", ECPGt_EOIT, + ECPGt_int,&(i),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT); +#line 57 "define.pgc" + +if (sqlca.sqlcode < 0) sqlprint ( );} +#line 57 "define.pgc" + + printf("original CMDLINESYM: %d\n", i); + + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select 42", ECPGt_EOIT, + ECPGt_int,&(i),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT); +#line 62 "define.pgc" + +if (sqlca.sqlcode < 0) sqlprint ( );} +#line 62 "define.pgc" + + printf("redefined CMDLINESYM: %d\n", i); + + + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select 43", ECPGt_EOIT, + ECPGt_int,&(i),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT); +#line 67 "define.pgc" + +if (sqlca.sqlcode < 0) sqlprint ( );} +#line 67 "define.pgc" + + printf("redefined CMDLINESYM: %d\n", i); + + + + + + + + /* this macro should not have carried over from define_prelim.pgc */ + + + + { ECPGdisconnect(__LINE__, "CURRENT"); -#line 56 "define.pgc" +#line 81 "define.pgc" if (sqlca.sqlcode < 0) sqlprint ( );} -#line 56 "define.pgc" +#line 81 "define.pgc" return 0; } diff --git a/src/interfaces/ecpg/test/expected/sql-define.stderr b/src/interfaces/ecpg/test/expected/sql-define.stderr index 20601b6..c4da992 100644 --- a/src/interfaces/ecpg/test/expected/sql-define.stderr +++ b/src/interfaces/ecpg/test/expected/sql-define.stderr @@ -48,5 +48,29 @@ [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_process_output on line 53: OK: SET [NO_PID]: sqlca: code: 0, state: 00000 +[NO_PID]: ecpg_execute on line 57: query: select 123; with 0 parameter(s) on connection ecpg1_regression +[NO_PID]: sqlca: code: 0, state: 00000 +[NO_PID]: ecpg_execute on line 57: using PQexec +[NO_PID]: sqlca: code: 0, state: 00000 +[NO_PID]: ecpg_process_output on line 57: correctly got 1 tuples with 1 fields +[NO_PID]: sqlca: code: 0, state: 00000 +[NO_PID]: ecpg_get_data on line 57: RESULT: 123 offset: -1; array: no +[NO_PID]: sqlca: code: 0, state: 00000 +[NO_PID]: ecpg_execute on line 62: query: select 42; with 0 parameter(s) on connection ecpg1_regression +[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_process_output on line 62: correctly got 1 tuples with 1 fields +[NO_PID]: sqlca: code: 0, state: 00000 +[NO_PID]: ecpg_get_data on line 62: RESULT: 42 offset: -1; array: no +[NO_PID]: sqlca: code: 0, state: 00000 +[NO_PID]: ecpg_execute on line 67: query: select 43; with 0 parameter(s) on connection ecpg1_regression +[NO_PID]: sqlca: code: 0, state: 00000 +[NO_PID]: ecpg_execute on line 67: using PQexec +[NO_PID]: sqlca: code: 0, state: 00000 +[NO_PID]: ecpg_process_output on line 67: correctly got 1 tuples with 1 fields +[NO_PID]: sqlca: code: 0, state: 00000 +[NO_PID]: ecpg_get_data on line 67: RESULT: 43 offset: -1; array: no +[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_finish: connection ecpg1_regression closed [NO_PID]: sqlca: code: 0, state: 00000 diff --git a/src/interfaces/ecpg/test/expected/sql-define.stdout b/src/interfaces/ecpg/test/expected/sql-define.stdout index 864cd85..eaddc7f 100644 --- a/src/interfaces/ecpg/test/expected/sql-define.stdout +++ b/src/interfaces/ecpg/test/expected/sql-define.stdout @@ -1 +1,4 @@ i: 1, s: 29-abcdef +original CMDLINESYM: 123 +redefined CMDLINESYM: 42 +redefined CMDLINESYM: 43 |