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

Commit 3cda980

Browse files
author
Michael Meskes
committed
Fixed error handling in Informix compat str to date conversion.
1 parent 34e9ab0 commit 3cda980

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/interfaces/ecpg/ChangeLog

+4
Original file line numberDiff line numberDiff line change
@@ -1675,6 +1675,10 @@ Mon Oct 6 08:41:45 CEST 2003
16751675
- Fixed constant listing in execute using clause.
16761676
- Fixed typo in ecpg for Informix dec_t type.
16771677
- Fixed precision handling in Informix compat funxtions.
1678+
1679+
Tue Oct 7 07:45:09 CEST 2003
1680+
1681+
- Fixed error handling in rstrdate.
16781682
- Set ecpg version to 3.0.0
16791683
- Set ecpg library to 4.0.0
16801684
- Set pgtypes library to 1.0.0

src/interfaces/ecpg/compatlib/informix.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ rstrdate(char *str, date * d)
436436
{
437437
date dat = PGTYPESdate_from_asc(str, NULL);
438438

439-
if (errno != PGTYPES_DATE_BAD_DATE && dat == 0)
439+
if (errno && errno != PGTYPES_DATE_BAD_DATE)
440440
return ECPG_INFORMIX_BAD_DATE;
441441

442442
*d = dat;

src/interfaces/ecpg/pgtypeslib/datetime.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ PGTYPESdate_from_asc(char *str, char **endptr)
5353
if (strlen(str) >= sizeof(lowstr))
5454
{
5555
errno = PGTYPES_DATE_BAD_DATE;
56-
return 0;
56+
return INT_MIN;
5757
}
5858

5959
if ((ParseDateTime(str, lowstr, field, ftype, MAXDATEFIELDS, &nf, ptr) != 0)
6060
|| (DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, &tzp, EuroDates) != 0))
6161
{
6262
errno = PGTYPES_DATE_BAD_DATE;
63-
return 0;
63+
return INT_MIN;
6464
}
6565

6666
switch (dtype)
@@ -74,7 +74,7 @@ PGTYPESdate_from_asc(char *str, char **endptr)
7474

7575
default:
7676
errno = PGTYPES_DATE_BAD_DATE;
77-
return -1;
77+
return INT_MIN;
7878
}
7979

8080
dDate = (date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - date2j(2000, 1, 1));

0 commit comments

Comments
 (0)