Cast as date returns string

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
[email protected]
Posts: 6
Joined: Fri 16 Dec 2005 22:33

Cast as date returns string

Post by [email protected] » Fri 16 Dec 2005 22:53

Hi,

I built a simple MySql 4.1 structure of data:

CREATE TABLE `test`.`tabtest` (
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`time` DATETIME NOT NULL,
PRIMARY KEY(`Id`)
)
ENGINE = InnoDB;

... and populated:

INSERT INTO test.tabtest VALUES ( 1, {dt "2005-10-10 10:10:10"} )
INSERT INTO test.tabtest VALUES ( 2, {dt "2005-10-11 10:10:10"} )

... why does the column fdate in select above return string value on MyDac?

SELECT Cast(time as DATE) as fdate FROM test.tabtest GROUP BY time

... the strange is that fdate returns OK(date) in selects above:

SELECT Cast(time as DATE) as fdate FROM test.tabtest GROUP BY id
SELECT Cast(time as DATE) as fdate FROM test.tabtest

... In MySql 5, all selects work ok!

Thank's,

Tato.

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Mon 19 Dec 2005 09:34

MyDAC usually doesn't convert field types. Try to ask this question in MySQL forum.

> In MySql 5, all selects work ok!

Most possible, this is MySQL 4.1 bug

Post Reply