Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cursor vs. filter
Message
De
19/07/2005 08:50:10
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
19/07/2005 08:22:46
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 6 SP5
Database:
Visual FoxPro
Divers
Thread ID:
01033773
Message ID:
01033788
Vues:
19
>I have a table and I need to determine if there is more than one record for an employee. Is it faster to set a filter based on that employee and check the record count or create a query into a cursor?
>
>Also if I filter based on the employee, will that affect the sort order? Will the first record for the employee that appears in the table as it is sorted still be the first one?
>
>If I query into a cursor, there is a chance that it may not be sort the same way unless I specify a sort order, correct?
>
>Thank you

To show data, a cursor (perhaps an updatable view) is definitely faster. VFP 6 has a serious speed problem when showing a filtered table in a grid.

If you only want to count the data, and not let the user see/edit it, the fastest would be to set an index, SEEK the first value, and then use COUNT WHILE. You can re-open the table in another alias, so as not to affect your current record position, sort order and filter.

A filter will not affect the sort order.

To query into a cursor, VFP will use whatever order is specified in the query statement. If no ORDER BY is specified, you shouldn't count on the data being in any specific order, but you can also create an index on the cursor.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform