Bug #26164 MyODBC ADO field attribute adFldMayDefer shouldn't be set for Text/Blob fields
Submitted: 7 Feb 2007 20:53 Modified: 31 Jan 2008 18:35
Reporter: Erica Moss Email Updates:
Status: Won't fix Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:3.51.20 - 5.1.0 OS:Windows (win xp)
Assigned to: Jess Balint CPU Architecture:Any

[7 Feb 2007 20:53] Erica Moss
Description:
Currently the Field attribute adFldMayDefer is being set for the following MySQL data types: text, mediumtext, longtext, blob, mediumblob, longblob

From my discussions it is not believed that we support this functionality so the attribute should be removed.

Definition of this attribute:
adFldMayDefer:
Indicates that the field is deferred—that is, the field values are not retrieved from the data source with the whole record, but only when you explicitly access them.

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 Connector/ODBC v5};" & _
        "SERVER=localhost;DATABASE=ado" & _
        ";UID=root;PWD=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 (adFldMayDefer And fld.Attributes) = adFldMayDefer Then
           MsgBox "field Type: " & fld.Type & "True"
       Else
           MsgBox "field Type: " & fld.Type & "False"
       End If
    Next
End Function
[8 Feb 2007 13:50] Bogdan Degtyariov
Duplicated by the bug #26165.
Please put your comments into the bug #26165.
[8 Feb 2007 13:52] Bogdan Degtyariov
Oops...
Sorry, it is not the same.
Trying to verify.
[8 Feb 2007 14:41] Bogdan Degtyariov
Verified. We do not support such functionality, but the attribute is set.
[21 Feb 2007 18:24] Jess Balint
I ran this test against v3 and v5, and get the same result (true for all long data types).

Eric, can you verify that this is incorrect on v3 also?

I looked at the ODBC trace logs and cannot find how it is deriving this. I compared v3 and v5 and besides some tiny differences, they seem to be returning the same thing.

In the end, I don't think this attribute matters much since nothing that I can think of would be affected by its value.
[31 Oct 2007 4:14] Erica Moss
Retested this with both 3.51.20 and 5.1.0  The results are identical.  The fields in question say that they support adFldMayDefer 

Test case added to ado-compliance\trunk\bugs\26164.vbs