1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-05 07:21:24 +03:00

*** empty log message ***

This commit is contained in:
Michael Meskes
1999-03-05 09:38:51 +00:00
parent 9db6b7f3f7
commit 03842eb03b
4 changed files with 44 additions and 43 deletions

View File

@ -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

View File

@ -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');