- - * - WhiteUnicorn - * - -




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >


3100:Obtaining the Physical Path of a Table

KEYWORDS: DbiGetDatabaseDesc DBDesc Path AREA: Database Programming

TITLE: Obtaining The Physical Path of a Table
Submitted: August 13, 1996
Author: Xavier Pacheco

When a Table is referenced through an alias, the physical path is
not readily available. To obtain this path, use the
DbiGetDatabaseDesc BDE function. This function takes the alias
name and a pointer to a DBDesc structure. The DBDesc structure
will be filled with the information pertaining to that alias.
This structure is defined as:

pDBDesc = ^DBDesc;
DBDesc = packed record          { A given Database Description }
  szName          : DBINAME;    { Logical name (Or alias) }
  szText          : DBINAME;    { Descriptive text }
  szPhyName       : DBIPATH;    { Physical name/path }
  szDbType        : DBINAME;    { Database type }
end;

The physical name/path will be contained in the szPhyName field
of the DBDesc structure.

Possible return values for the DBIGetDatbaseDesc function are:

DBIERR_NONE		The database description for pszName was
			retrieved successfully.
DBIERR_OBJNOTFOUND	The database named in pszName was not found.

The code example below illustrates how to obtain the physical path
name of a TTable component using the DBDemos alias:

var
  vDBDesc: DBDesc;
  DirTable: String;
begin
  Check(DbiGetDatabaseDesc(PChar(Table1.DatabaseName), @vDBDesc));
  DirTable := Format('%s\%s', [vDBDesc.szPhyName, Table1.TableName]);
  ShowMessage(DirTable);
end;

        TI



* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >



- - * - Anastasija aka WhiteUnicorn - * - - LJLiveJournal
PFPhotoFile