Bug #34301 MyODBC / ADO cursor type set to forward only if cmd is adCmdTableDirect
Submitted: 5 Feb 2008 1:59 Modified: 5 Feb 2008 22:05
Reporter: Erica Moss Email Updates:
Status: Verified Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:3.51.23, 5.1.8 OS:Windows (XP sp2)
Assigned to: Assigned Account CPU Architecture:Any
Tags: odbc51_postga

[5 Feb 2008 1:59] Erica Moss
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 9: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 22:05] Erica Moss
Added a runable test case to ADO conformance tests
/bugs/34301.vbs
[13 Dec 2010 8:29] Bogdan Degtyariov
Verified for 3.51.27 and 5.1.8, so it is not 3.51-specific problem