At 12:46 2015-07-16, Ted Roche <tedro...@gmail.com> wrote:
On Thu, Jul 16, 2015 at 3:09 PM, Ken Dibble <krdib...@stny.rr.com> wrote:

> Okay. Somebody else said SELECTs operate in their own data session.

I think Laurie meant something else.

In this case what I mean is this, starting from a fresh VFP session:

create table temp (field1 c(10), field2 date)
use  && no tables open
select * from temp into cursor notsotemp
select 0
use temp && File is in use!

If you run DISPLAY STATUS, you'll see Temp is open, (Readonly) Alias: NOTSOTEMP

USED("temp") returns .F. since the table is aliased, even though that
might not have been your intent.

SQL might leave tables open is how I remember it being documented. Not wanting this, I wrote a routine that I call after executing SQL statements:

***** Start of Routine *****
* closeforsql
* Close Table Possibly Opened by SQL
* Last Modification: 2000-08-29
*
*      Tables opened for reading by SQL select commands might not be closed.
* At least, this is the behaviour (undocumented and subject to change)
* currently exhibited (VFP 5 SP 3).  This procedure looks for the default
* alias and closes the table.  This should not interfere with xBASE uses as
* with them, the standard in CBS2 is to create a nondefault alias name on
* use.
*
*      It would be nice if Microsoft were to pick up after itself.

procedure closeforsql
lparameters thealias

   if type("alias(thealias)")#T_U
      use in (thealias)
      endif

   return

   endproc
***** End of Routine *****

     CBS2 is my app.  T_U is #defined as T_UNDEFINED (of foxpro.h).

Sincerely,

Gene Wirchenko


_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to