Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: Brad Schulz
  Where is Brad Schulz?
 San Carlos
 California - United States
 Brad Schulz
 To: Jack Ryan
  Where is Jack Ryan?
 Auckland
 New Zealand
 Jack Ryan
 Tags
Subject: RE: Clashing tmp filenames with 12 instances
Thread ID: 210781 Message ID: 210996 # Views: 18 # Ratings: 1
Version: Visual FoxPro 9 Category: Web Applications
Date: Thursday, January 08, 2009 7:37:13 PM         
   


> Tushar, the trouble is that the tmpfiles setting is established very early in VFP's instantiation. After which it cannot be changed. So, if you alter the tmp or temp environment variable inside your VFP app, VFP does not see the change. You could make the change in a wrapper which is fine if you're running the app yourself which generally is not the case for a com app. If you do wrap your com app in a wrapper that sets a new tmpfiles location, running the vfp app will yield a separate process- iow it will be the wrapper rather than your vfp app that is accessible to the calling application via com. I suppose it would be possible to create a com wrapper that changes tmpfiles and then provides passthrough access to everything in your app... I'll think about that.



If that's not successful, then you could SELECT INTO TABLE instead of INTO CURSOR and create the temporary tables yourself. This may be a big pain if you have lots of SELECT statements in your program.

But you can create a GUID (Globally Unique IDentifier) and use that for your temporary table name like so:

declare integer CoCreateGuid in OLE32.DLL string @lcGUID
lcBinaryGUID=space(16)
CoCreateGuid(@lcBinaryGUID)  &&Set lcGUID in Binary Form
lcGUID=""
for xx=1 to 16 step 4
  lcGUID=lcGUID+rightc(transform(ctobin(substrc(lcBinaryGUID,xx,4)),"@0"),8)
endfor
lcTempFileName=lcTempPath+lcGUID+".DBF"
select ... into table (lcTempFileName)
use (lcTempFileName) exclusive alias CursorName


Just an idea...

--Brad



COMPLETE THREAD
Clashing tmp filenames with 12 instances Posted by Jack Ryan @ 1/7/2009 7:06:57 PM
RE: Clashing tmp filenames with 12 instances Posted by Brad Schulz @ 1/7/2009 7:14:43 PM
RE: Clashing tmp filenames with 12 instances Posted by Jack Ryan @ 1/7/2009 11:01:16 PM
RE: Clashing tmp filenames with 12 instances Posted by tushar @ 1/7/2009 7:17:45 PM
RE: Clashing tmp filenames with 12 instances Posted by Jack Ryan @ 1/7/2009 11:05:52 PM
RE: Clashing tmp filenames with 12 instances Posted by tushar @ 1/8/2009 8:00:35 AM
RE: Clashing tmp filenames with 12 instances Posted by Jack Ryan @ 1/8/2009 7:12:43 PM
RE: Clashing tmp filenames with 12 instances Posted by Brad Schulz @ 1/8/2009 7:37:13 PM
RE: Clashing tmp filenames with 12 instances Posted by Jack Ryan @ 1/8/2009 9:00:22 PM
RE: Clashing tmp filenames with 12 instances Posted by tushar @ 1/8/2009 8:32:12 PM
RE: Clashing tmp filenames with 12 instances Posted by Anders Altberg @ 1/8/2009 6:38:21 PM
RE: Clashing tmp filenames with 12 instances Posted by Brad Schulz @ 1/8/2009 6:53:57 PM