Bug #19647 MySqlParameter ctor does not set isUnsigned properly
Submitted: 9 May 2006 17:45 Modified: 19 May 2006 16:41
Reporter: Paul Shafer Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:1.0.7.17454 OS:Windows (WinXp)
Assigned to: Reggie Burnett CPU Architecture:Any

[9 May 2006 17:45] Paul Shafer
Description:
The ctor MySqlParameter( string parameterName, MySqlDbType dbType) logic fails to set the isUnsigned property.  I.e. the ctor calls the MySqlDbType set{} property which calls SetMySqlDbType.  SetMySqlDbType checks the isUnsinged field, but it will always be false.

How to repeat:
cmd.CommandText = <some insert statement>
cmd.Parameters.Add("?foo", MySqlDbType.UInt32);
cmd.Parameters["?foo"].Value = 100;
cmd.ExecuteNonQuery();  // this will throw an exception because this paramter will resolve to a binary type in MySqlValue::GetMySqlValue (eventually called during serialization of the parameter)

if I do the following:
cmd.CommandText = <some insert statement>
cmd.Parameters.Add("?foo", MySqlDbType.UInt32);
cmd.Parameters["?foo"].Value = 100;
cmd.Parameters["?foo"].IsUnsigned= true;
cmd.ExecuteNonQuery();

then it works as expected.  In my opinion, calling Add with a UInt32 type should set the isUnsigned flag properly, without me having to explicitly set it.

Suggested fix:
Have the MySqlParameter ctor set the isUnsigned flag properly.
[19 May 2006 16:41] Reggie Burnett
Thank you for taking the time to report a problem.  Unfortunately
you are not using a current version of the product your reported a
problem with -- the problem might already be fixed. Please download
a new version from http://www.mysql.com/downloads/

If you are able to reproduce the bug with one of the latest versions,
please change the version on this bug report to the version you
tested and change the status back to "Open".  Again, thank you for
your continued support of MySQL.

Additional info:

This should be fixed in 1.0.8.