Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Date calculation BUG in .NET Provider
Tue, May 11 2010 7:10 AMPermanent Link

Hedley Muscroft

Hi Tim,

Here's the SQL to reproduce the problem :-

-------------------------------
create table test (name varchar(250), dob date);
insert into test values ('Bob', date '1970-1-1');
-------------------------------

Now execute this statement :-

-------------------------------
select name, dob, (current_date-dob) year from test
-------------------------------

In EDB Manager (UNICODE), we correctly get :-

Bob | 1970-1-1 | 40

Under .NET we get :=

Bob | 1970-1-1 | 480

Seems to be calculating the number of months?

Thanks,

Hedley
Tue, May 11 2010 3:19 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Hedley,

<< Seems to be calculating the number of months? >>

It is the number of months.  Unfortunately, .NET does not have INTERVAL type
support, so we have to return the value as a raw integer (months is the base
unit of measure).  I've added functions to the VCL data access components to
allow for translation of INTERVAL values to their proper display
representation, which is what the EDB Manager uses and why it returns the
correct value in the result set grid.

For now, use this:

select name, dob, cast((current_date-dob) year AS INTEGER) from test

and you'll see the correct value.

--
Tim Young
Elevate Software
www.elevatesoft.com
Fri, May 21 2010 12:18 PMPermanent Link

curt

McGonkulator, Inc.

Actually, .NET does support intervals, but the data type is called "System.TimeSpan"
Fri, May 21 2010 3:09 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Curt,

<< Actually, .NET does support intervals, but the data type is called
"System.TimeSpan" >>

Unfortunately, that only covers part of the intervals in the SQL standard
(day-time intervals).  It doesn't cover year-month intervals.

However, it's at least something, so I'll add some Get/Set methods for them.

--
Tim Young
Elevate Software
www.elevatesoft.com
Image