| Bug #14691 | GetSchema does not use IsUnsigned so Parameter types are never set to unsigned | ||
|---|---|---|---|
| Submitted: | 7 Nov 2005 7:53 | Modified: | 17 Dec 2005 9:23 |
| Reporter: | Michael Hunley | Email Updates: | |
| Status: | No Feedback | Impact on me: | |
| Category: | Connector / NET | Severity: | S2 (Serious) |
| Version: | 1.0.6 | OS: | Windows (WinXPPro and RH9 Mono) |
| Assigned to: | CPU Architecture: | Any | |
[17 Nov 2005 9:23]
Vasily Kishkin
Sorry...I was not able to reproduce the bug. Could you please attach full text of text case ?
[18 Dec 2005 0:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".

Description: There are two bugs in this case. First, the CommandBuilder::CreateParameter does not handle unsigned fields, specifically ints that fill their system type size (e.g. int(10) fills a System.Int32 and unsigned overflows). This cannot be corrected without fixing the second bug: the GetSchema does not keep the IsUnsigned field. How to repeat: Create a table with an int(10) field set to unsigned. Use a MySqlDataAdapter tied to a MySqlCommandBuilder to read the data in, modify the int field to System.UInt32.MaxValue, then do an Update. You should get a System.Overflow exception. Suggested fix: Add a column for the IsUnsigned field in the schema table. Us it in the CommandBuilder::CreateSchema after creating the MySqlParameter to set IsUnsigned there. Something like: p.IsUnsigned = (bool)row["IsUnsigned"]; Here are the diff's to add this, which I tested in my harness. I do not know if this should also be done in other places or rolled into one or more of the MySqlParameter constructors for better performance/less data thrashing. Cheers. diff wB C:\MySqlNetConnector1.06\mysqlclient\CommandBuilder.cs C:\Source\MySql.Data\CommandBuilder.cs 245a246,247 > > p.IsUnsigned = (bool)row["IsUnsigned"]; diff wB C:\MySqlNetConnector1.06\mysqlclient\datareader.cs C:\Source\MySql.Data\datareader.cs 489a490 > dataTableSchema.Columns.Add ("IsUnsigned", typeof (bool)); 518a520 > r["IsUnsigned"] = f.IsUnsigned;