| Bug #30547 | MyODBC 3 / ADO - Returning double the field size for blob types - regression | ||
|---|---|---|---|
| Submitted: | 21 Aug 2007 21:26 | Modified: | 13 Sep 2007 11:34 |
| Reporter: | Erica Moss | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / ODBC | Severity: | S2 (Serious) |
| Version: | 3.51.19 | OS: | Windows (XP sp2) |
| Assigned to: | Jim Winstead | CPU Architecture: | Any |
| Tags: | ADO definedSize blob | ||
[25 Aug 2007 23:19]
Kent Boortz
This seems to be caused by a change for bug#27862. If the character set is "binary" the size returned is doubled. The call to SQLDescribeCol() in "result.c" calls get_column_size() in "utility.c" that contains case MYSQL_TYPE_TINY_BLOB: case MYSQL_TYPE_MEDIUM_BLOB: case MYSQL_TYPE_LONG_BLOB: case MYSQL_TYPE_BLOB: case MYSQL_TYPE_GEOMETRY: if (field->charsetnr == 63) return length * 2; else return length / mbmaxlen; }
[4 Sep 2007 19:49]
Jim Winstead
Fix reported value of column size for binary fields
Attachment: bug30547.patch (text/plain), 4.22 KiB.
[5 Sep 2007 18:45]
Jim Winstead
The fix for this bug has been committed to the repository, and will be included in the next release (3.51.20).
[13 Sep 2007 11:34]
MC Brown
A note has been added to the .3.51.20 changelog: The wrong column size was returned for binary data.

Description: According to our manual these are the capacities of the blob types. In 3.51.17 this is what was reported as the field size in the ADO.Field.DefinedSize property. After this point the size is being reported as twice these values: BLOB L + 2 bytes, where L < 2^16 MEDIUMBLOB L + 3 bytes, where L < 2^24 in .17 blob DefinedSize = 65535 mediumblob DefinedSize = 16777215 longblob DefinedSize = -1 (overflow) Currently: blob DefinedSize = 131070 medblob DefinedSize = 33554430 longblob DefinedSize = -2 (overflow again) How to repeat: Setup: CREATE TABLE defsize (C1 INT PRIMARY KEY, C2 BLOB, C3 MEDIUMBLOB, C4 LONGBLOB); INSERT INTO defsize VALUES (1, 'blob', 'medblob', 'longblob'); VB CODE: Private Sub DefSizeTest() On Error GoTo EH Dim strSQL, strConn As String Dim connection1 As adodb.Connection Dim recset1 As adodb.Recordset Dim fld As Field Set connection1 = New adodb.Connection Set recset1 = New adodb.Recordset strSQL = "SELECT * FROM defsize" strConn = "DRIVER={MySQL ODBC 3.51 Driver};" & _ "SERVER=localhost;DATABASE=ado" & _ ";USER=root;PASSWORD=mypass;OPTION=3;" ' open connection connection1.ConnectionString = strConn connection1.CursorLocation = adUseClient connection1.Open ' open recordset recset1.Open strSQL, connection1, adOpenStatic, adLockOptimistic, adCmdText For Each fld In recset1.Fields Debug.Print fld.Name & " " & fld.Type & " " & fld.DefinedSize Next recset1.Close Set recset1 = Nothing connection1.Close Set connection1 = Nothing Exit Sub EH: Debug.Print Err.Number & ":" & Err.Description recset1.Close Set recset1 = Nothing connection1.Close Set connection1 = Nothing End Sub