FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xHarbour bug in ADO Date\Time field
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
xHarbour bug in ADO Date\Time field
Posted: Wed Feb 08, 2012 04:54 PM

To All

The recent builds of xHarbour ( ships with FWH 1201 xHarbour 1.21 rev 9421 ) appears to have a bug in assigning a variable from an ADO date\time field and assigns it a T valtype rather than D for date.

When comparing date values there is an obvious data type mis-match .. I posted a small sample on the xHarbour forum and am awaiting an answer.

Rick Lipkin

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xHarbour bug in ADO Date\Time field
Posted: Wed Feb 08, 2012 08:46 PM

I don't consider this as a bug because all those values are in fact date-time values, though many of us use it with timepart as zero.

It is for us to handle the datetime values as date values or time values appropriately in our program.

But the real problem is there are other issues with the datetime values in xHarbour. I do not know if they are resolved recently though.

Regards



G. N. Rao.

Hyderabad, India
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: xHarbour bug in ADO Date\Time field
Posted: Thu Feb 09, 2012 02:16 PM

Rick has reported that there is an update for xHarbour that solves it.

We have built a new xHarbour and sent it to him waiting for his feedback

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: xHarbour bug in ADO Date\Time field
Posted: Thu Feb 09, 2012 04:56 PM

To All

xHarbour has created a new valtype T for DateTime .. when you extract a DateTime value from an ADO database like dDate := oRs:Fields("StartDate"):Value .. xHarbour "NOW" considers this expression to be valtype T... prior to valtype D.

The problem occurs where you do some math or comparison between dDate as in :

nDiff := Date() - dDate or

If Date() < dDate ....

As you can see the datatype mismatch can be a potential nightmare for existing applications written with ADO databases that use DateTime fields.

I have just replied back to the xHarbour developers .. they have resolved the Math problem even with the datatype mismatch .. however, the value comparison between expressions will still need to be fixed.

Rick

Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Re: xHarbour bug in ADO Date\Time field
Posted: Thu Feb 09, 2012 09:44 PM

I did not know you could compare different date types without errors. I have been converting Date from type 'T' to type 'D' in SQL and ADS databases.
nDiff := date() - ttodate( tDate )
if date() < ttodate( tDate )

function ttodate( tDate )
return( stod( substr( ttos( tDate ), 1, 8 ) )

Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: xHarbour bug in ADO Date\Time field
Posted: Thu Feb 09, 2012 10:43 PM

Gale

I have tuns of code and applications written with with Date or Datetime comparisons depending if I am using .dbf or Ado ( sql server or Access ). Up until recently both date and datetime have been treated as D valtypes.

I would hope for the sake of 'clipper' compatibility the xHarbour folks can make their new T valtype work. So far I have tested two commits and the math and comparison operators now work.

Unfortunately, when the value writes back to the Ado datetime field the table stores 12:00 am only :cry:

I think they are very close.

Rick Lipkin

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xHarbour bug in ADO Date\Time field
Posted: Fri Feb 10, 2012 03:36 AM
Ado datetime field the table stores 12:00 am only

This is a known behavior of MSSql only.
Regards



G. N. Rao.

Hyderabad, India
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: xHarbour bug in ADO Date\Time field ( fixed )
Posted: Mon Mar 19, 2012 03:49 PM

To All

It appears that xHarbour build 9444 has all the DateTime fixes .. Many thanks to Andi Jahja
for all his work !

Rick Lipkin

https://groups.google.com/forum/#!topic ... U8fSJVmpN0

Hi Rick,

I am very sorry for very late follow-up on this issue.
BTW, I have just committed a quick fix for the subject matter.

Please test it and report any problem.

Thanks.

Andi

//------------------------
Andi

YES .. In build 9444 it appears that all your changes work GREAT .. Math between DateTime variables work as well as writing the value of DateTime back to SQL tables work as well.

Many Thanks
Rick Lipkin

Continue the discussion