Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to use Free Table in SCAN clause
Message
From
03/09/2003 10:17:43
 
 
To
03/09/2003 10:09:06
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00824579
Message ID:
00825665
Views:
26
Hiya Tracy,

I'm not sure that your code actually shows anything per se :) You perform a SELECT but do not test for what happens during the SELECT execution - which my code does by incorporating the dummy function.

What your code does next is a simple SCAN...ENDSCAN on the query table which obviously shows the record number changing - the function of the SCAN...ENDSCAN. But there is no code within the SCAN that would affect the record pointer of the MYFILE table and hence it doesnt change.

The original question was (a) does the SQL SELECT open another copy of a table (yes it does as --sb-- pointed out and is shown by my code snippet) and (b) does the SQL SELECT change the record pointer of the source table (no it doesnt, again as pointed out by --sb--).

Nice to chat!

Later!


>SNIP
>>One could enhance this little program to show that for each record being processed in alias B the source record pointer does not change - if you wanted to prove the record pointer issue. But this is in my mind pointless since why would VFP open a second copy of the file if not to use it?
>
>I tested it just for fun:
>
>
>CLEAR
>CLOSE all
>SET SAFETY OFF
>CREATE TABLE c:\temp\myfile (cletter c(30))
>SELE myfile
>FOR i = 97 TO 122
>	APPEND BLANK
>	REPLACE cletter WITH CHR(i)
>ENDFOR
>GO ToP
>CLOSE TABLES
>USE c:\temp\MyFile ALIAS myfile
>SELECT * from MyFile
>SELE myfile
>GO TOP
>SELE query
>GO TOP
>*--Does the source record pointer change?
>SCAN
>	? "Record number in query: "+ALLTRIM(STR(RECNO('query')))
>	? "Record number in myfile: "+ALLTRIM(STR(RECNO('myfile')))
>ENDSCAN
>CLOSE tables
>RETURN
>
In the End, we will remember not the words of our enemies, but the silence of our friends - Martin Luther King, Jr.
Previous
Reply
Map
View

Click here to load this message in the networking platform