Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Enhancing Performance
Message
De
20/06/2014 14:41:11
 
 
À
20/06/2014 11:10:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01602118
Message ID:
01602149
Vues:
97
>Performance Increased a Lot particularily by Using
>
>IF MOD(lnCount, 100) = 0
>WAIT WINDOW 'Remaining Records...'+ALLTRIM(STR(RECNO())) NOWAIT
>ENDIF
>
>However this line is inserting records at the bottom of file and not below the required record so I have kept my original code there
>
>INSERT INTO BillFile (POS) VALUES (cTexttwo)
>
>Any suggestion , Please Intimate
>
>Harsh

The old INSERT command has been deprecated in VFP (meaning it is still there but it isn't recommended that you use it).

If I remember correctly, that's because it needs to rebuild the file each time you do the insert command. For small files, the processing time is negligible and doesn't have a material impact on performance. But, the bigger the file, the longer each iteration takes and you reach a point where the system slows to a crawl.

I would suggest something like
SELECT *,000000000.0000 as SortKey FROM billfile INTO CURSOR billfile2 READWRITE
REPLACE ALL sortkey WITH recno() IN billfile2
lnInsertnum = 0.0000
** Do your code and when you come to the point where you want to do the insert
lnInsertnum = lnInsertnum + .0001
lnSortKey = sortKey + lnInsertNum

INSERT INTO billfile2 VALUES ( < all the insert values >,lnSortKey)
** finish your code.

At the end you can
SELECT < all the fields except sortkey > FROM billfile2 ORDER BY sortkey INTO CURSOR billfile READWRITE
and I would expect the records to be in the sequence you want. If the way I've expressed it isn't clear, maybe somebody can explain it better.

........Rich
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform