XHarbour TOleAuto Dates Bug

XHarbour TOleAuto Dates Bug

Postby nageswaragunupudi » Mon Mar 30, 2009 8:28 am

I have encountered a new bug with the recent XHarbour ( released along with FWH ) TOleAuto class. The Dates written and read are different by 1 millisecond and hence date equality comparisons are going wrong. ( I confirm that this was working perfectly in the version I used six months back ). This is the problem with Excel, Access, or any RDBS accessed through ADO.

For example, if the data stored in the table ( or Excel sheet ) is 12th Aug 2009, the value read is 12th Aug 2009 PLUS one millisecond. Here is a test program:
Code: Select all  Expand view
#include "fivewin.ch"

function Main()
   local oExcel, oBook, oSheet
   local dWrite, dRead

   SET DATE ITALIAN
   SET CENTURY ON

   oExcel   := CreateObject( "Excel.Application" )
   oBook    := oExcel:WorkBooks:Add()
   oSheet   := oExcel:ActiveSheet

   dWrite        := STOD( "20090812" )
   oSheet:Cells( 1, 1 ):Value    := dWrite

   dRead       := oSheet:Cells( 1, 1 ):Value
   msginfo( "Written : Read" + CRLF +  ;
            "DTOC " + DTOC( dWrite ) + " : " + DTOC( dRead ) + CRLF + ;
            "TTOC " + TTOC( dWrite ) + " : " + TTOC( dRead ) + CRLF + ;
            "TTOS " + TTOS( dWrite ) + " : " + TTOS( dRead ), ;
            If( dWrite == dRead, "EQUAL", "NOT EQUAL" ) )

   oBook:Close()

return nil
 

The equality comparison returns false. In earlier versions this was working perfectly.

I noticed this when I was rebuilding a large project. All those modules which depended or date comparisons are going haywire. An easy workaround to compare DTOC instead of dates can be recommended, but it is not practically possible to search through a large software and replace.

Has anyone noticed this problem and any news of fixing this bug ?
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: XHarbour TOleAuto Dates Bug

Postby nageswaragunupudi » Mon Mar 30, 2009 8:38 am

I have now downloaded latest version ( $Id: win32ole.prg,v 1.170 2008/12/22 22:09:45 likewolf Exp $ ) from http://www.xharbour.org and linked.

Now the date comparisons are working perfectly.

The problem seems to be in the XHarbour version provided along with FWH.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: XHarbour TOleAuto Dates Bug

Postby Enrico Maria Giordano » Mon Mar 30, 2009 9:05 am

Can it be the following fix (from xHarbour CVS changelog)?

2008-10-02 20:00 UTC+0100 Jose F. - <jfgimenez/at/wanadoo.es>
* source/rtl/win32ole.prg
! TOleAuto was retrieving date-only values incorrectly


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: XHarbour TOleAuto Dates Bug

Postby nageswaragunupudi » Mon Mar 30, 2009 9:14 am

>
Can it be the following fix (from xHarbour CVS changelog)?
>
That must have been the fix.
FWH may need to release a new updated build of XHarbour
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: XHarbour TOleAuto Dates Bug

Postby Rick Lipkin » Mon Mar 30, 2009 12:35 pm

I have noticed the date comparison as well with SQL datetime fields . I have had to convert the date values to ctod(dtoc()) in order to compare dates. I don't know when this happend in xHarbour .. but I am using build 1.1.0 rev 6195

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 92 guests