1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

ECPG only copied #include statements instead of processing them according to

commandline option "-i". This change fixes this and adds a test case. It also
honors #include_next, although this is probably never used for embedded SQL.
This commit is contained in:
Michael Meskes
2010-03-21 10:49:52 +00:00
parent 6ad4249b5c
commit 1d66a1cca1
10 changed files with 74 additions and 45 deletions

View File

@ -1,6 +1,6 @@
#include "sqltypes.h"
#include <stdlib.h>
#
$include ../regression;
$define NUMBER 12;

View File

@ -1,6 +1,6 @@
#include "sqltypes.h"
#include <stdlib.h>
#
$include ../regression;
$define NUMBER 12;

View File

@ -11,7 +11,7 @@
#line 1 "rnull.pgc"
#include "sqltypes.h"
#include <stdlib.h>
#
#line 1 "regression.h"

View File

@ -11,7 +11,7 @@
#line 1 "test_informix.pgc"
#include "sqltypes.h"
#include <stdlib.h>
#
#line 1 "regression.h"

View File

@ -7,8 +7,6 @@
#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
#line 1 "strings.pgc"
#include <stdlib.h>
#line 1 "regression.h"
@ -18,15 +16,16 @@
#line 3 "strings.pgc"
/* exec sql begin declare section */
#line 1 "strings.h"
#line 6 "strings.pgc"
#line 5 "strings.pgc"
#line 1 "strings.h"
char * s1 , * s2 , * s3 , * s4 , * s5 , * s6 ;
/* exec sql end declare section */
#line 7 "strings.pgc"
#line 5 "strings.pgc"
int main(void)
@ -34,11 +33,11 @@ int main(void)
ECPGdebug(1, stderr);
{ ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); }
#line 13 "strings.pgc"
#line 11 "strings.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set standard_conforming_strings to on", ECPGt_EOIT, ECPGt_EORT);}
#line 15 "strings.pgc"
#line 13 "strings.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select 'abcdef' , N'abcdef' as foo , E'abc\\bdef' as \"foo\" , U&'d\\0061t\\0061' as U&\"foo\" , U&'d!+000061t!+000061' uescape '!' , $foo$abc$def$foo$", ECPGt_EOIT,
@ -54,13 +53,13 @@ int main(void)
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,&(s6),(long)0,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 23 "strings.pgc"
#line 21 "strings.pgc"
printf("%s %s %s %s %s %s\n", s1, s2, s3, s4, s5, s6);
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 27 "strings.pgc"
#line 25 "strings.pgc"
exit (0);
return (0);
}

View File

@ -2,41 +2,41 @@
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 15: query: set standard_conforming_strings to on; with 0 parameter(s) on connection regress1
[NO_PID]: ecpg_execute on line 13: query: set standard_conforming_strings to on; with 0 parameter(s) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 13: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 13: OK: SET
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 15: query: select 'abcdef' , N'abcdef' as foo , E'abc\bdef' as "foo" , U&'d\0061t\0061' as U&"foo" , U&'d!+000061t!+000061' uescape '!' , $foo$abc$def$foo$; with 0 parameter(s) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 15: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 15: OK: SET
[NO_PID]: ecpg_execute on line 15: correctly got 1 tuples with 6 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 17: query: select 'abcdef' , N'abcdef' as foo , E'abc\bdef' as "foo" , U&'d\0061t\0061' as U&"foo" , U&'d!+000061t!+000061' uescape '!' , $foo$abc$def$foo$; with 0 parameter(s) on connection regress1
[NO_PID]: ecpg_store_result on line 15: allocating memory for 1 tuples
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 17: using PQexec
[NO_PID]: ecpg_get_data on line 15: RESULT: abcdef offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 17: correctly got 1 tuples with 6 fields
[NO_PID]: ecpg_store_result on line 15: allocating memory for 1 tuples
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_store_result on line 17: allocating memory for 1 tuples
[NO_PID]: ecpg_get_data on line 15: RESULT: abcdef offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 17: RESULT: abcdef offset: -1; array: no
[NO_PID]: ecpg_store_result on line 15: allocating memory for 1 tuples
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_store_result on line 17: allocating memory for 1 tuples
[NO_PID]: ecpg_get_data on line 15: RESULT: abcdef offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 17: RESULT: abcdef offset: -1; array: no
[NO_PID]: ecpg_store_result on line 15: allocating memory for 1 tuples
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_store_result on line 17: allocating memory for 1 tuples
[NO_PID]: ecpg_get_data on line 15: RESULT: data offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 17: RESULT: abcdef offset: -1; array: no
[NO_PID]: ecpg_store_result on line 15: allocating memory for 1 tuples
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_store_result on line 17: allocating memory for 1 tuples
[NO_PID]: ecpg_get_data on line 15: RESULT: data offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 17: RESULT: data offset: -1; array: no
[NO_PID]: ecpg_store_result on line 15: allocating memory for 1 tuples
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_store_result on line 17: allocating memory for 1 tuples
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 17: RESULT: data offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_store_result on line 17: allocating memory for 1 tuples
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 17: RESULT: abc$def offset: -1; array: no
[NO_PID]: ecpg_get_data on line 15: RESULT: abc$def offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: connection regress1 closed
[NO_PID]: sqlca: code: 0, state: 00000

View File

@ -24,3 +24,5 @@ array_of_struct.c: array_of_struct.pgc ../regression.h
autoprep.c: autoprep.pgc ../regression.h
$(ECPG) -r prepare -o $@ -I$(srcdir) $<
strings.c: strings.pgc strings.h ../regression.h
$(ECPG) -i -o $@ -I$(srcdir) $<

View File

@ -0,0 +1 @@
char *s1, *s2, *s3, *s4, *s5, *s6;

View File

@ -1,9 +1,7 @@
#include <stdlib.h>
exec sql include ../regression;
#include "../regression.h"
exec sql begin declare section;
char *s1, *s2, *s3, *s4, *s5, *s6;
#include "strings.h"
exec sql end declare section;
int main(void)
@ -25,5 +23,5 @@ int main(void)
printf("%s %s %s %s %s %s\n", s1, s2, s3, s4, s5, s6);
exec sql disconnect;
exit (0);
return (0);
}