Bug #112088 BIT(n) Parameter Size incorrectly reported as 0
Submitted: 16 Aug 2023 16:09 Modified: 17 Aug 2023 12:38
Reporter: Bradley Grainger (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:8.1.0 OS:Any
Assigned to: CPU Architecture:Any

[16 Aug 2023 16:09] Bradley Grainger
Description:
This is a regression in Connector/NET 8.1.0 from 8.0.33.

When MySqlCommandBuilder.DeriveParameters(cmd) is called for a StoredProcedure command for a sproc that has a BIT(n) parameter, the returned MySqlParameter has a Size property of 0. Previously, it had the size of the BIT(n) column, i.e., n.

How to repeat:
Run the following C# code:

using var connection = new MySqlConnection("...");
connection.Open();

// SET THIS TO ANY VALUE FROM 1 TO 64
var bitSize = 1;

using (var cmd = new MySqlCommand($"drop procedure if exists parameter_size; create procedure parameter_size(in param1 bit({bitSize})) begin end;", connection))
	cmd.ExecuteNonQuery();

using (var cmd = new MySqlCommand("parameter_size", connection))
{
	cmd.CommandType = CommandType.StoredProcedure;
	MySqlCommandBuilder.DeriveParameters(cmd);

	// ** In MySql.Data 8.0.33, prints the value of bitSize from above
	// ** In MySql.Data 8.1.0, always prints 0
	Console.WriteLine(cmd.Parameters[0].Size);
}
[17 Aug 2023 12:38] MySQL Verification Team
Hello Bradley Grainger,

Thank you for the bug report.
Verified as described.

Regards,
Ashwini Patil