DbiGetTableOpenCount

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

DbiGetTableOpenCount

Return to chapter overview

C syntax

DBIResult DBIFN DbiGetTableOpenCount (hDb, pszTableName, [pszDriverType],

piOpenCount);

Delphi syntax

function DbiGetTableOpenCount (hDb: hDBIDb; pszTableName: PChar; pszDriverType: PChar; var iOpenCount: Word): DBIResult stdcall;

Description

DbiGetTableOpenCount returns the total number of cursors that are open on the specified table.

Parameters

hDb                Type: hDBIDb                (Input)
Specifies the database handle.

pszTableName                Type: pCHAR                (Input)
Pointer to the name of the table. For Paradox, FoxPro, Access, and dBASE, if pszTableName is a fully qualified name of a table, the pszDriverType parameter need not be specified. If the path is not included, the path name is taken from the current directory of the database associated with hDb.

For SQL databases, this parameter can be a fully qualified name that includes the owner name.

pszDriverType                Type: pCHAR                (Input)
Pointer to the table type. Optional. For Paradox, FoxPro, and dBASE tables, this parameter is required if pszTableName has no extension. This parameter is ignored if the database associated with hDb is a SQL database. pszDriverType can be one of the following values: szDBASE, szMSACCESS, or szPARADOX.

piOpenCount                Type: pUINT16                (Output)
Pointer to the client variable that receives the number of cursors opened on the table.

Usage

This function returns the total number of cursors open on this table by this instance of BDE, irrespective of database and current session.

Most of the functions that operate on tables require a cursor, which is obtained by calling DbiOpenTable. A table can be opened more than once, resulting in more than one cursor for that table. Some functions, such as DbiDoRestructure, require that no cursors be opened on the table. Use this function to check for this requirement.

The name of the table (not the cursor) is input to DbiGetTableOpenCount, which returns a count of how many cursors are opened on the table. This function is useful for determining whether a table is in use.

Paradox: For Paradox, the number of open cursors includes any cursors opened implicitly by referential integrity or look up tables.

DbiResult

Meaning

DBIERR_NONE

The table open count was returned successfully.

DBIERR_INVALIDHNDL

The specified database handle is invalid or NULL.

DBIERR_INVALIDPARAM

The specified table name or the pointer to the table name is NULL.

DBIERR_NOSUCHTABLE

The specified table name is invalid.

DBIERR_UNKNOWNTBLTYPE

The specified driver type is invalid or NULL, or the pointer to the driver type is NULL.

See also

DbiOpenTable