TbooleanFields problem

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Zagawa
Posts: 21
Joined: Fri 12 May 2006 09:56

TbooleanFields problem

Post by Zagawa » Mon 06 Nov 2006 14:48

We work with Delphi 5 Update Pack 1, and Mydac 4.40.19


Here is the way to reproduce the problem

Creation table script :

Code: Select all

CREATE TABLE `table1` (
  `ID` int(11) NOT NULL auto_increment,
  `Bool` tinyint(1) NOT NULL,
  `Fields` char(8) default NULL,
  PRIMARY KEY  (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Data :

Code: Select all

INSERT INTO `table1` (`ID`, `Bool`, `Fields`) VALUES 
  (1,1,'AAAA'),
  (2,0,'BBBB'),
  (3,1,'CCCC');
Now in Delphi put a MyConnection & MyQuery and link them.

First try this query :

Code: Select all

select bool,fields from table1
Go to Fields Editors and add all fields : The field 'bool' is TBooleanField
> All is ok

Now delete created fields and try this query :

Code: Select all

select bool,fields from table1 where Fields='AAAA'
union
select bool,fields from table1 where Fields='BBBB'
Finally, go to Fields Editors and add all fields : The field 'bool' is now a TSmallIntField..

Could you please check this ?

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Tue 07 Nov 2006 10:01

We have checked this issue. This happens bacause the server returns different field length in both cases. In the first case the field length is 1, so MyDAC describes this field as TBooleanField. In the second case (query with UNION) the server returns 4 as the field length. That is why in the second case the field is described as TSmallintField.

Post Reply