Here is the problem. In MySQL Connector / NET, a field TINYINT(1)correctly translates back and forth to a .NET bool value. If I select from a table with a column TINYINT(1), everything will be golden. However, when you use the built-in functions of MySQL v5.0, such as:
SELECT (3 BETWEEN 2 AND 4) AS oddly_not_boolean;
The actual return type from the database registers this field as INTor BIGINT, which Connector / .NET does not explicitly convert to bool. MySQL CAST()and CONVERT()do not allow casting TINYINT(1).
I even went so far as to try to execute a user function, but it doesn't work either(EDIT: this one works ):
CREATE FUNCTION `to_bool`(var_num BIGINT)
RETURNS TINYINT(1) RETURN var_num;
How to convert INTto TINYINT(1)into a query in MySQL?
EDIT: The above function really works to convert the value to TINYINT(1), but my Connector / NET just listens and incorrectly converts the values ββfrom the functions.
UPDATE 2009-11-03: My connector has been updated and it still returns Int32 to me. Further testing shows that this is an InnoDB error in MySQL 5.0.x, which only appears under certain circumstances.
source
share