Page 1 of 1

TbooleanFields problem

Posted: Mon 06 Nov 2006 14:48
by Zagawa
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 ?

Posted: Tue 07 Nov 2006 10:01
by Antaeus
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.