WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

ADO DAO
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

ADO softseek


ADO Recordsets have a Supports() method and a number of enum's which help with the relation between the provider, the cursor location and the cursor type. The script does a simple loop and outputs the results to a text file. In the script I hard-coded an Access Table, and have attached the results for both the Client and Server cursor locations. You will see comments in the script over the exact constant value for indexing and seeking

;// Winbatch 2003G -
;// Script to Test supported functionality
;// when a Recordset is Opened under different cursors
;//
;// Stan Littlefield - May 15, 2003
;//
;// NOTES: Need to determine the correct enums for both
;//        index and seek [see comments in enum section]
;//
;//        This script uses the new FilePut() Winbatch function
;//        If using a prior WB release, re-write the script
;//        code for FileOpen(), FileWrite(), FileClose()
;//
;//
;// Revision History
;//
;//
;//
;//
;/////////////////////////////////////////////////////////////

; Enum for the Recordset Supports() method
adAddNew = 16778240      ;0x1000400 Supports the AddNew method to
                         ;add new records.
adApproxPosition = 16384 ;0x4000 Supports the AbsolutePosition
                         ;and AbsolutePage properties.
adBookmark = 8192        ;0x2000 Supports the Bookmark property
                         ;to gain access to specific records.
adDelete = 16779264      ;0x1000800 Supports the Delete method
                         ;to delete records.
adFind = 524288          ;0x80000 Supports the Find method to
                         ;locate a row in a Recordset.
adHoldRecords = 256      ;0x100 Retrieves more records or changes
                         ;the next position without committing
                         ;all pending changes.

;//NOTE - the first value, taken from the VB ADO Constants
;//       is supported, the 2nd Value taken from the Supports
;//       enum in the MDAC/ADO SDK appears to fail
;//
;// the same applies to adseek [below]
adIndex = 8388608        ;0x800000 Supports the Index property to
;adIndex = 1048576        ;0x100000 Supports the Index property to
                         ;name an index.

adMovePrevious = 512     ;0x200 Supports the MoveFirst and MovePrevious
                         ;methods, and Move or GetRows methods to move
                         ;the current record position backward without
                         ;requiring bookmarks.
adNotify = 262144        ;0x40000 Indicates that the underlying data provider
                         ;supports notifications (which determines
                         ;whether Recordset events are supported).
adResync = 131072        ;0x20000 Supports the Resync method to update
                         ;the cursor with the data that is visible
                         ;in the underlying database.

;// see comments for adIndex [above]
adSeek = 4194304         ;0x400000 Supports the Seek method to locate a
;adSeek = 2097152         ;0x200000 Supports the Seek method to locate a
                         ;row in a Recordset.

adUpdate = 16809984      ;0x1008000 Supports the Update method to modify
                         ;existing data.
adUpdateBatch = 65536    ;0x10000 Supports batch updating (UpdateBatch
                         ;and CancelBatch methods) to transmit groups of
                         ;changes to the provider.

; Enum of CursorTypes
adOpenForwardOnly = 0
adOpenKeyset = 1
adOpenDynamic = 2
adOpenStatic = 3

; Lock Status
adLockOptimistic = 3

; CursorLocation
adUseServer = 2
adUseClient = 3

; Create Winbatch arrays
aCursors = ArrDimension(4)
aCursors[0] = adOpenForwardOnly
aCursors[1] = adOpenKeyset
aCursors[2] = adOpenDynamic
aCursors[3] = adOpenStatic

aCursorsTxt = ArrDimension(4)
aCursorsTxt[0] = "adOpenForwardOnly"
aCursorsTxt[1] = "adOpenKeyset"
aCursorsTxt[2] = "adOpenDynamic"
aCursorsTxt[3] = "adOpenStatic"

aSupports = ArrDimension(13)
aSupports[0] = adAddNew
aSupports[1] = adApproxPosition
aSupports[2] = adBookmark
aSupports[3] = adDelete
aSupports[4] = adFind
aSupports[5] = adHoldRecords
aSupports[6] = adIndex
aSupports[7] = adMovePrevious
aSupports[8] = adNotify
aSupports[9] = adResync
aSupports[10] = adSeek
aSupports[11] = adUpdate
aSupports[12] = adUpdateBatch

aSupportsTxt = ArrDimension(13)
aSupportsTxt[0] = "adAddNew"
aSupportsTxt[1] = "adApproxPosition"
aSupportsTxt[2] = "adBookmark"
aSupportsTxt[3] = "adDelete"
aSupportsTxt[4] = "adFind"
aSupportsTxt[5] = "adHoldRecords"
aSupportsTxt[6] = "adIndex"
aSupportsTxt[7] = "adMovePrevious"
aSupportsTxt[8] = "adNotify"
aSupportsTxt[9] = "adResync"
aSupportsTxt[10] = "adSeek"
aSupportsTxt[11] = "adUpdate"
aSupportsTxt[12] = "adUpdateBatch"


cTXT = StrCat(dirget(),"MyDBSupports.txt")
If FileExist(cTXT) Then FileDelete(cTXT)

;// I am using an Access 2000 Database and Table
;// you should be able to substitute other ADO sources
;// and Providers

MyDB = StrCat(dirget(),"RESORTS.MDB")
If ! FileExist(myDB) Then Exit
BoxOpen("Please Wait...","Creating Recordset Supports() log")
MyTable = "Resorts"
String = ""
indent = "   - "
cConn = "Provider=MicroSoft.Jet.OLEDB.4.0; Data Source=%MyDB%"

RS = ObjectOpen("ADODB.Recordset")

;// try it with both cursor locations
;// see how it affects support for index and seek
;// just make sure one set is commented out
RS.CursorLocation = adUseServer
String = StrCat(String,cConn,@CRLF,"Using Server Cursor",@CRLF)

;RS.CursorLocation = adUseClient
;String = StrCat(String,cConn,@CRLF,"Using Client Cursor",@CRLF)

String = StrCat(String,"Opening Table %MyTable%",@CRLF)
For i = 0 To 3
   String = StrCat(String,aCursorsTxt[i],@CRLF)
   RS.Open(MyTable,cConn,aCursors[i],adLockOptimistic,1)
   Gosub getFeatures
   RS.Close()
Next
ObjectClose(RS)
FilePut(cTXT,String)
BoxShut()
Exit

:getFeatures
For j = 0 To 12
  If RS.Supports(aSupports[j])
     String = StrCat(String,indent,"Supports ",aSupportsTxt[j],@CRLF)
  Else
     String = StrCat(String,indent,"Does Not Support ",aSupportsTxt[j],@CRLF)
  Endif
Next
Return

Article ID:   W16077
File Created: 2004:03:30:15:42:44
Last Updated: 2004:03:30:15:42:44