Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd6fbb10

Browse files
author
Michael Meskes
committed
Fix ecpg to allow pointer to structs.
1 parent03a321d commitd6fbb10

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

‎src/interfaces/ecpg/ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,5 +1166,9 @@ Thu Dec 6 14:02:56 CET 2001
11661166

11671167
- Removed debug message from preproc.y.
11681168
- Fixed some bugs in exec sql var and exec sql type command.
1169+
1170+
Sat Dec 8 21:35:45 CET 2001
1171+
1172+
- Fix ecpg to allow pointer to structs.
11691173
- Set ecpg version to 2.9.0.
11701174
- Set library version to 3.3.0.

‎src/interfaces/ecpg/preproc/type.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ ECPGdump_a_struct(FILE *o, const char *name, const char *ind_name, long arrsiz,
361361
structECPGstruct_member*p,
362362
*ind_p=NULL;
363363
charobuf[BUFSIZ];
364-
charpbuf[BUFSIZ],
364+
charpbuf[BUFSIZ*2],
365365
ind_pbuf[BUFSIZ];
366366
constchar*offset;
367367

@@ -373,7 +373,11 @@ ECPGdump_a_struct(FILE *o, const char *name, const char *ind_name, long arrsiz,
373373
else
374374
offset=offsetarg;
375375

376-
sprintf(pbuf,"%s%s.",prefix ?prefix :"",name);
376+
if (arrsiz!=0)
377+
sprintf(pbuf,"%s%s.",prefix ?prefix :"",name);
378+
else
379+
sprintf(pbuf,"%s%s->",prefix ?prefix :"",name);
380+
377381
prefix=pbuf;
378382

379383
if (ind_typ==&ecpg_no_indicator)
@@ -382,7 +386,11 @@ ECPGdump_a_struct(FILE *o, const char *name, const char *ind_name, long arrsiz,
382386
}
383387
elseif (ind_typ!=NULL)
384388
{
385-
sprintf(ind_pbuf,"%s%s.",ind_prefix ?ind_prefix :"",ind_name);
389+
if (arrsiz!=0)
390+
sprintf(ind_pbuf,"%s%s.",ind_prefix ?ind_prefix :"",ind_name);
391+
else
392+
sprintf(ind_pbuf,"%s%s->",ind_prefix ?ind_prefix :"",ind_name);
393+
386394
ind_prefix=ind_pbuf;
387395
ind_p=ind_typ->u.members;
388396
}

‎src/interfaces/ecpg/test/test2.pgc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ main ()
1919
exec sql begin declare section;
2020
struct personal_struct{str name;
2121
birthinfo birth;
22-
} personal;
22+
} personal, *p;
2323
struct personal_indicator {int ind_name;
2424
birthinfo ind_birth;
25-
} ind_personal;
25+
} ind_personal, *i;
2626
float ind_married;
2727
ind children;
2828
ind ind_children;
@@ -63,9 +63,11 @@ exec sql end declare section;
6363

6464
exec sql whenever not found do break;
6565

66+
p=&personal;
67+
i=&ind_personal;
6668
while (1) {
6769
strcpy(msg, "fetch");
68-
exec sql fetch cur into :personal:ind_personal, :married:ind_married, :children.integer:ind_children.smallint;
70+
exec sql fetch cur into :p:i, :married:ind_married, :children.integer:ind_children.smallint;
6971
printf("%8.8s", personal.name.arr);
7072
if (ind_personal.ind_birth.born >= 0)
7173
printf(", born %ld", personal.birth.born);
@@ -125,6 +127,5 @@ exec sql end declare section;
125127
if (dbgs != NULL)
126128
fclose(dbgs);
127129

128-
129130
return (0);
130131
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp