Friday, March 9, 2007

Connector/Net 5.0.5 has a problem

As many of you have already discovered, Connector/Net 5.0.5 does not work correctly with Tools for Visual Studio.  The symptom is that when the plugin tries to enumerate all the tables in the database, it reports that it gets back an improper data type.  The cause of this problem is somewhat involved so I thought I would blog on it.

Since the early days of the connector, binary data was not always handled correctly.  Specifically, columns that were reported to the connector as CHAR and VARCHAR were returned as System.String.  This is, of course, not always correct.  The case that prompted the changes was a bug report that SELECT _binary "foo" would return foo as a System.String instead of System.Byte[] as it should.

The fix is to always respect the binary markers that the server sends, which 5.0.5 does.  The problem is that MySQL incorrectly reports some columns as binary such as the name column from the output of 'SHOW TABLE STATUS'.  To work around this issue, much of my GetSchema code had to be reworked to use a datareader instead of a dataadapter.  This way I can use GetString() to get a string representation of the column even though it is binary.

All this would have been fine except I failed to test the plugin with 5.0.5 and apparently still have a case where a string column is being returned as binary.  I'm looking into it right now and we'll get a 5.0.6 out right away with this issue addressed.

4 comments:

  1. Thanks for the post, Reggie -- this will save me some time.

    ReplyDelete
  2. Replica HandbagsJune 15, 2009 at 4:27 PM

    would have been fine except I failed to test the plugin with 5.0.5 and apparently still have a case where a string column is being returned as binary. I'm looking into it right now and we'll get a 5.0.6 out right away with this issue addressed.

    ReplyDelete
  3. Christian AudigierJuly 13, 2009 at 8:53 PM

    I like how you write.Are you interesting in a part time writer job?

    ReplyDelete
  4. This is the best post on this topic i have ever read.


    Regards

    Pitter

    ReplyDelete