" *****************************************************************************************************
*
*  setscrll.txt
*
*   This examples shows how to use setScrollOptions 
*
*
******************************************************************************************************"

|connection1  aTextDisplay connectString statement1 fConcurrency crowKeySet crowRowSet |

aTextDisplay := TextWindow  windowLabeled: 'ODBC Interface - Using setScrollOptions '
                           frame: (0 @ 0 corner: 500 @ 500).
aTextDisplay cr.



" *** Open the connection ****"
connection1 := OdbcConnection open.
connection1 hasError
    ifTrue:
    [    aTextDisplay nextPutAll: connection1 getMessage; cr
    ].



" *** Driver  Connect ***  "
connectString :=  connection1 driverConnect: '' window: aTextDisplay
        driverCompletion: (OdbcDriverCompletions at: 'DRIVERPROMPT').

connection1 hasError
    ifTrue:
    [    aTextDisplay nextPutAll: connection1 getMessage; cr
    ].

" *** allocate a new statement *** "
statement1:= connection1 newStatement.
statement1 hasError
    ifTrue:
    [    aTextDisplay nextPutAll: statement1 getMessage; cr
    ].

                         

fConcurrency := Prompter prompt: 'Please Enter concurrency Option (1,2,3,4):' default: ''.
crowKeySet :=  Prompter prompt: 'Please Enter crowKeySet Option (0,-1,-2):' default: ''. 
crowRowSet :=  Prompter prompt: 'Please Enter crowRowSet Option:' default: ''.


"*** change the Scroll Options ***"
statement1 setScrollOptions: fConcurrency asInteger
                                                crowKeySet: crowKeySet asInteger 
                                                crowRowSet: crowRowSet asInteger.


statement1 hasError
    ifTrue:
    [    aTextDisplay nextPutAll: statement1 getMessage; cr
    ].



aTextDisplay cr.

"*** free the statement *** "
statement1 free: (OdbcConstants at: 'SQLDROP').
statement1 hasError
    ifTrue:
    [    aTextDisplay nextPutAll: statement1 getMessage; cr
    ].

" *** disconnect *** "
connection1 disconnect.
connection1 hasError
    ifTrue:
    [    aTextDisplay nextPutAll: connection1 getMessage; cr
    ].


" *** free the connection *** "

connection1 free.
connection1 hasError
    ifTrue:
    [    aTextDisplay nextPutAll: connection1 getMessage; cr
    ].


aTextDisplay nextPutAll: '*** finished executing ***'.
