Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit df97427

Browse files
author
Michael Meskes
committed
Removed superfluous return statement in get_data.
1 parent 6890157 commit df97427

File tree

7 files changed

+55
-67
lines changed

7 files changed

+55
-67
lines changed

src/interfaces/ecpg/compatlib/informix.c

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,9 @@ deccvasc(char *cp, int len, decimal * np)
161161
int ret = 0;
162162
numeric *result;
163163

164+
rsetnull(CDECIMALTYPE, (char *) np);
164165
if (risnull(CSTRINGTYPE, cp))
165-
{
166-
rsetnull(CDECIMALTYPE, (char *) np);
167166
return 0;
168-
}
169167

170168
if (!str)
171169
ret = -1201;
@@ -206,11 +204,9 @@ deccvdbl(double dbl, decimal * np)
206204
numeric *nres = PGTYPESnumeric_new();
207205
int result = 1;
208206

207+
rsetnull(CDECIMALTYPE, (char *) np);
209208
if (risnull(CDOUBLETYPE, (char *) &dbl))
210-
{
211-
rsetnull(CDECIMALTYPE, (char *) np);
212209
return 0;
213-
}
214210

215211
if (nres == NULL)
216212
return -1211;
@@ -229,11 +225,9 @@ deccvint(int in, decimal * np)
229225
numeric *nres = PGTYPESnumeric_new();
230226
int result = 1;
231227

228+
rsetnull(CDECIMALTYPE, (char *) np);
232229
if (risnull(CINTTYPE, (char *) &in))
233-
{
234-
rsetnull(CDECIMALTYPE, (char *) np);
235230
return 0;
236-
}
237231

238232
if (nres == NULL)
239233
return -1211;
@@ -252,11 +246,9 @@ deccvlong(long lng, decimal * np)
252246
numeric *nres = PGTYPESnumeric_new();
253247
int result = 1;
254248

249+
rsetnull(CDECIMALTYPE, (char *) np);
255250
if (risnull(CLONGTYPE, (char *) &lng))
256-
{
257-
rsetnull(CDECIMALTYPE, (char *) np);
258251
return 0;
259-
}
260252

261253
if (nres == NULL)
262254
return -1211;
@@ -338,11 +330,9 @@ dectoasc(decimal * np, char *cp, int len, int right)
338330
if (nres == NULL)
339331
return -1211;
340332

333+
rsetnull(CSTRINGTYPE, (char *) cp);
341334
if (risnull(CDECIMALTYPE, (char *) np))
342-
{
343-
rsetnull(CSTRINGTYPE, (char *) cp);
344335
return 0;
345-
}
346336

347337
if (PGTYPESnumeric_from_decimal(np, nres) != 0)
348338
return -1211;

src/interfaces/ecpg/ecpglib/data.c

Lines changed: 41 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.18 2003/09/18 13:12:23 meskes Exp $ */
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.19 2003/09/19 14:06:21 meskes Exp $ */
22

33
#define POSTGRES_ECPG_INTERNAL
44
#include "postgres_fe.h"
@@ -397,22 +397,24 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
397397
{
398398
/* Informix wants its own NULL value here instead of an error */
399399
ECPGset_informix_null(ECPGt_numeric, &nres);
400-
return (true);
401400
}
402401
else
403402
{
404403
ECPGraise(lineno, ECPG_NUMERIC_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
405404
return (false);
406405
}
407406
}
408-
if (isarray && *scan_length == '"')
409-
scan_length++;
410-
411-
if ((isarray && *scan_length != ',' && *scan_length != '}')
412-
|| (!isarray && *scan_length != '\0' && *scan_length != ' ')) /* Garbage left */
407+
else
413408
{
414-
ECPGraise(lineno, ECPG_NUMERIC_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
415-
return (false);
409+
if (isarray && *scan_length == '"')
410+
scan_length++;
411+
412+
if ((isarray && *scan_length != ',' && *scan_length != '}')
413+
|| (!isarray && *scan_length != '\0' && *scan_length != ' ')) /* Garbage left */
414+
{
415+
ECPGraise(lineno, ECPG_NUMERIC_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
416+
return (false);
417+
}
416418
}
417419
}
418420
else
@@ -439,22 +441,24 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
439441
{
440442
/* Informix wants its own NULL value here instead of an error */
441443
ECPGset_informix_null(ECPGt_interval, &ires);
442-
return (true);
443444
}
444445
else
445446
{
446447
ECPGraise(lineno, ECPG_INTERVAL_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
447448
return (false);
448449
}
449450
}
450-
if (isarray && *scan_length == '"')
451-
scan_length++;
452-
453-
if ((isarray && *scan_length != ',' && *scan_length != '}')
454-
|| (!isarray && *scan_length != '\0' && *scan_length != ' ')) /* Garbage left */
451+
else
455452
{
456-
ECPGraise(lineno, ECPG_INTERVAL_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
457-
return (false);
453+
if (isarray && *scan_length == '"')
454+
scan_length++;
455+
456+
if ((isarray && *scan_length != ',' && *scan_length != '}')
457+
|| (!isarray && *scan_length != '\0' && *scan_length != ' ')) /* Garbage left */
458+
{
459+
ECPGraise(lineno, ECPG_INTERVAL_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
460+
return (false);
461+
}
458462
}
459463
}
460464
else
@@ -477,23 +481,24 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
477481
{
478482
/* Informix wants its own NULL value here instead of an error */
479483
ECPGset_informix_null(ECPGt_date, &ddres);
480-
return (true);
481484
}
482485
else
483486
{
484487
ECPGraise(lineno, ECPG_DATE_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
485488
return (false);
486489
}
487490
}
488-
489-
if (isarray && *scan_length == '"')
490-
scan_length++;
491-
492-
if ((isarray && *scan_length != ',' && *scan_length != '}')
493-
|| (!isarray && *scan_length != '\0' && *scan_length != ' ')) /* Garbage left */
491+
else
494492
{
495-
ECPGraise(lineno, ECPG_DATE_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
496-
return (false);
493+
if (isarray && *scan_length == '"')
494+
scan_length++;
495+
496+
if ((isarray && *scan_length != ',' && *scan_length != '}')
497+
|| (!isarray && *scan_length != '\0' && *scan_length != ' ')) /* Garbage left */
498+
{
499+
ECPGraise(lineno, ECPG_DATE_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
500+
return (false);
501+
}
497502
}
498503

499504
*((date *) (var + offset * act_tuple)) = ddres;
@@ -515,22 +520,24 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
515520
{
516521
/* Informix wants its own NULL value here instead of an error */
517522
ECPGset_informix_null(ECPGt_timestamp, &tres);
518-
return (true);
519523
}
520524
else
521525
{
522526
ECPGraise(lineno, ECPG_TIMESTAMP_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
523527
return (false);
524528
}
525529
}
526-
if (isarray && *scan_length == '"')
527-
scan_length++;
528-
529-
if ((isarray && *scan_length != ',' && *scan_length != '}')
530-
|| (!isarray && *scan_length != '\0' && *scan_length != ' ')) /* Garbage left */
530+
else
531531
{
532-
ECPGraise(lineno, ECPG_TIMESTAMP_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
533-
return (false);
532+
if (isarray && *scan_length == '"')
533+
scan_length++;
534+
535+
if ((isarray && *scan_length != ',' && *scan_length != '}')
536+
|| (!isarray && *scan_length != '\0' && *scan_length != ' ')) /* Garbage left */
537+
{
538+
ECPGraise(lineno, ECPG_TIMESTAMP_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
539+
return (false);
540+
}
534541
}
535542

536543
*((timestamp *) (var + offset * act_tuple)) = tres;

src/interfaces/ecpg/include/datetime.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
#include <pgtypes_timestamp.h>
22
#include <pgtypes_interval.h>
33

4-
#ifndef dtime_t
5-
#define dtime_t timestamp
6-
#endif /* dtime_t */
7-
8-
#ifndef intrvl_t
9-
#define intrvl_t interval
10-
#endif /* intrvl_t */
4+
typedef timestamp dtime_t;
5+
typedef interval intrvl_t;
116

127
extern void dtcurrent(dtime_t *);
138
extern int dtcvasc(char *, dtime_t *);

src/interfaces/ecpg/include/decimal.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#include <pgtypes_numeric.h>
22

3-
#ifndef dec_t
4-
#define dec_t decimal
5-
#endif /* dec_t */
3+
typedef decimal dec_t;
64

75
int decadd(dec_t *, dec_t *, dec_t *);
86
int deccmp(dec_t *, dec_t *);

src/interfaces/ecpg/include/ecpg_informix.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@
55
#include <decimal.h>
66
#include <datetime.h>
77
#include <ecpglib.h>
8+
#include <pgtypes_date.h>
89

910
#define SQLNOTFOUND 100
1011

11-
#ifndef date
12-
#define date long
13-
#endif /* ! date */
14-
1512
extern int rdatestr(date, char *);
16-
extern void rtoday(date *);
13+
extern void rtoday(date *);
1714
extern int rjulmdy(date, short *);
1815
extern int rdefmtdate(date *, char *, char *);
1916
extern int rfmtdate(date, char *, char *);

src/interfaces/ecpg/include/pgtypes_date.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include <pgtypes_timestamp.h>
55

6-
#define date long
6+
typedef long date;
77

88
extern date PGTYPESdate_from_asc(char *, char **);
99
extern char *PGTYPESdate_to_asc(date);

src/interfaces/ecpg/preproc/preproc.y

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.255 2003/09/18 13:12:23 meskes Exp $ */
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.256 2003/09/19 14:06:21 meskes Exp $ */
22

33
/* Copyright comment */
44
%{
@@ -209,7 +209,6 @@ adjust_informix(struct arguments *list)
209209
original_var = ptr->variable->name;
210210
sprintf(temp, "%d))", ecpg_informix_var);
211211

212-
/* create call to "ECPG_informix_set_var(<counter>, <pointer>. <linen number>)" */
213212
if (atoi(ptr->variable->type->size) > 1)
214213
{
215214
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)
220219
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);
221220
sprintf(temp, "%d, &(", ecpg_informix_var++);
222221
}
222+
223+
/* create call to "ECPG_informix_set_var(<counter>, <pointer>. <linen number>)" */
223224
result = cat_str(5, result, make_str("ECPG_informix_set_var("), mm_strdup(temp), mm_strdup(original_var), make_str("), __LINE__);\n"));
224225

225226
/* now the indicator if there is one */

0 commit comments

Comments
 (0)