Bug #26165 MyODBC ADO field attribute adFldLong should be set for Text/Blob fields
Submitted: 7 Feb 2007 22:48 Modified: 12 Feb 2007 22:14
Reporter: Eric MaLossi
Status: Verified
Category:Connector/ODBC Severity:S3 (Non-critical)
Version:3.51 OS:Microsoft Windows (win xp)
Assigned to: Eric MaLossi Target Version:5.1
Triage: D4 (Minor)

[7 Feb 2007 22:48] Eric MaLossi
Description:
Currently the adFldLong field attribute is set for all Text/Blob fields (except the tiny
ones) in MyODBC 5.0.  It is believed that it should also be set these fields in MyODBC
3.51.

How to repeat:
mysql> CREATE TABLE ado_test (c1 TEXT, c2 MEDIUMTEXT, c3 LONGTEXT, c4 BLOB, c5
MEDIUMBLOB, c6 LONGBLOB);

mysql> INSERT INTO ado_test VALUES ("foo", "more foo", "still more foo", "bar",
"more bar", "foo bar");

In VB
Dim strSQL As String
Dim strConn As String
Dim oConn As ADODB.Connection
Dim oRs As ADODB.Recordset
Dim fld As ADODB.Field

Public Function myTest()
    Set oConn = New ADODB.Connection
    Set oRs = New ADODB.Recordset
    strSQL = "select * from ado_test"

    strConn = "DRIVER={MySQL ODBC 3.51 Driver};" & _
        "SERVER=localhost;DATABASE=ado" & _
        ";USER=root;PASSWORD=mypass;OPTION=3;"
    
    oConn.ConnectionString = strConn
    oConn.CursorLocation = CInt(adUseClient)
    oConn.Open
    oRs.Open strSQL, oConn, adOpenStatic
    oRs.MoveFirst
    
   For Each fld In oRs.Fields
       If (adFldLong And fld.Attributes) = adFldLong Then
           MsgBox "field Type: " & fld.Type & "True"
       Else
           MsgBox "field Type: " & fld.Type & "False"
       End If
    Next
End Function
[8 Feb 2007 14:19] Bogdan Degtyariov
Hello Eric,

I checked your VB code in MS Access with MyODBC 3.51.12 and it displayed "True" for all
fields. This means that adFldLong flag is set for these fields. Accordingly to your
report it showed "False" for you? Did I miss something?
Please comment.
Thanks.
[9 Feb 2007 22:30] Eric MaLossi
Hmm, my bad I should have checked this code before submitting.  For some reason VB6 is
returning a different aggregate attribute value for these fields, than does VBscript. 
The former returns 234 as the attribute property for MySQL Text columns, which when And'd
with adFldLong does return true.

However VBScript says fld.attribues for a Text field is 104, which doesn't include
adFldLong.  I'd be tempted to blame this on a VB bug, however if you run the same
VBscript test against MyODBC 5.0 drivers this same property for this same column is 138
which does include adFldLong, so we are doing something different between these two
drivers.

Please look in the ADO compliance tests scripts and run fldattributes.vbs against MyODBC
3.51 and 5.0, detailed test output is presented in ../common/FldAttributes-Results.txt