Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with SQLExec () sequences
Message
 
To
14/11/2012 19:29:44
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01557240
Message ID:
01557249
Views:
58
>Hi,
>
>The VFP help file says (in the topic "Speeding Up Data Retrieval"):
>
>Using Progressive Fetching
>
>"When you query a remote data source, Visual FoxPro retrieves complete rows of data and builds a Visual FoxPro cursor. To speed retrieval of remote data, Visual FoxPro employs progressive fetching of view cursors and cursors created asynchronously with SQL pass-through. Rather than requiring you or your application to wait while an entire data set is retrieved, Visual FoxPro executes a query and fetches only a small subset of the result set rows into the local cursor. The size of this subset is 100 rows by default."
>
>Note
>"Synchronous SQL pass-through statements don't employ progressive fetching. The entire result set requested by a SQLEXEC() statement is retrieved before control is returned to your application."
>
>"As Visual FoxPro retrieves additional rows of data, the local cursor contains increasingly more of the queried data. Since rows are retrieved at different times from the data source, the information in the rows isn't automatically current. If your connection is operating in asynchronous mode,Visual FoxPro returns control to you or your program as soon as it fetches the first subset of data. During idle time, Visual FoxPro performs a background fetch of the remaining rows in the queried data, one subset at a time, into the local cursor. This scenario allows you to use the already fetched data in the cursor without having to wait for the rest of the data."
>
>Note
>"Increasing the number of rows fetched improves performance, but decreases the responsiveness of the user interface. Decreasing the number of rows fetched has the inverse effect."
>
>When the query will take a long time to be performed, I wanted to show the percentage done after each SQLExec () fetch (as far as I know the total amount of records that will be retrieved (as in as SQLExec (nSQLHandle, "Select Count (*).....").
>
>But I didn't find the right sequence of statements to do what I want. I tried many combinations, but none worked. Below is the structure of some of them). Note, that some sequences employed SQLMoreResults (nSQLHandle, , "MyCursor") as well.
>
>What happens is that when the SQLExec () is executed, for the very first time, it brings all records in the table.
>
> cSQLcommand = "Select * From MyTable"
>
> SQLSetProp (nSQLHandle......)
> SQLSetProp (nSQLHandle......)
>
> SQLPrepare (nSQLHandle, cSQLcommand, "MyCursor")
> 
> Do While SQLExec (nSQLHandle) = 0
>
>    Calculates [percentage done]
>    
>    Wait Window [percentage done]  + " press [Esc] to cancel" NoWait
>
>    If InKey (.001) = 27
>       SQLCancel (nSQLHandle)
>    endif
>
> EndDo
> 
> SQLSetProp (nSQLHandle......)
> SQLSetProp (nSQLHandle......)
>
>Any help will be highly appreciated.
>
>Thanks!


Check FAQ #8150
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform