]> granicus.if.org Git - postgresql/commitdiff
Fixed dumping of structs without indicators.
authorMichael Meskes <meskes@postgresql.org>
Tue, 4 Dec 2001 12:33:15 +0000 (12:33 +0000)
committerMichael Meskes <meskes@postgresql.org>
Tue, 4 Dec 2001 12:33:15 +0000 (12:33 +0000)
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/preproc/type.c

index ffe622ef924413c5e96dca4375e8be2d05482430..c4250260b5bfe022e238b4a894633c75635d563b 100644 (file)
@@ -1150,5 +1150,9 @@ Fri Nov  2 16:16:25 CET 2001
 Wed Nov 14 11:50:27 CET 2001
 
        - Added several patches by Christof Petig <christof.petig@wtal.de>.
+
+Tue Dec  4 13:30:32 CET 2001
+
+       - Fixed dumping of structures without indicators.
        - Set ecpg version to 2.9.0.
         - Set library version to 3.3.0.
index 7efca2c37618f843db957d7d1c4a6b0202f792e9..0be9ef78157d6bd8425a656db1d93b254bc6049a 100644 (file)
@@ -2,6 +2,8 @@
 
 #include "extern.h"
 
+struct ECPGstruct_member struct_no_indicator = {"no_indicator", &ecpg_no_indicator, NULL};
+
 /* malloc + error check */
 void *
 mm_alloc(size_t size)
@@ -374,15 +376,21 @@ ECPGdump_a_struct(FILE *o, const char *name, const char *ind_name, long arrsiz,
        sprintf(pbuf, "%s%s.", prefix ? prefix : "", name);
        prefix = pbuf;
 
-       sprintf(ind_pbuf, "%s%s.", ind_prefix ? ind_prefix : "", ind_name);
-       ind_prefix = ind_pbuf;
-
-       if (ind_typ != NULL)
+       if (ind_typ == &ecpg_no_indicator)
+       {
+               ind_p = &struct_no_indicator;
+       }
+       else if (ind_typ != NULL)
+       {
+               sprintf(ind_pbuf, "%s%s.", ind_prefix ? ind_prefix : "", ind_name);
+               ind_prefix = ind_pbuf;
                ind_p = ind_typ->u.members;
+       }
+       
        for (p = typ->u.members; p; p = p->next)
        {
                ECPGdump_a_type(o, p->name, p->typ, (ind_p != NULL) ? ind_p->name : NULL, (ind_p != NULL) ? ind_p->typ : NULL, prefix, ind_prefix);
-               if (ind_p != NULL)
+               if (ind_p != NULL && ind_p != &struct_no_indicator)
                        ind_p = ind_p->next;
        }
 }