From 3cda9802989b260f02b45f712523db0e16a39ecb Mon Sep 17 00:00:00 2001 From: Michael Meskes Date: Tue, 7 Oct 2003 05:46:56 +0000 Subject: [PATCH] Fixed error handling in Informix compat str to date conversion. --- src/interfaces/ecpg/ChangeLog | 4 ++++ src/interfaces/ecpg/compatlib/informix.c | 2 +- src/interfaces/ecpg/pgtypeslib/datetime.c | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog index 54d7abd8f8..ce7fe1e711 100644 --- a/src/interfaces/ecpg/ChangeLog +++ b/src/interfaces/ecpg/ChangeLog @@ -1675,6 +1675,10 @@ Mon Oct 6 08:41:45 CEST 2003 - Fixed constant listing in execute using clause. - Fixed typo in ecpg for Informix dec_t type. - Fixed precision handling in Informix compat funxtions. + +Tue Oct 7 07:45:09 CEST 2003 + + - Fixed error handling in rstrdate. - Set ecpg version to 3.0.0 - Set ecpg library to 4.0.0 - Set pgtypes library to 1.0.0 diff --git a/src/interfaces/ecpg/compatlib/informix.c b/src/interfaces/ecpg/compatlib/informix.c index 500786cbed..59e4763ccd 100644 --- a/src/interfaces/ecpg/compatlib/informix.c +++ b/src/interfaces/ecpg/compatlib/informix.c @@ -436,7 +436,7 @@ rstrdate(char *str, date * d) { date dat = PGTYPESdate_from_asc(str, NULL); - if (errno != PGTYPES_DATE_BAD_DATE && dat == 0) + if (errno && errno != PGTYPES_DATE_BAD_DATE) return ECPG_INFORMIX_BAD_DATE; *d = dat; diff --git a/src/interfaces/ecpg/pgtypeslib/datetime.c b/src/interfaces/ecpg/pgtypeslib/datetime.c index 9e951022f9..add4841c37 100644 --- a/src/interfaces/ecpg/pgtypeslib/datetime.c +++ b/src/interfaces/ecpg/pgtypeslib/datetime.c @@ -53,14 +53,14 @@ PGTYPESdate_from_asc(char *str, char **endptr) if (strlen(str) >= sizeof(lowstr)) { errno = PGTYPES_DATE_BAD_DATE; - return 0; + return INT_MIN; } if ((ParseDateTime(str, lowstr, field, ftype, MAXDATEFIELDS, &nf, ptr) != 0) || (DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, &tzp, EuroDates) != 0)) { errno = PGTYPES_DATE_BAD_DATE; - return 0; + return INT_MIN; } switch (dtype) @@ -74,7 +74,7 @@ PGTYPESdate_from_asc(char *str, char **endptr) default: errno = PGTYPES_DATE_BAD_DATE; - return -1; + return INT_MIN; } dDate = (date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - date2j(2000, 1, 1));