diff options
| author | Michael Meskes <meskes@postgresql.org> | 1999-03-05 09:38:51 +0000 |
|---|---|---|
| committer | Michael Meskes <meskes@postgresql.org> | 1999-03-05 09:38:51 +0000 |
| commit | 03842eb03bbded18a55177e40594018f05a73623 (patch) | |
| tree | 05ed70e66d40ac6495f30edb4a10b6a6a47dceba /src/interfaces/ecpg/test | |
| parent | 9db6b7f3f7919895135e64cf52afcc1c7e264c09 (diff) | |
| download | postgresql-03842eb03bbded18a55177e40594018f05a73623.tar.gz | |
*** empty log message ***
Diffstat (limited to 'src/interfaces/ecpg/test')
| -rw-r--r-- | src/interfaces/ecpg/test/Makefile | 8 | ||||
| -rw-r--r-- | src/interfaces/ecpg/test/test2.pgc | 14 |
2 files changed, 14 insertions, 8 deletions
diff --git a/src/interfaces/ecpg/test/Makefile b/src/interfaces/ecpg/test/Makefile index 2c4ba01ee0..23bda07a3b 100644 --- a/src/interfaces/ecpg/test/Makefile +++ b/src/interfaces/ecpg/test/Makefile @@ -1,4 +1,4 @@ -all: test1 test2 perftest +all: test1 test2 test3 perftest LDFLAGS=-g -I /usr/local/pgsql/include -L/usr/local/pgsql/lib -lecpg -lpq -lcrypt @@ -10,9 +10,13 @@ test2: test2.c test2.c: test2.pgc /usr/local/pgsql/bin/ecpg $? +test3: test3.c +test3.c: test3.pgc + /usr/local/pgsql/bin/ecpg $? + perftest: perftest.c perftest.c:perftest.pgc /usr/local/pgsql/bin/ecpg $? clean: - -/bin/rm test1 test2 perftest *.c log + -/bin/rm test1 test2 test3 perftest *.c log diff --git a/src/interfaces/ecpg/test/test2.pgc b/src/interfaces/ecpg/test/test2.pgc index f50a9d5100..3853b8c33e 100644 --- a/src/interfaces/ecpg/test/test2.pgc +++ b/src/interfaces/ecpg/test/test2.pgc @@ -8,19 +8,21 @@ typedef char* c; exec sql type ind is union { int integer; short smallint; }; typedef union { int integer; short smallint; } ind; +exec sql type str is varchar[8]; + int main () { typedef struct { long born; short age; } birthinfo; exec sql type birthinfo is struct { long born; short age; }; exec sql begin declare section; - struct personal_struct { varchar name[8]; + struct personal_struct { str name; birthinfo birth; } personal; struct personal_indicator { int ind_name; birthinfo ind_birth; } ind_personal; - int ind_married; + float ind_married; ind children; ind ind_children; char *married = NULL; @@ -68,8 +70,8 @@ exec sql end declare section; printf(", born %d", personal.birth.born); if (ind_personal.ind_birth.age >= 0) printf(", age = %d", personal.birth.age); - if (ind_married >= 0) - printf(", married %10.10s", married); + if ((long)ind_married >= 0) + printf(", married %s", married); if (ind_children.smallint >= 0) printf(", children = %d", children.integer); putchar('\n'); @@ -98,8 +100,8 @@ exec sql end declare section; printf(", born %d", personal.birth.born); if (ind_personal.ind_birth.age >= 0) printf(", age = %d", personal.birth.age); - if (ind_married >= 0) - printf(", married %10.10s", married); + if ((long)ind_married >= 0) + printf(", married %s", married); if (ind_children.smallint >= 0) printf(", children = %d", children.integer); putchar('\n'); |
