Bug #53615 | Requires an option to disable mapping char(36) to Guid | ||
---|---|---|---|
Submitted: | 13 May 2010 5:42 | Modified: | 13 May 2010 14:40 |
Reporter: | Xiaofeng Wang | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | Connector / NET | Severity: | S4 (Feature request) |
Version: | 6.2.3 | OS: | Windows |
Assigned to: | Assigned Account | CPU Architecture: | Any |
Tags: | Connector/Net, Contribution |
[13 May 2010 5:42]
Xiaofeng Wang
[13 May 2010 10:32]
Tonci Grgin
Hi Xiaofeng and thanks for your report. IMO this is a valid feature request both in terms of usability and consistency.
[13 May 2010 10:41]
Vladislav Vaintroub
Xiaofeng, is there something specific in your application that requires fixed size char fields of exactly 36 chars? My guess would be that this situation will be extremely rare, unless the field in question is exactly Guid.
[13 May 2010 10:48]
Tonci Grgin
Changing triage to "Acceptable workaround" as one can change CHAR to VARCHAR in field definition.
[13 May 2010 14:40]
Xiaofeng Wang
Hi Vladislav, actually I agree with what you suppose. In our project, we are connecting to one legacy PHP + MySql system from ASP.NET. Even the char(36) was reall expected as Guid, there were some empty value. There are nothing wrong with PHP because it regards it as char. We are neither allowed to change the database schema nor to update the data. However, we still need the feature to support disabling the automatical mapping. As shown in my example above, because MySql has not the native Guid data type, the business application can simply put invalid format to the char(36). But the Connector/Net still assumes it's valid and parse the value to Guid. Even worse, MySqlDataReader will crash when adavancing with its Read method other than accessing with the GetGuid method, the exception does not indicate which row and which column generates this error, the application can not be recovery at this point. Imagine you are retrieve a big result set, it's a pain to do the troubleshooting. Thanks.
[21 Sep 2010 17:19]
Andrey Belykh
There is a workaround: use "old guids=true" in the connection string. Hopefully, this option will not be deprecated.