Additional
dbCAP
AnyDAC
ThinDAC
NCOCI8
Topic: mysql bit?
mysql bit?
Posted: 2007/07/02 14:49
 
hi,
what is the datatype for AnyDac booleanfield in MySQL?

thank you
Re:mysql bit?
Posted: 2007/07/02 15:15
 
You can use smallint and fill it with TRUE or FALSE.
See MySQL documentation: http://dev.mysql.com/doc/refman/5.1/en/boolean-values.html

Regards
Knut
Re:mysql bit?
Posted: 2007/07/03 03:16
 
hi,
I'm not sure if this is right...

TinyInt --> Byte
SmallInt --> Int16
Integer --> Int32
BigInt --> Int64.

In daAdPhysMySQL, line 996-1160 where the MySQL fields map to Delphi fields there is no boolean mapping?

if possible, please add boolean field mapping.

Thank you.
Re:mysql bit?
Posted: 2007/07/04 03:28
 
Hello Sally,

you're right in that: tinyint is the datatype to prefer (although any numeric type should work), see: http://dev.mysql.com/doc/refman/5.0/en/numeric-type-overview.html

if possible, please add boolean field mapping.

Because MySQL provides no boolean datatype, boolean field mapping is not possible, I think. Who should know, if a field is boolean or really tinyint (i.e. contains values other than 0 and 1)? As long as values in field are only 0 and 1, the (Delphi-)datatypes 'boolean' and 'numeric' are compatible. You can address a numeric field like

 MyField.AsBoolean := true;

and respectivly while reading from that field.

But Dmitry should say something to that 'problem'.

Regards,
Knut
Re:mysql bit?
Posted: 2007/07/04 23:04
 
Hello

You can ask AnyDAC to map TinyInt to ftBoolean. For that do following:


 with ADConnection1.FormatOptions do begin   OwnMapRules := True;   with MapRules.Add do begin     SourceDataType := dtByte;     TargetDataType := dtBoolean;   end; end;



Regards,
Dmitry