Bug #35302 | ExecuteScalar returns VarBinary when it's a string | ||
---|---|---|---|
Submitted: | 14 Mar 2008 23:18 | Modified: | 15 Mar 2008 0:56 |
Reporter: | Gary Smith | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | Connector / NET | Severity: | S3 (Non-critical) |
Version: | 5.2.1 | OS: | Windows |
Assigned to: | CPU Architecture: | Any |
[14 Mar 2008 23:18]
Gary Smith
[15 Mar 2008 0:17]
Gary Smith
Using: command.CommandText = "SELECT CONVERT(MD5(@value) USING utf8) AS md5value"; Seems to make the problem go away. It seesm that the MD5 function may be partly to blame. It returns a binary string which on the older connector came back as a VarChar but it appears to be returning the binary type now. Not sure if this should be more clearly documented in the MD5 defination (that it's returned as non-string) or not.
[15 Mar 2008 0:56]
Reggie Burnett
This is not a bug. The server is returning the output of MD5 as a binary string and the connector is honoring that. You can either use the SQL workaround you gave or give a connection string option 'respect binary flags=false' which will reproduce 5.0 behavior. This is not recommended but for large apps that really can't be reworked, it's a good option.