Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Indexing SQL results
Message
De
09/09/1997 12:39:10
 
 
À
09/09/1997 12:32:54
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00049056
Message ID:
00049170
Vues:
63
>>>>| cursor. Issuing the query and changing the recordsource to the cursor are
>>>>
>>>>| easy enough, but the indexing is posing a problem, because as far as I
>>>>| know, you can only index tables and views. Is the only way to do this to
>>>>
>>>>SELECT ... INTO CURSOR cMyCursor
>>>>
>>>>USE DBF('cMyCursor') IN 0 Alias cMyTemporaryTable AGAIN
>>>>
>>>>USE IN cMyCursor
>>>>
>>>>SELECT cMyTemporaryTable
>>>>
>>>>INDEX ON ... TAG ...
>>>>
>>>>The file name of the table is smth like 348745548.tmp. You don't
>>>>have to worry about that. The index file willhave the same name.
>>>>
>>>>Sorin
>>>
>>>Sorin- thanks for your reply, this is what I needed. (I think). I'm a little unclear on a thing or 2 however...
>>>What is different about the temporary when it is first created as opposed to after being used again? How does VFP decide which ones can be indexed? I guess my question is. technically speaking. what is the difference between a cursor and a temporary table?
>>
>>Table is dbf file, cursor is tmp file stored in Temporary Files folder. When you close a cursor it's deleted automatically, temp table should be deleted explicitly. Cursor created by SELECT-SQL is read-only and must be opened in another work area (like Sorin suggested) to be modified, indexed, etc. If you created cursor using CREATE CURSOR, it can be modified immediately.
>
>Edward- do you mean to create a cursor, and then append from the SQL cursor? If so, is there a way around having to name and define each field? (table has about 80 fields). I was thinking that I could select into an array and then 'CREATE CURSOR cmytemptable FROM ARRAY cmyarray', but was having problems gettting that to work.
>
>Could you give some example code as to how you would use CREATE CURSOR to accomplish this? BTW- the SQL SELECT statement looks like SELECT * from table where blah blah blah. (there are no explicitly named columns)
>
>Thanks again for your help. BTW- will you be at DevCon next week?
>
>Erik

Select table1
=afields(aStructure)
Create Cursor tmpCur from array aStructure
Select * From table1 into array aTmpdata && can be limited by array size
Insert into tmpCur From Array aTmpdata

Unfortunately, I cannot visit DevCon.
Edward Pikman
Independent Consultant
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform