Board index » delphi » Modifying the BDE languagedriver at runtime?

Modifying the BDE languagedriver at runtime?

Is it possible te modify the foxpro languagedriver in the BDE at
runtime? and How? any example?

Thanks,
Bert van der Hoeven

 

Re:Modifying the BDE languagedriver at runtime?


On Sat, 05 Aug 2000 10:58:49 +0200, "G.D. van der Hoeven"

Quote
<GDvdHoe...@wxs.nl> wrote:
>Is it possible te modify the foxpro languagedriver in the BDE at
>runtime? and How? any example?

If you mean the default language driver for FoxPro, here is an
example:

  procedure SetupFoxLangDriver;
  const
     InitPath = '\Drivers\FoxPro\Init';
     LangDriverDesc = 'LangDriver';
     LangDriverValue = 'DBWINWE0';
  var
     Cursor: HDbiCur;
     ConfigDesc: CfgDesc;
  begin
     Check(DbiInit(nil));
     Check(DbiOpenCfgInfoList(nil, dbiReadWrite, cfgPersistent,
        InitPath, Cursor));
     try
        while DbiGetNextRecord(Cursor, dbiNoLock, @ConfigDesc, nil) =
                 0 do
        begin
           if StrIComp(ConfigDesc.szNodeName, LangDriverDesc) = 0 then
           begin
              if StrIComp(ConfigDesc.szValue, LangDriverValue) <>
                 0 then
              begin
                  Check(DbiGetRecord(Cursor, dbiWriteLock,
                    @ConfigDesc, nil));
                  StrPCopy(ConfigDesc.szValue, LangDriverValue);
                  Check(DbiModifyRecord(Cursor, @ConfigDesc, True));
              end;
           end;
        end;
     finally
        DbiCloseCursor(Cursor);
        DbiExit;
     end;
  end;

(include BDE and DBTables in you uses clause)

HTH,

Jan

Re:Modifying the BDE languagedriver at runtime?


Thanks,

Quote
> If you mean the default language driver for FoxPro, here is an
> example:

Yes.
If it is possible to modify it for a alias than that is to ok.
Is it passible?

Bert van der Hoeven

Re:Modifying the BDE languagedriver at runtime?


On Sun, 06 Aug 2000 14:43:37 +0200, "G.D. van der Hoeven"

Quote
<GDvdHoe...@wxs.nl> wrote:
>If it is possible to modify it for a alias than that is to ok.

Language drivers are not alias related for the native BDE drivers.
The default language driver is used when creating new tables.
DBase/Fox tables that come from another source (usually a DOS program)
and don't have a language driver stored in their header will use this
default driver as well.
Tables created through the BDE do have a language driver in their
header.  You can change it using DbiDoRestructure.  Here's an example
of this:

procedure ChangeTableLanguage(Table: TTable);
const
   OptData: PChar = 'DBWINWE0';
   OptDesc: FldDesc = (szName: 'LANGDRIVER'; iOffset: 0; iLen: 9);
var
   CursorProp: CurProps;
   TblDesc: CRTblDesc;
   DBHnd: hDBIDb;
begin
   Table.Open;
   Check(DbiGetCursorProps(Table.Handle, CursorProp));
   FillChar(TblDesc, SizeOf(TblDesc), #0);
   with TblDesc do
   begin
      StrCopy(szTblName, CursorProp.szName);
      StrCopy(szTblType, CursorProp.szTableType);
      // Set the language driver
      iOptParams := 1;
      pFldOptParams := @OptDesc;
      pOptData := OptData;
   end;
   DBHnd := Table.Database.Handle;
   Table.Close;
   Check(DbiDoRestructure(DBHnd, 1, @TblDesc, nil, nil, nil, False));
end;

HTH,

Jan

Re:Modifying the BDE languagedriver at runtime?


Thanks for your reaction.

I use information from a ADS (advange database server) table.
{I do not have the ADS program tools we use ADS for a different program}
I copy the table every day and open it with BDE.
Modifying the default languagedriver works great, perhaps it is better
to use DbiDoRestructure ?

Bert van der Hoeven

Re:Modifying the BDE languagedriver at runtime?


On Tue, 08 Aug 2000 20:50:18 +0200, "G.D. van der Hoeven"

Quote
<GDvdHoe...@wxs.nl> wrote:
>I copy the table every day and open it with BDE.
>Modifying the default languagedriver works great, perhaps it is better
>to use DbiDoRestructure ?

Unless this is a program for internal use, I would prefer to change
the table language driver with DbiDoRestructure.  Relying on
particular BDE settings is most often a sure way to keep your support
staff busy. <g>

Jan

Re:Modifying the BDE languagedriver at runtime?


It is for internal use.

Thank for your support it helpt me a lot.

Bert van der Hoeven

Quote
Jan Sprengers wrote:

> On Tue, 08 Aug 2000 20:50:18 +0200, "G.D. van der Hoeven"
> <GDvdHoe...@wxs.nl> wrote:

> >I copy the table every day and open it with BDE.
> >Modifying the default languagedriver works great, perhaps it is better
> >to use DbiDoRestructure ?

> Unless this is a program for internal use, I would prefer to change
> the table language driver with DbiDoRestructure.  Relying on
> particular BDE settings is most often a sure way to keep your support
> staff busy. <g>

> Jan

Other Threads