Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with writeable cursors
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00319138
Message ID:
00319194
Vues:
13
>Dear All,
>
>I found the following syntax to make a cursor writeable:
>
>USE DBF("cMyCursor") IN 0 AGAIN ALIAS cAnotherCursor
>
>But if I use the following :
>
>select anyfield from MyTable into cursor cMyCursor
>
>then DBF() gives back the path of the original table, but I don't want to write into the original table.
>After some reasonong, I have tried using the following:
>
>select anyfield from MyTable into cursor cMyCursor nofilter
>
>then DBF() gives a really temporary filepath.


Bela,
A simple way to make a writable cursor is to create a new cursor from scratch. I always use:

SELECT (your stuff here) into cursor temp1
mfile = dbf('temp1')
=afields(mflds)
create cursor work from array mflds
append from (mfile)
use in temp1

This has several advantages. The first is that you have a clean new cursor that you can do anything you want with. Second is you can index it as many ways as you want and the cdx will go away when you release the cursor. You can write to and index a sql result cursor that you use again but if you create more than one tag I have found that the temp index files stay around. Although this method may look like it could take a while to run it is instantanious. I have run it with a result of over a thousand records and you can't notice it. I guess because it's all in memory.

In case you wonder where the file actually is, look in whatever directory you put your temp files and you will see a new temp file created while the cursor exists. It will also stay there if your program locks up.
Beer is proof that God loves man, and wants him to be happy. - Benjamin Franklin
John J. Henn
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform