Correct way to set Session.PrivateDir? 
Author Message
 Correct way to set Session.PrivateDir?

Basic but crucial question:

Users' IDAPI.CFG contains a PRIV alias, but this doesn't wind up in
Session.PrivateDir.  Instead, Session.PrivateDir contains the startup
path of the exe.

What is the "best" method to set the app's private directory from the
PRIV alias?

Thanks.

--
Frank Burleigh 812-333-7082 (home); 812-855-9170 (work)
School of Law, Indiana University, Bloomington, IN  47405



Tue, 17 Mar 1998 03:00:00 GMT  
 Correct way to set Session.PrivateDir?

Quote:

>Basic but crucial question:
>Users' IDAPI.CFG contains a PRIV alias, but this doesn't wind up in
>Session.PrivateDir.  Instead, Session.PrivateDir contains the startup
>path of the exe.
>What is the "best" method to set the app's private directory from the
>PRIV alias?

Nothing in Delphi itself provides the functionality to retrieve the Private
Directory setting from the BDE configuration. A direct call to the BDE
function DbiGetSesInfo (BDE functions can be called from Delphi
applications) will get this information. The DbiGetSesInfo function
requires a single parameter, a structure of type pSESInfo. It returns a
value of type DBIResult, indicating the success or failure of the operation
(any return value but DBIERR_NONE indicates a failure). The szPrivDir field
of the pSESInfo structure will contain the reference to the Private
Directory from the BDE configuration (in the form of a PChar, which will
need to be converted to a Pascal string). As when making a direct call to
any BDE API function, the BDE wrapper units DbiTypes, DbiErrs, and DbiProcs
must be included in the Uses section of the unit making the call.

Here is an example Delphi procedure using the DbiDetSesInfo function:

  procedure TForm1.Button1Click(Sender: TObject);
  var
    Info: SESInfo;
    rslt: DBIResult;
    Msg: String;
  begin
    rslt := DbiGetSesInfo(Info);
    if rslt = DBIERR_NONE then
      msg := StrPas(Info.szPrivDir)
    else
      Msg := 'Could not retrieve session information!';
    ShowMessage(Msg);
  end;

(Another field of the pSESInfo structure that may be of common interest is
szNetDir, which is the NET DIR setting from the BDE configuration.)

**************************************************************************
Steve Koterski
Local InterBase Server Technical Support
Borland International, Inc.



Tue, 17 Mar 1998 03:00:00 GMT  
 Correct way to set Session.PrivateDir?
[Description of how to call the BDE to get the PRIV alias directly.]

Thanks very much Steve, that's helpful.  One lingering question: do I
have to init the BDE to use this technique?  If so, would I shut it
down as well before going on to other work?  I would want to do this
stuff during the FormCreate of the main form (which doesn't itself do
any db stuff, but child forms will).

--
Frank Burleigh 812-333-7082 (home); 812-855-9170 (work)
School of Law, Indiana University, Bloomington, IN  47405



Wed, 18 Mar 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Session.PrivateDir -- How many do you need?

2. Session.PrivateDir

3. Setting PrivateDir ?!?!?

4. Need help on setting the correct languagedriver for a table

5. how set correct german varchars in interbase

6. Stop a query by setting the session for call back

7. Set Term fails during ISQL session Why?

8. dynamically created session and database : cannot avoid login prompt - fine with default session

9. Help... Session.PrivateDir not works ?!

10. 2 ways to refer field in Data Module

11. Wanted: big databases that are corrupted in interesting ways

12. Ways to test the .EXE final program ???

 

 
Powered by phpBB® Forum Software