xHarbour bug in ADO Date\Time field

xHarbour bug in ADO Date\Time field

Postby Rick Lipkin » Wed Feb 08, 2012 4: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
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: xHarbour bug in ADO Date\Time field

Postby nageswaragunupudi » Wed Feb 08, 2012 8: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
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xHarbour bug in ADO Date\Time field

Postby Antonio Linares » Thu Feb 09, 2012 2: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42089
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: xHarbour bug in ADO Date\Time field

Postby Rick Lipkin » Thu Feb 09, 2012 4: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
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: xHarbour bug in ADO Date\Time field

Postby Gale FORd » Thu Feb 09, 2012 9: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 ) )
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: xHarbour bug in ADO Date\Time field

Postby Rick Lipkin » 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
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: xHarbour bug in ADO Date\Time field

Postby nageswaragunupudi » Fri Feb 10, 2012 3: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
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xHarbour bug in ADO Date\Time field ( fixed )

Postby Rick Lipkin » Mon Mar 19, 2012 3: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
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 110 guests