Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select SQL vs Copy to Array While... -- Which one wins?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00008720
Message ID:
00008832
Vues:
30
>>Assume we have an memvar called cDesiredID
>>
>>Select Recno() as RecNum, Field1, Field2, etc from MyTable into Cursor MyCursor Where Member_ID = cDesiredID
>>
>>compared to:
>>
>>Seek cDesiredID
>>RecNoSave=Recno()
>>Copy to Array MyArray Fields AnyField, Field1,Field2, etc While Member_ID=cDesiredID
>>GoTo RecNoSave
>>For I=1 to _Tally
>> MyArray(i,1)=RecnoI()
>> Skip
>>EndFor
>>Use Mycursor
>>Zap
>>Append From Array MyArray
>>
>>Result: The second method, surprising to me, is much, much faster when MyCursor contains only a few (less than a dozen) records. I haven't tested it with more (not necessary in my app).

2 things

first - using the select SQL shouldn't be much slower if your
indexes are set right - but basically if every thing is
ok the select will do something simmilar

regarding option 2 - why use an array, u can simply CREATE CURSOR and copy directly into it

Arnon
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform