Browse Source

* Patch from Luiz Americo to fix access violation when transforming date field

git-svn-id: trunk@13867 -
michael 16 years ago
parent
commit
c8d72ce4aa
1 changed files with 5 additions and 2 deletions
  1. 5 2
      packages/fcl-db/src/paradox/paradox.pp

+ 5 - 2
packages/fcl-db/src/paradox/paradox.pp

@@ -660,8 +660,11 @@ begin
         Result:=PX_get_data_long(FDoc,Buf,flen,@longv)>0;
         If Result then
           begin
-          PX_SdnToGregorian(longv+1721425,@Y,@M,@D);
-          PDateTime(Buffer)^:=EncodeDate(Y,M,D);
+          // 1721425 is the number of the days between the start of the
+          // julian calendar (4714 BC) and jan-00-0000 (Paradox base date)
+          // 2415019 is the number of the days between the start of the
+          // julian calendar (4714 BC) and dec-30-1899 (TDateTime base date)
+          PDateTime(Buffer)^:=Longv+1721425-2415019;
           end;
         end;
       pxfShort: