Bug #17375 CommandBuilder ignores Unsigned flag at Parameter creation
Submitted: 14 Feb 2006 13:27 Modified: 28 Feb 2006 22:31
Reporter: Martin Karch Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:1.0.7 OS:Microsoft Windows (Windows XP)
Assigned to: Reggie Burnett CPU Architecture:Any

[14 Feb 2006 13:27] Martin Karch
Description:
the MySQLCommandBuilder Object always sets SByte für Byte, Int32 for UInt32 (and so on) in the MySQLParameter.DbType and the IsUnsigned flag always is False; so if e.g. in a Byte column a value > 127 should be set, .NET crashes with an OverFlowException

How to repeat:
- create a table with unsigned Column(s)  (e.g. 'size')
- create code:

Sub test
  Dim da As New MySqlDataAdapter("SELECT size FROM test",conn)
  Dim cb As New MySqlCommandBuilder(da)

  Dim dt As New DataTable
  da.Fill(dt)

  Dim dv As New DataView(dt)
  Dim row as DataRowView

  row=dv.AddNew
  row("size")=120
  row.EndEdit
  da.Update(dv.Table)   '<= works, because value < 127

  row=dv.AddNew
  row("size")=135
  row.EndEdit
  da.Update(dv.Table)   '<= crashes with System.OverflowException

End Sub

  

Suggested fix:
Set IsUnsigned and DbType Properties correctly.
[28 Feb 2006 22:30] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/3281
[28 Feb 2006 22:31] 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

Additional info:

Fixed in 1.0.8 by properly supporting new unsigned MySqlDbType enum values.