Board index » delphi » getting TDatabase filename?

getting TDatabase filename?

In my TDatabase, I use a BDE alias to connect to a defined ODBC DataSource.
Is there a way of retrieving the exact location of the database (path and
filename)?

 

Re:getting TDatabase filename?


In article <6j089r$hu...@news.duke.edu>, Scott Haynie
<s...@acpub.duke.edu> writes

Quote
>In my TDatabase, I use a BDE alias to connect to a defined ODBC DataSource.
>Is there a way of retrieving the exact location of the database (path and
>filename)?

Try calling the BDE routine DbiGetDatabaseDesc

**** Extract from the IDAPI Function Reference help file BDE.HLP:
Syntax

DBIResult DBIFN DbiGetDatabaseDesc (pszName, pdbDesc);

Description

DbiGetDatabaseDesc retrieves the Description of the specified database
from the configuration file.

Parameters

pszName         Type: pCHAR     (Input)
Pointer to the database name.
pdbDesc         Type: pDBDesc   (Output)
Pointer to the client-allocated DBDesc structure.

Prerequisites

A valid database (alias) name must be specified.

Completion state

The output buffer contains the database Description.

DbiResult return values

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

DBDesc (database descriptor)

The DBDesc structure describes a database, using the following fields:

Field   Type    Description

szName  DBINAME Specifies the database alias name.
szText  DBINAME Descriptive text.
szPhyName       DBIPATH Specifies the physical name/path.
szDbType        DBINAME Specifies the database type.
**** Extract ends

I am not fully sure about the calling conventions. Maybe you could
search the net for DbiGetDatabaseDesc examples. You should be able to
download the BDE.HLP file (which contains descriptions of all the
available BDE routines) from the Delphi Super Page at:

http://sunsite.icm.edu.pl/delphi

In compressed form, the file is called bdehel.zip.

Hope the above helps.
--
Steve Turner
Leeds, England

Other Threads