Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
INTO CURSOR NOFILTER?
Message
 
To
01/11/2000 21:23:05
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00436986
Message ID:
00439222
Views:
14
Hi Jasper,

I'll try and help you understand this a little better. One of FoxPro's strengths has always been speed. Back in the old days, it ran circles around all its rivals. It accomplished this speed by using all sorts of tricks behind the scenes. These tricks are all referred to as "Rushmore optimization." In most cases, Rushmore operates invisibly behind the scenes without harming you. The NOFILTER command was created to help developers get around one of Rushmore's "tricks" which can sometimes give you unwanted results.

When Rushmore sees that you are doing a SQL-SELECT which is just like the table itself, i.e. "SELECT * FROM Table INTO CURSOR MyCursor" it does a trick of using the table again with the alias of your cursor name (setting a filter if needed.) Normally, this is not a problem. But, if you later want to do something with the original table, you will have a problem. Here's some code you can use to see what I mean:
** Change to the sample data directory
cd home() + "/samples/data"

** Create a cursor which is really just the source table with an alias
SELECT * FROM Country INTO CURSOR MyCursor

** Display the datasession dialog
SET

** Notice that you now have two worksessions in use, MyCursor and Country
** Now, close Country
USE IN Country

** Now, if you just have a CURSOR holding the results of country, this line of 
**code should work:
USE Country EXCLUSIVE IN 0

** But, you get a File is in use error.  That's because MyCursor is really just
** Country.dbf 
** Let's close everything and use NOFILTER to see what changes.
CLOSE DATA ALL

SELECT * FROM Country INTO CURSOR MyCursor NOFILTER

** Close the source table
USE IN Country

** Now try to open Country exclusive.
USE Country EXCLUSIVE IN 0

** You see that you can open it exclusively now.  Cool eh?
** The help file is complicating the issue by telling you 
** how the old timers used to handle this problem.  They 
** would create a dummy column which prevented Rushmore from
** doing the Alias trick.  The select would look like this:
SELECT *, SPACE(1) AS Dummy FROM Country INTO CURSOR MyCursor

** The  that you mention just means "not equal", the same as #.
I hope this helps. And, to you lurking old timers, sorry if I got any of the history wrong. I've only been around since VFP 3.0.

Marty


>----The following is copied from msdn online help about SQL SELECT(VFP6)------
>Include NOFILTER to create a cursor that can be used in subsequent queries. In previous versions of Visual FoxPro, it was necessary to include an extra constant or expression as a filter to create a cursor that could be used in subsequent queries. For example, adding a logical true as a filter expression created a query that could be used in subsequent queries:
>
>SELECT *, .T. FROM customers INTO CURSOR myquery
>------------------
>Hi all,
> I don't understand the function of the NOFILTER, and I also don't understand the meaning of <>
> Sorry, I am a fresh people in VFP6, can you help.....
>-Jasper
Marty Smith, CSQE
Previous
Reply
Map
View

Click here to load this message in the networking platform