community.borland.com

Article #16309: Obtaining the Physical Path of a Table

 Technical Information Database

TI1309D.txt - Obtaining the Physical Path of a Table

Category   :Database Programming
Platform   :All-32Bit
Product    :All32Bit,   

Description:
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;


Reference:
 

3/30/99 11:24:02 AM
 

Last Modified: 01-SEP-99