Board index » delphi » Temporary files/directories?

Temporary files/directories?

I have two problems with temporary files/directories:

1) I regularly read on this newsgroup that we need to specify a
private directory for each session we create, because otherwise
temporary files could conflict.  There is no such warning in the
official Inprise documentation though.
Can somebody confirm that we have to create a temp directory for each
TSession component we create?  I think this is absurd: the BDE should
make temp files unique...
BTW: I'm using dBase files.

2) Maybe the affirmation of the answer to the previous question,
following SQL statement on a dBase file creates a *permanent*
"Field2.NDX" file:
    update Table1
    set IsUsed = '1'
    where Field1 in (
         select Field2 from Table2
         where Field2 is not null
    )
- Is this a known bug?
- Is it safe to remove the NDX file myself?
- Are there other 'temporary' files that I should delete myself?

Thanks,

Jan

 

Re:Temporary files/directories?


Quote
>1) I regularly read on this newsgroup that we need to specify a
>private directory for each session we create, because otherwise
>temporary files could conflict.  There is no such warning in the
>official Inprise documentation though.
>Can somebody confirm that we have to create a temp directory for each
>TSession component we create?  I think this is absurd: the BDE should
>make temp files unique...
>BTW: I'm using dBase files.

If you put a session component and you set its AutoSessionName to true then as
long as you do not specify a privateDir property you do not have to create
unique private directories for each session.
However if you manage your own sessions you will need to provide a privateDir
for each of them.

--
Brian Bushay (TeamB)
Bbus...@DataGuidance.com

Re:Temporary files/directories?


Brian,

I looked at the source for TSession and cannot find any relation
between PrivateDir and AutoSessionName.  As far as I can see the
SessionName is a pure Delphi thing while PrivateDir goes directly to
the BDE via DbiSetPrivateDir.  Can you elaborate please?

If I create a PrivateDir for each session does this mean that I'm also
responsible for deleting it?

I also did some testing and found that if you don't specify PrivateDir
the BDE is happy using the same directory for temporary files for each
session (i.e. the current directory).  If you set all PrivateDir's to
let's say 'C:\TEMP' you get the error 'Directory is busy' for each
additional session you try to open!???

On Wed, 07 Oct 1998 03:26:11 GMT, BBus...@DataGuidance.com (Brian

Quote
Bushay TeamB) wrote:

>If you put a session component and you set its AutoSessionName to true then as
>long as you do not specify a privateDir property you do not have to create
>unique private directories for each session.
>However if you manage your own sessions you will need to provide a privateDir
>for each of them.

Re:Temporary files/directories?


Quote

>I looked at the source for TSession and cannot find any relation
>between PrivateDir and AutoSessionName.  As far as I can see the
>SessionName is a pure Delphi thing while PrivateDir goes directly to
>the BDE via DbiSetPrivateDir.  Can you elaborate please?

I do not have any additional details

Quote

>If I create a PrivateDir for each session does this mean that I'm also
>responsible for deleting it?

Yes if you feal it needs to be deleted

Quote
>I also did some testing and found that if you don't specify PrivateDir
>the BDE is happy using the same directory for temporary files for each
>session (i.e. the current directory).  If you set all PrivateDir's to
>let's say 'C:\TEMP' you get the error 'Directory is busy' for each
>additional session you try to open!???

That is basicly what I told you in the original message although I thought this
was limited to Autosession being true

--
Brian Bushay (TeamB)
Bbus...@DataGuidance.com

Re:Temporary files/directories?


Quote
>>I also did some testing and found that if you don't specify PrivateDir
>>the BDE is happy using the same directory for temporary files for each
>>session (i.e. the current directory).  If you set all PrivateDir's to
>>let's say 'C:\TEMP' you get the error 'Directory is busy' for each
>>additional session you try to open!???
>That is basicly what I told you in the original message although I thought this
>was limited to Autosession being true

Brian,

I did some further testing (and thinking) about this problem and it
appears that the BDE is never ensuring that unique temporary filenames
are created.  So I come to the conclusion that the fact that the BDE
is not complaining when *not* setting privatedir on additional
sessions is just some kind of laziness on the BDE's part.

Inprise should warn us that we *always* have to create and provide a
PrivateDir unless we are sure that only *one* instance of our
application with only *one* session is running on *one* single
machine...

Other Threads