|
<< Click to Display Table of Contents >> DbiCopyTable |
![]() ![]()
|
C syntax
DBIResult DBIFN DbiCopyTable (hDb, bOverwrite, pszSrcTableName, pszSrcDriverType, pszDestName);
Delphi syntax
function DbiCopyTable (hDb: hDBIDb; bOverWrite: Bool; pszSrcTableName: PChar; pszSrcDriverType: PChar; pszDestTableName : PChar): DBIResult stdcall;
Description
DbiCopyTable duplicates the source table, to a destination table.
Parameters
hDb Type: hDBIDb (Input)
Specifies the database handle.
bOverwrite Type: BOOL (Input)
Specifies whether to overwrite an existing destination table or not. If TRUE, the table is overwritten; if FALSE, an error is returned if the destination table already exists.
pszSrcTableName Type: pCHAR (Input)
Pointer to the name of the table to be copied. pszSrcTblName can include a file extension, in which case pszSrcDriverType is ignored.
pszSrcDriverType Type: pCHAR (Input)
Pointer to the driver type, when pszTblName specifies a table name without a file extension. Required with Paradox, dBASE, FoxPro, and Access tables if no table extension is specified in pszSrcTableName.
pszDestName Type: pCHAR (Input)
Pointer to the name of the destination table.
Usage
This function is used to copy tables of the same driver type. It cannot copy a table across databases or driver types. To transfer data from one database type to another, see DbiBatchMove.
Driver-specific rules must be followed in defining family members:
Access: All Access objects in the .MDB file that are associated with the table are copied.
dBASE and FoxPro: For dBASE and FoxPro tables, default family members include
| • | The table (usually ends with a .DBF extension) |
| • | BLOB file (usually <tablename>.DBT or <tablename>.FPT) |
| • | Production index (usually <tablename>.MDX or <tablename>.CDX) |
Non-production indexes are not included in the default family.
Paradox: For Paradox tables, default family members include
| • | The table (<tablename>. DB) |
| • | The BLOB file (<tablename>.MB) |
| • | All indexes |
| • | Any <tablename>. VAL file |
If the table is encrypted and the master password is not available, the copy fails. See DbiAddPassword.
SQL: The DbiCopyTable function copies only the table itself. The indexes are not copied.
Oracle8: Not supported for object types (ADT, REF, nested table, and VARARRAY).
Prerequisites
A read lock is required on source dBASE, FoxPro, Access, and Paradox tables. For SQL tables, at least a READ (SELECT) privilege is required on the source table.
Completion state
The source table is copied to the destination table.
DbiResult |
Meaning |
DBIERR_NONE |
The table was successfully copied. |
DBIERR_INVALIDHNDL |
The specified database handle is invalid or NULL. |
DBIERR_INVALIDPARAM |
The source or destination table name was not specified. |
DBIERR_INVALIDFILENAME |
An empty string or invalid filename was specified for the source or destination table name. |
DBIERR_FILEEXISTS |
The table already exists, and bOverwrite specifies not to overwrite it. |
DBIERR_FAMFILEINVALID |
The family file is corrupt. |
DBIERR_NOSUCHTABLE |
The source table does not exist. |
DBIERR_NOTSUFFTABLERIGHTS |
The user does not have permission to delete the existing destination table (Paradox only). |
DBIERR_NOTSUFFFAMILYRIGHTS |
The user does not have rights to family members (Paradox only). |
DBIERR_LOCKED |
The table is locked by another user. |
See also