OSDN Git Service

Fixed mdy functions to use correct offset.
authorMichael Meskes <meskes@postgresql.org>
Thu, 24 Jul 2003 08:41:07 +0000 (08:41 +0000)
committerMichael Meskes <meskes@postgresql.org>
Thu, 24 Jul 2003 08:41:07 +0000 (08:41 +0000)
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/pgtypeslib/datetime.c
src/interfaces/ecpg/test/test_informix.pgc

index 2d45486..f12eadd 100644 (file)
@@ -1587,6 +1587,10 @@ Thu Jul 17 09:15:59 CEST 2003
 Fri Jul 18 16:31:10 CEST 2003
 
        - Added some more compatibility features to the parser.
+       
+Thu Jul 24 10:33:51 CEST 2003
+
+       - Fixed mdy functions to use correct offset.
        - Set ecpg version to 3.0.0
        - Set ecpg library to 4.0.0
        - Set pgtypes library to 1.0.0
index 9e8becb..26afea2 100644 (file)
@@ -100,7 +100,7 @@ PGTYPESdate_julmdy(Date jd, int* mdy)
 {
        int y, m, d;
        
-       j2date((int) jd, &y, &m, &d);
+       j2date((int) (jd + date2j(2000, 1, 1)), &y, &m, &d);
        mdy[0] = m;
        mdy[1] = d;
        mdy[2] = y;
@@ -113,7 +113,7 @@ PGTYPESdate_mdyjul(int* mdy, Date *jdate)
        /* day   is mdy[1] */
        /* year  is mdy[2] */
 
-       *jdate = (Date) date2j(mdy[2], mdy[0], mdy[1]);
+       *jdate = (Date) (date2j(mdy[2], mdy[0], mdy[1]) - date2j(2000, 1, 1));
 }
 
 int
index 755dab2..a502ad6 100644 (file)
@@ -36,7 +36,7 @@ int main()
        
        while (1)
        {
-               $fetch in c into :i, :j;
+               $fetch forward c into :i, :j;
                if (sqlca.sqlcode == 100) break;
                else if (sqlca.sqlcode != 0) printf ("Error: %ld\n", sqlca.sqlcode);