mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
ecpg now recognizes named structs/unions. So you don't have to list the whole definition everytime you declare a variable anymore.
This commit is contained in:
@ -126,7 +126,7 @@ exec sql end declare section;
|
||||
amount[i]+=1000;
|
||||
|
||||
strcpy(msg, "insert");
|
||||
exec sql at pm insert into "Test" (name, amount, letter) values (:n, :a, :l);
|
||||
exec sql at pm insert into "Test" (name, amount, letter) values (:n, :a, :l);
|
||||
}
|
||||
|
||||
strcpy(msg, "commit");
|
||||
|
@ -9,20 +9,19 @@ typedef char* c;
|
||||
exec sql type ind is union { int integer; short smallint; };
|
||||
typedef union { int integer; short smallint; } ind;
|
||||
|
||||
#define BUFSIZ 8
|
||||
exec sql type str is varchar[BUFSIZ];
|
||||
#define BUFFERSIZ 8
|
||||
exec sql type str is varchar[BUFFERSIZ];
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
typedef struct { long born; short age; } birthinfo;
|
||||
exec sql type birthinfo is struct { long born; short age; };
|
||||
exec sql struct birthinfo { long born; short age; };
|
||||
exec sql begin declare section;
|
||||
struct personal_struct { str name;
|
||||
birthinfo birth;
|
||||
struct birthinfo birth;
|
||||
} personal, *p;
|
||||
struct personal_indicator { int ind_name;
|
||||
birthinfo ind_birth;
|
||||
struct birthinfo ind_birth;
|
||||
} ind_personal, *i;
|
||||
ind ind_children;
|
||||
c testname="Petra";
|
||||
|
Reference in New Issue
Block a user