Commit df974272 authored by Michael Meskes's avatar Michael Meskes

Removed superfluous return statement in get_data.

parent 68901574
...@@ -161,11 +161,9 @@ deccvasc(char *cp, int len, decimal * np) ...@@ -161,11 +161,9 @@ deccvasc(char *cp, int len, decimal * np)
int ret = 0; int ret = 0;
numeric *result; numeric *result;
rsetnull(CDECIMALTYPE, (char *) np);
if (risnull(CSTRINGTYPE, cp)) if (risnull(CSTRINGTYPE, cp))
{
rsetnull(CDECIMALTYPE, (char *) np);
return 0; return 0;
}
if (!str) if (!str)
ret = -1201; ret = -1201;
...@@ -206,11 +204,9 @@ deccvdbl(double dbl, decimal * np) ...@@ -206,11 +204,9 @@ deccvdbl(double dbl, decimal * np)
numeric *nres = PGTYPESnumeric_new(); numeric *nres = PGTYPESnumeric_new();
int result = 1; int result = 1;
rsetnull(CDECIMALTYPE, (char *) np);
if (risnull(CDOUBLETYPE, (char *) &dbl)) if (risnull(CDOUBLETYPE, (char *) &dbl))
{
rsetnull(CDECIMALTYPE, (char *) np);
return 0; return 0;
}
if (nres == NULL) if (nres == NULL)
return -1211; return -1211;
...@@ -229,11 +225,9 @@ deccvint(int in, decimal * np) ...@@ -229,11 +225,9 @@ deccvint(int in, decimal * np)
numeric *nres = PGTYPESnumeric_new(); numeric *nres = PGTYPESnumeric_new();
int result = 1; int result = 1;
rsetnull(CDECIMALTYPE, (char *) np);
if (risnull(CINTTYPE, (char *) &in)) if (risnull(CINTTYPE, (char *) &in))
{
rsetnull(CDECIMALTYPE, (char *) np);
return 0; return 0;
}
if (nres == NULL) if (nres == NULL)
return -1211; return -1211;
...@@ -252,11 +246,9 @@ deccvlong(long lng, decimal * np) ...@@ -252,11 +246,9 @@ deccvlong(long lng, decimal * np)
numeric *nres = PGTYPESnumeric_new(); numeric *nres = PGTYPESnumeric_new();
int result = 1; int result = 1;
rsetnull(CDECIMALTYPE, (char *) np);
if (risnull(CLONGTYPE, (char *) &lng)) if (risnull(CLONGTYPE, (char *) &lng))
{
rsetnull(CDECIMALTYPE, (char *) np);
return 0; return 0;
}
if (nres == NULL) if (nres == NULL)
return -1211; return -1211;
...@@ -338,11 +330,9 @@ dectoasc(decimal * np, char *cp, int len, int right) ...@@ -338,11 +330,9 @@ dectoasc(decimal * np, char *cp, int len, int right)
if (nres == NULL) if (nres == NULL)
return -1211; return -1211;
rsetnull(CSTRINGTYPE, (char *) cp);
if (risnull(CDECIMALTYPE, (char *) np)) if (risnull(CDECIMALTYPE, (char *) np))
{
rsetnull(CSTRINGTYPE, (char *) cp);
return 0; return 0;
}
if (PGTYPESnumeric_from_decimal(np, nres) != 0) if (PGTYPESnumeric_from_decimal(np, nres) != 0)
return -1211; return -1211;
......
/* $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 #define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h" #include "postgres_fe.h"
...@@ -397,7 +397,6 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -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 */ /* Informix wants its own NULL value here instead of an error */
ECPGset_informix_null(ECPGt_numeric, &nres); ECPGset_informix_null(ECPGt_numeric, &nres);
return (true);
} }
else else
{ {
...@@ -405,14 +404,17 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -405,14 +404,17 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
return (false); return (false);
} }
} }
if (isarray && *scan_length == '"') else
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); if (isarray && *scan_length == '"')
return (false); 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 else
...@@ -439,7 +441,6 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -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 */ /* Informix wants its own NULL value here instead of an error */
ECPGset_informix_null(ECPGt_interval, &ires); ECPGset_informix_null(ECPGt_interval, &ires);
return (true);
} }
else else
{ {
...@@ -447,14 +448,17 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -447,14 +448,17 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
return (false); return (false);
} }
} }
if (isarray && *scan_length == '"') else
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); if (isarray && *scan_length == '"')
return (false); 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 else
...@@ -477,7 +481,6 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -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 */ /* Informix wants its own NULL value here instead of an error */
ECPGset_informix_null(ECPGt_date, &ddres); ECPGset_informix_null(ECPGt_date, &ddres);
return (true);
} }
else else
{ {
...@@ -485,15 +488,17 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -485,15 +488,17 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
return (false); return (false);
} }
} }
else
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); if (isarray && *scan_length == '"')
return (false); 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; *((date *) (var + offset * act_tuple)) = ddres;
...@@ -515,7 +520,6 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -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 */ /* Informix wants its own NULL value here instead of an error */
ECPGset_informix_null(ECPGt_timestamp, &tres); ECPGset_informix_null(ECPGt_timestamp, &tres);
return (true);
} }
else else
{ {
...@@ -523,14 +527,17 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -523,14 +527,17 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
return (false); return (false);
} }
} }
if (isarray && *scan_length == '"') else
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); if (isarray && *scan_length == '"')
return (false); 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; *((timestamp *) (var + offset * act_tuple)) = tres;
......
#include <pgtypes_timestamp.h> #include <pgtypes_timestamp.h>
#include <pgtypes_interval.h> #include <pgtypes_interval.h>
#ifndef dtime_t typedef timestamp dtime_t;
#define dtime_t timestamp typedef interval intrvl_t;
#endif /* dtime_t */
#ifndef intrvl_t
#define intrvl_t interval
#endif /* intrvl_t */
extern void dtcurrent(dtime_t *); extern void dtcurrent(dtime_t *);
extern int dtcvasc(char *, dtime_t *); extern int dtcvasc(char *, dtime_t *);
......
#include <pgtypes_numeric.h> #include <pgtypes_numeric.h>
#ifndef dec_t typedef decimal dec_t;
#define dec_t decimal
#endif /* dec_t */
int decadd(dec_t *, dec_t *, dec_t *); int decadd(dec_t *, dec_t *, dec_t *);
int deccmp(dec_t *, dec_t *); int deccmp(dec_t *, dec_t *);
......
...@@ -5,15 +5,12 @@ ...@@ -5,15 +5,12 @@
#include <decimal.h> #include <decimal.h>
#include <datetime.h> #include <datetime.h>
#include <ecpglib.h> #include <ecpglib.h>
#include <pgtypes_date.h>
#define SQLNOTFOUND 100 #define SQLNOTFOUND 100
#ifndef date
#define date long
#endif /* ! date */
extern int rdatestr(date, char *); extern int rdatestr(date, char *);
extern void rtoday(date *); extern void rtoday(date *);
extern int rjulmdy(date, short *); extern int rjulmdy(date, short *);
extern int rdefmtdate(date *, char *, char *); extern int rdefmtdate(date *, char *, char *);
extern int rfmtdate(date, char *, char *); extern int rfmtdate(date, char *, char *);
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#include <pgtypes_timestamp.h> #include <pgtypes_timestamp.h>
#define date long typedef long date;
extern date PGTYPESdate_from_asc(char *, char **); extern date PGTYPESdate_from_asc(char *, char **);
extern char *PGTYPESdate_to_asc(date); extern char *PGTYPESdate_to_asc(date);
......
/* $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 */ /* Copyright comment */
%{ %{
...@@ -209,7 +209,6 @@ adjust_informix(struct arguments *list) ...@@ -209,7 +209,6 @@ adjust_informix(struct arguments *list)
original_var = ptr->variable->name; original_var = ptr->variable->name;
sprintf(temp, "%d))", ecpg_informix_var); sprintf(temp, "%d))", ecpg_informix_var);
/* create call to "ECPG_informix_set_var(<counter>, <pointer>. <linen number>)" */
if (atoi(ptr->variable->type->size) > 1) 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); 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) ...@@ -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); 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++); 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")); 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 */ /* now the indicator if there is one */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment