Bug #8509 MySqlDataAdapter.FillSchema does not interpret unsigned integer
Submitted: 15 Feb 2005 0:11 Modified: 24 Feb 2005 17:26
Reporter: Sean Vostinar Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:1.0.4.20163 OS:Windows (Win 2k)
Assigned to: Reggie Burnett CPU Architecture:Any

[15 Feb 2005 0:11] Sean Vostinar
Description:
MySqlDataAdapter.FillSchema does not respect the auto_increment flag on unsigned integers, i.e. the method does not set DataColumn.AutoIncrement = True when the source column is defined as int(M) unsigned NOT NULL auto_increment.

This bug did not effect signed integer columns in my testing.

How to repeat:
Given a table, `myTable`, with a column `myPK` defined as int(M) unsigned NOT NULL auto_increment, tested with M = 10 or 11:

        Dim Conn as MySqlConnection = New MySqlConnection
        Conn.ConnectionString = "User ID=;Password=;" & _          
                "Host=localhost;Port=3306;database="

        Dim ds as DataSet = New Dataset("Test")

        Dim da as MySqlDataAdapter = New MySqlDataAdapter

        With da
            .SelectCommand = New MySqlCommand("SELECT * FROM myTable", Conn)
            .FillSchema(ds, SchemaType.Source, Table)
            
            'Workaround: ds.Tables(Table).Columns("myPK").AutoIncrement = True
            .Fill(ds.Tables(Table))
        End With

Suggested fix:
Respect the auto_increment flag on unsigned integer columns.
[15 Feb 2005 8:35] Sean Vostinar
Please insert Conn.Open() to the above recreation code.
[18 Feb 2005 7:45] Sean Vostinar
Upon further use, I've found that the unsigned flag is not respected at all.  This is a more serious problem.
[18 Feb 2005 8:23] Sean Vostinar
Upon further, further use, I have also misdiagnosed the failure -- Its actually in the write back to the database, rather than the population of the schema.
[24 Feb 2005 17:26] 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:

1.0.4 had a general problem with auto incremented columns.  This should be better now.
[24 May 2007 20:31] Gert Brigsted
This bug still appears to be there. I am using Connector/NET 5.0.6 and MySQL 5.0.27.

I have the same problem, the AutoIncrement flag is not set if the datatype is unsigned int.