Bug #34301 MyODBC / ADO cursor type set to forward only if cmd is adCmdTableDirect
Submitted: 5 Feb 2008 2:59 Modified: 5 Feb 2008 23:05
Reporter: Eric MaLossi
Status: Verified
Category:Connector/ODBC Severity:S3 (Non-critical)
Version:3.51.23 OS:Microsoft Windows (XP sp2)
Assigned to: Target Version:
Tags: odbc51_postga
Triage: D4 (Minor)

[5 Feb 2008 2:59] Eric MaLossi
Description:
In the following cases, when a cursorType of adOpenStatic is requested, the resulting
recordSet will be opened with that cursor type:

adUseClient - adCmdText, or adCmdTable, or adCmdTableDirect
adUseServer - adCmdText, or adCmdTable

However a recordSet opened as adUseServer, adOpenStatic, adCmdTableDirect will result in
a forwardOnly recordSet

How to repeat:
Sub Test()
   On Error Resume Next
   Dim strSQL, oConn, oRs, vbSingleQuote, recordCount, curType
   Set oConn = CreateObject("ADODB.Connection")
   Set oRS = CreateObject("ADODB.RecordSet")
   strSQL = "ado_test"

   ' open connection
   oConn.ConnectionString = connstr
   oConn.CursorLocation = adUseServer
   Err.Clear
   oConn.Open
   If Err.Number <> 0 Then
      Call Cleanup (oConn, oRs)
      Assert.Trace Err.Number & "::" & Err.Description
      On Error Goto 0
      Assert.Failure "Error opening connection"
   End If

   ' open record set
   oRS.Open strSQL, oConn, adOpenStatic, adLockOptimistic, adCmdTableDirect
   If Err.Number <> 0 Then
      Call Cleanup (oConn, oRs)
      Assert.Trace Err.Number & "::" & Err.Description
      On Error Goto 0
      Assert.Failure "Error opening Record Set"
   End If

   ' Verify
  If oRs.CursorType <> adOpenStatic Then
    PrintType oRs.CursorType, curType
    On Error Goto 0
    Assert.Trace "Record Set opened as " & curType & " instead of adOpenStatic"
    Call Cleanup (oConn, oRs)
    Assert.Failure "Test Failed"
  End If
	
  Call Cleanup (oConn, oRs)
End Sub
[5 Feb 2008 10:09] Tonci Grgin
Hi Eric and thanks for your report. Can you please fix attached test case so that
"curType" gets assigned? This way it is only normal that it fails...
[5 Feb 2008 23:05] Eric MaLossi
Added a runable test case to ADO conformance tests
/bugs/34301.vbs