DbiRenameTable

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

DbiRenameTable

Return to chapter overview

C syntax

DBIResult DBIFN DbiRenameTable (hDb, pszOldName, [pszDriverType], pszNewName);

Delphi syntax

function DbiRenameTable (hDb: hDBIDb; pszOldName: PChar; pszDriverType: PChar; pszNewName: PChar): DBIResult stdcall;

Description

DbiRenameTable renames the table given in pszOldName and all its resources to the new name specified by pszNewName.

Parameters

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

pszOldName                Type: pCHAR                (Input)
Pointer to the name of existing table. For Paradox, FoxPro, and dBASE tables only, if pszOldName contains an extension, pszDriverType is not needed. The source driver type determines the destination driver type.

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

pszNewName                Type: pCHAR                (Input)
Pointer to the new name for the table.

Usage

When the table is renamed, other resources are also renamed, depending on the database driver.

Paradox: The following files are renamed:

       The table (.DB extension)
       BLOB files (.MB extension)
       All indexes
       Validity check and referential integrity files (.VAL extension)

If the table is encrypted, the master password must be specified, or the DbiRenameTable call fails. A master table in a referential integrity link, the table cannot be renamed. If it is a detail table and the table is renamed into the same directory, the function automatically maintains the link to its master table. If it is a detail table and the table is renamed into the different directory, referential integrity is dropped. Exclusive access to the master table is required.

dBASE or FoxPro: The following files are renamed:

       The table (.DBF extension)
       BLOB files (.DBT or .FPT extension)
       The production index (.MDX extension)
       The compressed index (.CDX extension)

Access: Access tables do not have supporting files.

SQL: All indexes become associated with the new table name. Some SQL servers do not support DbiRenameTable.

Prerequisites

The client application must have permission to lock the table exclusively.

DbiResult

Meaning

DBIERR_NONE

The table was renamed successfully.

DBIERR_INVALIDHNDL

The specified database handle is invalid or NULL.

DBIERR_NOSUCHTABLE

The source table does not exist.

DBIERR_UNKNOWNTBLTYPE

The driver type is unknown.

DBIERR_NOTSUFFTABLERIGHTS

The client application has insufficient rights to the table (Paradox only).

DBIERR_NOTSUFFFAMILYRIGHTS

The client application has insufficient rights to family members (Paradox only).

DBIERR_LOCKED

The table is already in use.

See also

DbiAddPassword, DbiCopyTable, DbiDeleteTable