Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to implement FetchAsNeeded
Message
De
29/07/2003 13:54:39
 
 
À
28/07/2003 22:51:05
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00814414
Message ID:
00814631
Vues:
9
Hi Ramil,

To set view properties you should use DBSETPROP function instead of CURSORSETPROP.
If "FetchAsNeeded" is set to .T., USE command will fetch only first batch of records if "FetchSize">0. You shouldn't set "MaxRecords" property unless you really want to truncate result produced by a query. You don't have to use "asynchronous" connection. BTW, asynchronous processing for shared connection is broken in VFP8. Depending from backend, "AllowSimultaneousFetch" property must be set to .T. to allow second view to be opened while the first view has some records to fetch.

Thanks,
Aleksey.


>Hi all,
>
>Is this the correct implementation of FetchAsNeeded? See comments.
>
>dbsetprop("cConnName","connection","asynchronous",.t.)
>cursorsetprop("FetchSize", 50, 0)
>cursorsetprop("MaxRecords", 50, 0)
>cursorsetprop("FetchAsNeeded", .t., 0)
>* assume this query takes 10+ seconds to run, I want to display
>* the grid at once with the first 50 rows and 'fetch' the remaining data
>* in the background.
>nLocID = 12345
>cSQL1 = "select "+;
>           "a.itemid,b.locname,a.yearweek,c.skustat, d.itemname, e.supplier "+;
>        "from "+;
>           "dailysales a, locs b, sku c,items d, suppliers e "+;
>        "where "+;
>          "a.locid=b.locid "+;
>          "and a.itemid=c.itemid and a.locid=c.locid "+;
>          "and a.itemid=d.itemid "+;
>          "and d.suppid=e.suppid "+;
>          "and a.locid=?nLocID "
>create sql view (cViewName1) remote connection (cConnName) shared as &cSQL1
>use (cViewName1) in 0 alias (cViewAlias1)
>* will VFP continue processing the following lines of code
>* even before all the records in cViewName1 are "fetched".
>* this is just a view that will be a "child" of the current record of the above view.
>create sql view (cViewName2) remote connection (cConnName) shared as &cSQL2
>use (cViewName2) in 0 alias (cViewAlias2) nodata && note: nodata keyword
>
>
>These queries are for the purpose of explaining my question. Assume that the queries
>will work.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform