Removed superfluous return statement in get_data.

This commit is contained in:
Michael Meskes 2003-09-19 14:06:21 +00:00
parent 689015748f
commit df974272ec
7 changed files with 55 additions and 67 deletions

View 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;

View 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;

View 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 *);

View 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 *);

View 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 *);

View 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);

View 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 */