Bug #6428 double type handling in MySqlParameter(string parameterName, object value)
Submitted: 4 Nov 2004 11:21 Modified: 4 Nov 2004 15:48
Reporter: Vahan Sardaryan Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:1.0.1 OS:Microsoft Windows (Windows 2000 SP4)
Assigned to: Reggie Burnett CPU Architecture:Any

[4 Nov 2004 11:21] Vahan Sardaryan
Description:
When passing double or float values to MySqlParameter(string parameterName, object value) constructor, they are not handled correctly. They are being handled as binary values, causing exception later in MySqlBinary::Serialize() function. 

How to repeat:
Construct a query having double or float parameters using MySqlParameter(string parameterName, object value) constructor and execute it. Exception will be thrown in MySqlBinary::Serialize().

Suggested fix:
MySqlParameter(string parameterName, object value) constructor calls SetTypeFromValue function to recognize parameter type. TypeCode.Double and TypeCode.Single codes are not handled there, it causes default handling as binary values. The following code may be added to switch () statement inside the SetTypeFromValue function:

case TypeCode.Double: SetDbType( DbType.Double ); break;
case TypeCode.Single: SetDbType( DbType.Single ); break;
[4 Nov 2004 15:48] Reggie Burnett
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html