I appear to have a deep misunderstanding of how VFP cursors work
My code is littered with examples like this as the quickest way to establish the presence of a record meeting arbitrary conditions where a simple INDEXSEEK isn't appropriate
SELECT * FROM (ANYTABLE) WHERE (ANYCONDITION) INTO CURSOR 'JUNK'
IF RECCOUNT('JUNK')>0
DO SOMETHING
ELSE
DO SOMETHING_ELSE
ENDIF
This has worked for years.
Suddenly it doesn't.
I was so shocked, I assumed that either my data or my VFP installation had become corrupt.
I eliminated the former by trying it on various different tables from different sources
I eliminated the latter by first, thoroughly uninstalling all traces of VFP, then reinstalling it.
Then repeating the experiment on two other workstations where I had VFP installed.
The result is consistent.
What actually happens is that the Cursor is created with a filter matching (ANYCONDITION) and, if you're running this from a command line, for a few seconds you see the result you expect (eg 0 Records if you know that no records match the condition) but then the status bar displays the name of the Cursor, its table of origin and the result count followed by RECCOUNT() of the original table (and now Cursor) (eg "Junk (path to table) Record 1/(RECCOUNT('ANYTABLE')") . The cursor is displaying the result count because it is now in a filter which matches ANYCONDITION. But if I clear the filter (SET FILTER TO) what I have is a full copy of (ANYTABLE) in cursor JUNK.
In contrast, if, instead of INTO CURSOR 'JUNK' I use INTO DBF 'JUNK' the results are exactly what I expect.
So
1 am I deluded in my expectation that the contents of CURSOR should be identical to the contents of the DBF equivalent?
2 If so, how on earth have I been getting away with it up to now? My software has often depended on this simple test and up till about a week ago neither I nor my clients have ever encountered a problem resulting from the use of such code
3 If not (i.e. we all agree that CURSORS should behave in accord with my prior expectations) how on earth could this behaviour change, simultaneously, on 3 different VFP workstations? (which don't even have the same version of Windows 10 running)
(It's only because it failed in some code I'm working on at the moment, that I discovered this aberrant behaviour from the command line)