]> granicus.if.org Git - postgresql/commitdiff
Removed superfluous return statement in get_data.
authorMichael Meskes <meskes@postgresql.org>
Fri, 19 Sep 2003 14:06:21 +0000 (14:06 +0000)
committerMichael Meskes <meskes@postgresql.org>
Fri, 19 Sep 2003 14:06:21 +0000 (14:06 +0000)
src/interfaces/ecpg/compatlib/informix.c
src/interfaces/ecpg/ecpglib/data.c
src/interfaces/ecpg/include/datetime.h
src/interfaces/ecpg/include/decimal.h
src/interfaces/ecpg/include/ecpg_informix.h
src/interfaces/ecpg/include/pgtypes_date.h
src/interfaces/ecpg/preproc/preproc.y

index 9c4f41bde39358bbb95a597e94d90c31c815882d..739b83a895c6041c141f349ad90a3a8412af2a53 100644 (file)
@@ -161,11 +161,9 @@ deccvasc(char *cp, int len, decimal * np)
        int                     ret = 0;
        numeric    *result;
 
+       rsetnull(CDECIMALTYPE, (char *) np);
        if (risnull(CSTRINGTYPE, cp))
-       {
-               rsetnull(CDECIMALTYPE, (char *) np);
                return 0;
-       }
 
        if (!str)
                ret = -1201;
@@ -206,11 +204,9 @@ deccvdbl(double dbl, decimal * np)
        numeric    *nres = PGTYPESnumeric_new();
        int                     result = 1;
 
+       rsetnull(CDECIMALTYPE, (char *) np);
        if (risnull(CDOUBLETYPE, (char *) &dbl))
-       {
-               rsetnull(CDECIMALTYPE, (char *) np);
                return 0;
-       }
 
        if (nres == NULL)
                return -1211;
@@ -229,11 +225,9 @@ deccvint(int in, decimal * np)
        numeric    *nres = PGTYPESnumeric_new();
        int                     result = 1;
 
+       rsetnull(CDECIMALTYPE, (char *) np);
        if (risnull(CINTTYPE, (char *) &in))
-       {
-               rsetnull(CDECIMALTYPE, (char *) np);
                return 0;
-       }
 
        if (nres == NULL)
                return -1211;
@@ -252,11 +246,9 @@ deccvlong(long lng, decimal * np)
        numeric    *nres = PGTYPESnumeric_new();
        int                     result = 1;
 
+       rsetnull(CDECIMALTYPE, (char *) np);
        if (risnull(CLONGTYPE, (char *) &lng))
-       {
-               rsetnull(CDECIMALTYPE, (char *) np);
                return 0;
-       }
 
        if (nres == NULL)
                return -1211;
@@ -338,11 +330,9 @@ dectoasc(decimal * np, char *cp, int len, int right)
        if (nres == NULL)
                return -1211;
 
+       rsetnull(CSTRINGTYPE, (char *) cp);
        if (risnull(CDECIMALTYPE, (char *) np))
-       {
-               rsetnull(CSTRINGTYPE, (char *) cp);
                return 0;
-       }
 
        if (PGTYPESnumeric_from_decimal(np, nres) != 0)
                return -1211;
index dfe6e6e6e5e77ef176b304b2e65df650aad2be07..8be86b0bc2d897134a44737220ad5e629687e719 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.18 2003/09/18 13:12:23 meskes Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.19 2003/09/19 14:06:21 meskes Exp $ */
 
 #define POSTGRES_ECPG_INTERNAL
 #include "postgres_fe.h"
@@ -397,7 +397,6 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                                                {
                                                        /* Informix wants its own NULL value here instead of an error */
                                                        ECPGset_informix_null(ECPGt_numeric, &nres);
-                                                       return (true);
                                                }
                                                else
                                                {
@@ -405,14 +404,17 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                                                        return (false);
                                                }
                                        }
-                                       if (isarray && *scan_length == '"')
-                                               scan_length++;
-
-                                       if ((isarray && *scan_length != ',' && *scan_length != '}')
-                                               || (!isarray && *scan_length != '\0' && *scan_length != ' '))   /* Garbage left */
+                                       else
                                        {
-                                               ECPGraise(lineno, ECPG_NUMERIC_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
-                                               return (false);
+                                               if (isarray && *scan_length == '"')
+                                                       scan_length++;
+
+                                               if ((isarray && *scan_length != ',' && *scan_length != '}')
+                                                       || (!isarray && *scan_length != '\0' && *scan_length != ' '))   /* Garbage left */
+                                               {
+                                                       ECPGraise(lineno, ECPG_NUMERIC_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
+                                                       return (false);
+                                               }
                                        }
                                }
                                else
@@ -439,7 +441,6 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                                                {
                                                        /* Informix wants its own NULL value here instead of an error */
                                                        ECPGset_informix_null(ECPGt_interval, &ires);
-                                                       return (true);
                                                }
                                                else
                                                {
@@ -447,14 +448,17 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                                                        return (false);
                                                }
                                        }
-                                       if (isarray && *scan_length == '"')
-                                               scan_length++;
-
-                                       if ((isarray && *scan_length != ',' && *scan_length != '}')
-                                               || (!isarray && *scan_length != '\0' && *scan_length != ' '))   /* Garbage left */
+                                       else
                                        {
-                                               ECPGraise(lineno, ECPG_INTERVAL_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
-                                               return (false);
+                                               if (isarray && *scan_length == '"')
+                                                       scan_length++;
+
+                                               if ((isarray && *scan_length != ',' && *scan_length != '}')
+                                                       || (!isarray && *scan_length != '\0' && *scan_length != ' '))   /* Garbage left */
+                                               {
+                                                       ECPGraise(lineno, ECPG_INTERVAL_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
+                                                       return (false);
+                                               }
                                        }
                                }
                                else
@@ -477,7 +481,6 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                                                {
                                                        /* Informix wants its own NULL value here instead of an error */
                                                        ECPGset_informix_null(ECPGt_date, &ddres);
-                                                       return (true);
                                                }
                                                else
                                                {
@@ -485,15 +488,17 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                                                        return (false);
                                                }
                                        }
-                                       
-                                       if (isarray && *scan_length == '"')
-                                               scan_length++;
-
-                                       if ((isarray && *scan_length != ',' && *scan_length != '}')
-                                               || (!isarray && *scan_length != '\0' && *scan_length != ' '))   /* Garbage left */
+                                       else
                                        {
-                                               ECPGraise(lineno, ECPG_DATE_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
-                                               return (false);
+                                               if (isarray && *scan_length == '"')
+                                                       scan_length++;
+
+                                               if ((isarray && *scan_length != ',' && *scan_length != '}')
+                                                       || (!isarray && *scan_length != '\0' && *scan_length != ' '))   /* Garbage left */
+                                               {
+                                                       ECPGraise(lineno, ECPG_DATE_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
+                                                       return (false);
+                                               }
                                        }
 
                                        *((date *) (var + offset * act_tuple)) = ddres;
@@ -515,7 +520,6 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                                                {
                                                        /* Informix wants its own NULL value here instead of an error */
                                                        ECPGset_informix_null(ECPGt_timestamp, &tres);
-                                                       return (true);
                                                }
                                                else
                                                {
@@ -523,14 +527,17 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                                                        return (false);
                                                }
                                        }
-                                       if (isarray && *scan_length == '"')
-                                               scan_length++;
-
-                                       if ((isarray && *scan_length != ',' && *scan_length != '}')
-                                               || (!isarray && *scan_length != '\0' && *scan_length != ' '))   /* Garbage left */
+                                       else
                                        {
-                                               ECPGraise(lineno, ECPG_TIMESTAMP_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
-                                               return (false);
+                                               if (isarray && *scan_length == '"')
+                                                       scan_length++;
+
+                                               if ((isarray && *scan_length != ',' && *scan_length != '}')
+                                                       || (!isarray && *scan_length != '\0' && *scan_length != ' '))   /* Garbage left */
+                                               {
+                                                       ECPGraise(lineno, ECPG_TIMESTAMP_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
+                                                       return (false);
+                                               }
                                        }
 
                                        *((timestamp *) (var + offset * act_tuple)) = tres;
index db765cac23cf8e62e362d355380c5d485f203316..4e0773efad07090dd6e9f744cc0961e88c21fc91 100644 (file)
@@ -1,13 +1,8 @@
 #include <pgtypes_timestamp.h>
 #include <pgtypes_interval.h>
 
-#ifndef dtime_t
-#define dtime_t timestamp
-#endif   /* dtime_t */
-
-#ifndef intrvl_t
-#define intrvl_t interval
-#endif   /* intrvl_t */
+typedef timestamp dtime_t;
+typedef interval intrvl_t;
 
 extern void dtcurrent(dtime_t *);
 extern int     dtcvasc(char *, dtime_t *);
index 2531be38ef6874650abf31fd5d77b1374727a457..c1f724fbd293f95925382c86e4af799f7f7c621a 100644 (file)
@@ -1,8 +1,6 @@
 #include <pgtypes_numeric.h>
 
-#ifndef dec_t
-#define dec_t decimal
-#endif   /* dec_t */
+typedef decimal dec_t;
 
 int                    decadd(dec_t *, dec_t *, dec_t *);
 int                    deccmp(dec_t *, dec_t *);
index 1b71735e79d71bd15216e51434b4a40fb763ab06..b7a57fab3b59f15b1c448eade9e1abf281453a33 100644 (file)
@@ -5,15 +5,12 @@
 #include <decimal.h>
 #include <datetime.h>
 #include <ecpglib.h>
+#include <pgtypes_date.h>
 
 #define SQLNOTFOUND 100
 
-#ifndef date
-#define date long
-#endif   /* ! date */
-
 extern int     rdatestr(date, char *);
-extern void rtoday(date *);
+extern void    rtoday(date *);
 extern int     rjulmdy(date, short *);
 extern int     rdefmtdate(date *, char *, char *);
 extern int     rfmtdate(date, char *, char *);
index 99fa9a8504f77e526a698798027f524d3cbf71f4..863b2593d9e024b1220c6fde8ac8e30e659c4de4 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <pgtypes_timestamp.h>
 
-#define date long
+typedef long date;
 
 extern date PGTYPESdate_from_asc(char *, char **);
 extern char *PGTYPESdate_to_asc(date);
index 9ceff4e2e411af96eea3e937be50a59b4ae349d0..ef5d6edc4cf74db69a26dbb12d4e3b55f13764d5 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.255 2003/09/18 13:12:23 meskes Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.256 2003/09/19 14:06:21 meskes Exp $ */
 
 /* Copyright comment */
 %{
@@ -209,7 +209,6 @@ adjust_informix(struct arguments *list)
                original_var = ptr->variable->name;
                sprintf(temp, "%d))", ecpg_informix_var);
                
-               /* create call to "ECPG_informix_set_var(<counter>, <pointer>. <linen number>)" */
                if (atoi(ptr->variable->type->size) > 1)
                {
                        ptr->variable = new_variable(cat_str(4, make_str("("), mm_strdup(ECPGtype_name(ptr->variable->type->type)), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->variable->type->type, ptr->variable->type->size), 0);
@@ -220,6 +219,8 @@ adjust_informix(struct arguments *list)
                        ptr->variable = new_variable(cat_str(4, make_str("*("), mm_strdup(ECPGtype_name(ptr->variable->type->type)), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->variable->type->type, ptr->variable->type->size), 0);
                        sprintf(temp, "%d, &(", ecpg_informix_var++);
                }
+               
+               /* create call to "ECPG_informix_set_var(<counter>, <pointer>. <linen number>)" */
                result = cat_str(5, result, make_str("ECPG_informix_set_var("), mm_strdup(temp), mm_strdup(original_var), make_str("), __LINE__);\n"));
                
                /* now the indicator if there is one */