>#DEFINE SERVERNAME (local) > >CLEAR > >CLOSE DATABASES all > >DELETE FILE TestSimultaneousFetch.dbc >CREATE DATABASE TestSimultaneousFetch > >CREATE CONNECTION testConn CONNSTRING [driver=SQL SERVER;server=SERVERNAME;database=Northwind] >DBSETPROP('testConn',"CONNECTION","Asynchronous",.F.) > >CREATE SQL VIEW testView1 REMOTE CONNECTION testConn SHARE as select * from categories >DBSETPROP('testView1','view', 'AllowSimultaneousFetch',.T.) >DBSETPROP('testView1','view', 'fetchasneeded', .T.) >DBSETPROP('testView1','view', 'fetchsize',1) > >SELECT 0 >USE testView1 >? USED() >#IF VERSION(5)>800 > ? CURSORGETPROP("RecordsFetched") >#ENDIF >? 'Busy testView1 ',SQLGETPROP(CURSORG("ConnectHandle"),"ConnectBusy") >*=RECCOUNT() && WorkAround >* next command fetch all the Server Cursor rows, but have two bugs: >* ODBC calls: >* .... fetching SQL_ROWSET_SIZE=0x1000 ! good, override the fetchsize >* .... BUG1 ( with fetchasneeded=.T. ) : Another <SQL_ROWSET_SIZE>=fetchsize !!!! ( fixing: ignore fetchasneeded ) >* .... SQLExtendedFetch <SQL_FETCH_NEXT> return 1 >* .... fetch cycle >* .... SQLGetData columns loop >* .... BUG2 : <SQL_ROWSET_SIZE>=0 => Error Argument Invalid ( correct it is another SQLExtendedFetch ) >* .... BUG3 : SQLCancel => this clear the ODBC error ( fixing : remove this command on VFP C code : fixed on VFP9 beta ) >* .... SQLErrorW => of course return (SQL_NO_DATA_FOUND) and VFP convert it into ODBC out of resource ( fixed on VFp9b ) >* .... PRB4 : SQLCancel : this is a bad design choice, best it is return error into VFP and leave to VFP developer to fix the error >* .... SQLCloseCursor >INDEX ON .F. TAG TTT >BROWSE >>