Bug #56756 Output Parameter MySqlDbType.Bit get a wrong Value (48/49 for false or true)
Submitted: 13 Sep 2010 18:39 Modified: 13 Oct 2010 10:26
Reporter: Michael Giger Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:6.3.4 OS:Windows
Assigned to: CPU Architecture:Any
Tags: MySqlDbType.Bit, ParameterDirection.Output

[13 Sep 2010 18:39] Michael Giger
Description:
I have declared an out parameter as MySqlDbType.Bit.
If i set Output Value to 1 then i get 49 in my C# Codesnippet.
If i set Output Value to 0 then i get 48 in my C# Codesnippet.
It works fine with MySqlDbType.Byte

How to repeat:
Store Procedure:
CREATE DEFINER=`root`@`%` PROCEDURE `Test`(out x bit(1))
BEGIN
    Set x = 1; -- Outparameter value is 49
    Set x = 0; -- Outparameter value is 48
END

C# Codesnippet:
MySqlCommand cmd = new MySqlCommand("Test", cn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("x", MySqlDbType.Bit).Direction = ParameterDirection.Output;
cmd.ExecuteNonQuery();
bool x = Convert.ToBoolean(cmd.Parameters["x"].Value); -- Value is 48/49
[6 Oct 2010 20:37] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/120177

839 Reggie Burnett	2010-10-06
      - fixed problem with using bit parameters as output (bug #56756)
[6 Oct 2010 20:54] Reggie Burnett
Fixed in 6.0.8, 6.1.6, 6.2.5, and 6.3.5+
[13 Oct 2010 10:26] Tony Bedford
An entry has been added to the 6.0.8, 6.1.6, 6.2.5, 6.3.5 changelogs:

When an output parameter was declared as type MySqlDbType.Bit, it failed to return with the correct value.