How to get BDE alias info

With the following function we can use the GetAliasParams method of TSession to get the directory mapping for an alias.

uses DbiProcs, DBiTypes;

function GetDataBaseDir(const Alias: string): string;
{* Will return the directory of the database given the alias
(without trailing backslash) *}
var
sp: PChar;
Res: pDBDesc;
begin
try
New(Res);
sp := StrAlloc(length(Alias) + 1);
StrPCopy(sp, Alias);
if DbiGetDatabaseDesc(sp, Res) = 0 then
Result := StrPas(Res^.szPhyName)
else
Result := ”;
finally
StrDispose(sp);
Dispose(Res);
end;
end;

Incoming search terms:

  • delphi bde tutorial
  • get directory from bde alias
  • how to get bde alias dir
  • tutorial strAlloc delphi
This entry was posted in Database. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Please copy the string E2J3FV to the field below: