Board index » delphi » set BDE NET DIR from within an InstallSheild or Wise install

set BDE NET DIR from within an InstallSheild or Wise install

It seems perfectly reasonable to me that there should be a way to set
the NET DIR from within an automated install. I imagine a small
program that finds IDAPI32.cfg in the BDE\DLLPATH registry key and
accepts one or both of alternative CFG path and NETDIR location as
command-line parameters.

Once the user had designated the new install location for the
executables and sent them there, the install script would call an
external exe to set NETDIR.
I program in Paradox, so this is a bit obtuse for me.
Can anyone help with an existing s{*word*99} of code?

John Beukema

 

Re:set BDE NET DIR from within an InstallSheild or Wise install


If you want to set the NetDir from an EXE see the examples for
DbiOpenCfgInfoList at www.borland.com/devsupport/bde/bdeapies . If you use
Wise 6.01 or later you can set any BDE configuration parameter as follows.

To set BDE parameters with Wise 6.01 and later add the following to the
parameters for any alias that is created.

\SYSTEM\INIT\LOCAL SHARE: TRUE
\DRIVERS\PARADOX\INIT\NET DIR: %MAINDIR%\BDENET

--
Bill

Re:set BDE NET DIR from within an InstallSheild or Wise install


I have spent some time with DbiOpenCfgInfoList after getting your
reply. I have looked at the following code and attempted to compile it
in Delphi4. I get a string of errors where variables and constants are
not recognized. About 10 in all.
I am an abolute newbie to Delphi and could use some pointers (no joke)
For instance, hCur is typed as hDBICur. What or where is that defined?

var
  hCur : hDBICur;
  Config : CFGDesc;
  ContinueIt: boolean;
...
  if DbiInit(nil) = DBIERR_NONE then
  begin
    hCur := nil;
    if DbiOpenCfgInfoList(nil, dbiREADWRITE, cfgPersistent,
        '\\DRIVERS\\PARADOX\\INIT', hCur) = DBIERR_NONE then
    begin
      if DbiSetToBegin(hCur) = DBIERR_NONE then
      begin
        ContinueIt := true;
        while ContinueIt do
        begin
          if(DbiGetNextRecord(hCur, dbiWRITELOCK, @Config, nil)
                 <> DBIERR_NONE) then
            ContinueIt := false
          else
            if StrIComp(Config.szNodeName, 'NET DIR') = 0 then
            begin
              StrCopy(Config.szValue, 'servervolumemydir');
              DbiModifyRecord(hCur, @Config, true);
              ContinueIt := false
            end;
        end;
      end;
    end;
    DbiExit();
  end;

On Sat, 17 Feb 2001 14:58:20 -0700, "Bill Todd \(TeamB\)"
<billtodd...@nospam.qwest.net> , in borland.public.bde, wrote:

Quote
>If you want to set the NetDir from an EXE see the examples for
>DbiOpenCfgInfoList at www.borland.com/devsupport/bde/bdeapies . If you use
>Wise 6.01 or later you can set any BDE configuration parameter as follows.

>To set BDE parameters with Wise 6.01 and later add the following to the
>parameters for any alias that is created.

>\SYSTEM\INIT\LOCAL SHARE: TRUE
>\DRIVERS\PARADOX\INIT\NET DIR: %MAINDIR%\BDENET

Re:set BDE NET DIR from within an InstallSheild or Wise install


You must add the BDE unit to the uses clause in the unit that contains the
code.

--
Bill

Re:set BDE NET DIR from within an InstallSheild or Wise install


That helps! Thanks. I think the rest of my problems are in the
province of the OP group.

John B.

On Sun, 18 Feb 2001 10:52:35 -0700, "Bill Todd \(TeamB\)"
<billtodd...@nospam.qwest.net> , in borland.public.bde, wrote:

Quote
>You must add the BDE unit to the uses clause in the unit that contains the
>code.

Ditch the Attitude to respond

Re:set BDE NET DIR from within an InstallSheild or Wise install


When I was asking syntax question over in bpdOP, Chris Lichti offered
this:
==========
Also, I think there's an easier way to do what you want.  Take a look
at the ModifyDriver of TSession in the Delphi Help.  You can just use
the global singleton "Session" defined in dbtables.  The following
code works on my machine (I tested it):

program Project1;
uses  Messages, SysUtils, Dialogs, BDE, dbtables, classes;

{$APPTYPE CONSOLE}

var
  slDriverParams: TStringList;
begin
  slDriverParams := nil;
  try
    slDriverParams := TStringList.Create;
    slDriverParams.Values['NET DIR'] := 'servervolumemydir';
    Session.ModifyDriver('PARADOX', slDriverParams);
    Session.SaveConfigFile;
  finally
    slDriverParams.Free;
  end;
end.

========================================

It works perfectly but is a bit fatter than the straight BDE API
coding (about 463K). I found that the bit of code I was using only
wrote to the CFG file. it did nothing to open it or reveal its
structure and data, So Mr. Lichti's code is now in production, with
some additions to read a command-line parameter and show some
procedural commentary in the program window.

Thanks to all!

John Beukema
On Sun, 18 Feb 2001 10:52:35 -0700, "Bill Todd \(TeamB\)"
<billtodd...@nospam.qwest.net> , in borland.public.bde, wrote:

Quote
>You must add the BDE unit to the uses clause in the unit that contains the
>code.

Lose the Attitude to respond

Re:set BDE NET DIR from within an InstallSheild or Wise install


I am looking at the API function DbiInit, which gathers values for,
amongst others, CFG file location and BDE location. Do these values
come from the registry:HKEY_LOCAL_MACHINE\Software\Borland\Database
Engine\CONFIGFILE01 and \DLLPATH respectively? What is the sibling
entry \SAVECONFIG = WIN32 for?

Essentially, the entire CFG file contents are located here in the
registry. When a BDE session begins, does it get all or part of its
values from the registry,  or from the file, or refresh the registry
from the file, or what?

On Sun, 18 Feb 2001 10:52:35 -0700, "Bill Todd \(TeamB\)"
<billtodd...@nospam.qwest.net> , in borland.public.bde, wrote:

Quote
>You must add the BDE unit to the uses clause in the unit that contains the
>code.

Lose the Attitude to respond

Re:set BDE NET DIR from within an InstallSheild or Wise install


If the Win 3.1 compatibility option is on then all of the settings are saved
to the configuration file and the values in the file are the ones that are
used. If the option is set to Win32 then most of the values are stored in
the registry only. See Object | Options | Save For Use With in BDE
Administrator.

--
Bill

Re:set BDE NET DIR from within an InstallSheild or Wise install


Very Informative. Years of careless acceptance of BDE behavior are
lining up and standing at attention.

One more question if I may: I am attempting to compile Example 3 from

http://www.inprise.com/devsupport/bde/bdeapiex/dbiopencfginfolist.html

and the compiler is sticking on a pByte dataType. I am using BDE,
Messages, Classes,sysUtils; in my header but it still {*word*88}s. Is there
an additional library or DLL I should be using to import a pByte
definition?

On Tue, 20 Feb 2001 16:35:55 -0700, "Bill Todd \(TeamB\)"
<billtodd...@nospam.qwest.net> , in borland.public.bde, wrote:

Quote
>If the Win 3.1 compatibility option is on then all of the settings are saved
>to the configuration file and the values in the file are the ones that are
>used. If the option is set to Win32 then most of the values are stored in
>the registry only. See Object | Options | Save For Use With in BDE
>Administrator.

Lose the Attitude to respond

Re:set BDE NET DIR from within an InstallSheild or Wise install


PByte is declared in the Windows unit.

--
Bill

Re:set BDE NET DIR from within an InstallSheild or Wise install


I am a bit abashed at this being so simple. Would you tell me how I
could have found this on my own? I looked for pByte in a lot of places
and never saw it declared. Is it the case that the Windows Unit is
standard to all Delphi apps?

Thanks a lot for your help with this. I have learned a lot more than I
thought I needed to know about this project. It will stand me in good
stead for the future.

On Wed, 21 Feb 2001 14:38:58 -0700, "Bill Todd \(TeamB\)"
<billtodd...@nospam.qwest.net> , in borland.public.bde, wrote:

Quote
>PByte is declared in the Windows unit.

Lose the Attitude to respond

Other Threads