Description:
I have been using various versions of MySQL with MyODBC 3.51.12 reliably (for what we do) for around 18 months. The application is written in ASP.NET, but I use the ODBC connector because the Connector/NET was less reliable at the outset of the project.
Recently a colleague upgraded MyODBC to 3.51.22, and our application failed.
Essentially, the command "DESCRIBE USERS" should return data as a sequence of strings (as it does on MyODBC 3.51.12), but with MyODBC 3.51.22, the result is an array of bytes.
The byte data appears to be an ascii value representation of the string, so I could work around, but clearly this is a fault that has been introduced.
How to repeat:
'NB) derived from code and may need work to compile
dim dbase as new ODBCConnection("Driver={MySQL ODBC 3.51 Driver};Server=xxx.xxx.xxx.xxx;Port=3306;Database=xxxxxx;User=xxxxxxx;Password=xxxxxxx;Option=2050;")
dbase.open()
Dim drc As DataRowCollection
Dim dt As New DataTable
Dim dr As DataRow
Dim typestr As String
Dim types As String()
Dim tc As Collection
Dim i As Int32
Dim cmd As New OdbcCommand
Dim adp As New OdbcDataAdapter(cmd)
cmd.connection=dbase
cmd.CommandText="describe users"
dbase.open()
adp.Fill(dt)
drc=dt.rows
For Each dr In drc
'CRASH: We expect dr("Field") to be of type String, but we get an Array of Bytes
If dr("Field") = column Then
typestr = dr("Type")
If LCase(Left(typestr, 3)) = "enu" Then
types = Split(Mid(typestr, 7, Len(typestr) - 8), "','")
Else
types = Split(Mid(typestr, 6, Len(typestr) - 7), "','")
End If
tc = New Collection
For i = LBound(types) To UBound(types)
tc.Add(types(i))
Next
setcache.Add(table & "##" & column, tc)
Return tc
End If
Next
dbase.close()
Suggested fix:
I believe that one of the threads relating to similar bugs says that the solution is to detect the use of DESCRIBE and variations of the SHOW command and build meta information such that the client processes the data as strings.