Bug #27115 MyODBC / ADO cmd option adCmdTableDirect is not returning any records
Submitted: 14 Mar 2007 6:32 Modified: 5 Feb 2008 1:12
Reporter: Erica Moss Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:3.51.22 - 5.1.1 OS:Windows (XP sp2)
Assigned to: Erica Moss CPU Architecture:Any

[14 Mar 2007 6:32] Erica Moss
Description:
When Connection.Execute is called with the adCmdTableDirect command options no records are being returned.

According to Docs-
adCmdTableDirect: Evaluates CommandText as a table name whose columns are all returned. Used with Recordset.Open or Requery only. To use the Seek method, the Recordset must be opened with adCmdTableDirect. This value cannot be combined with the ExecuteOptionEnum value adAsyncExecute.

adCmdTable: Evaluates CommandText as a table name whose columns are all returned by an internally generated SQL query.

How to repeat:
mysql> CREATE TABLE ado_test (C1 INT PRIMARY KEY, C2 CHAR);
mysql> INSERT INTO ado_test VALUES (1,'A'),(2,'B'),(3,'C');

VB code:
Sub OptionTest()
On Error GoTo EH
    Dim strConn As String
    Dim connection1 As ADODB.Connection
    Dim recset1 As ADODB.Recordset
    Dim iRecCount As String

    Set connection1 = New ADODB.Connection

    strConn = "DRIVER={MySQL ODBC 3.51 Driver};" & _
        "SERVER=localhost;DATABASE=ado" & _
        ";USER=root;PASSWORD=mypass;OPTION=35;"

    ' open connection
    connection1.ConnectionString = strConn
    connection1.CursorLocation = adUseServer
    connection1.Open

   ' open recordset with adCmdTable works and returns 3 rows
   Set recset1 = connection1.Execute("ado_test", iRecCount, adCmdTable)
   If recset1.State And adStateOpen Then
        MsgBox iRecCount & " rows returned"
   End If
   recset1.Close
   
   ' open recordset with adCmdTable Fails and returns -1
   Set recset1 = connection1.Execute("ado_test", iRecCount, adCmdTableDirect)
   If recset1.State And adStateOpen Then
        MsgBox iRecCount & " rows returned"
   End If
   
   If recset1.State And adStateOpen Then
       recset1.Close
   End If
   If connection1.State And adStateOpen Then
       connection1.Close
   End If
   Set recset1 = Nothing
   Set connection1 = Nothing
End Sub
[22 Oct 2007 13:23] Susanne Ebrecht
Bug #27116 is a duplicate of this bug here.
[6 Jan 2008 0:42] Erica Moss
Retested with 3.51.22 and 5.1.1 problem exists as written in both versions
[31 Jan 2008 19:13] Tonci Grgin
Eric, please reverify and add ODBC trace + what you expect to be returned.
[5 Feb 2008 1:12] Erica Moss
although the recordcount is reporting -1, the data is being returned.  There may still be a problem with the recordCount property and if so, will enter it as a new bug.

Test case added to ado conformance tests
/bugs/27115.vbs