Page 1 of 1

Problem with TMyTable and boolean field

Posted: Mon 03 Feb 2014 10:02
by ads42
Hi,
I have a boolean field declared like this :
active_client tinyint(1) UNSIGNED DEFAULT '255'

When trying to fill a TMyTable I do
DestTable.FieldByName(FieldName).value := FieldValue;
here FieldValue is 0 or 255, but I get 0 or 1 when looking at the table.
Any idea ?
Regards

Re: Problem with TMyTable and boolean field

Posted: Tue 04 Feb 2014 15:57
by PavloP
By default, tinyint(1) MySQL server field is mapped to a TBooleanField. This field works with boolean values, and therefore all values are converted to 0 and 1. To work with integer values, set the TMyTable.Options.EnableBoolean property to False. At this, the field will be mapped to TSmallintField.

More details about the TMyTable.Options.EnableBoolean property can be seen in the MyDAC documentation:
http://www.devart.com/mydac/docs/index. ... oolean.htm