DbiEmptyTable

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

DbiEmptyTable

Return to chapter overview

C syntax

DBIResult DBIFN DbiEmptyTable (hDb, hCursor, pszTableName, [pszDriverType]);

Delphi syntax

function DbiEmptyTable (hDb: hDBIDb; hCursor: hDBICur; pszTableName: PChar; pszDriverType: PChar): DBIResult stdcall;

Description

DbiEmptyTable deletes all records from the given table.

Parameters

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

hCursor                Type: hDBICur                (Input)
Specifies the cursor on the table. Optional. If hCursor is specified, the operation is performed on the table associated with the cursor. If hCursor is NULL, pszTableName and pszDriverType determine the table to be used.

pszTableName                Type: pCHAR                (Input)
Pointer to the table name. Optional. If hCursor is NULL, pszTableName and pszDriverType determine the table to be used. (If both pszTableName and hCursor are specified, pszTableName is ignored.)

For Paradox, FoxPro, 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 driver 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.

Usage

This function is used to remove all records from the specified table.

Paradox: The operation is not performed if there are any conflicting referential integrity constraints on the table.

Prerequisites

If a cursor is passed in, it must have been opened in exclusive mode. For Paradox tables, if the table is encrypted, a table-level password with prvINSDEL or prvFULL rights must have been registered.

Completion state

No records remain in the table. However, all resources (for example, indexes and validity checks) remain. The table and index should now be at their respective minimum sizes.

DbiResult

Meaning

DBIERR_NONE

The table was successfully emptied.

DBIERR_INVALIDHNDL

The specified database handle or the specified cursor handle is invalid or NULL.

DBIERR_NEEDEXCLACCESS

The table was not emptied because the user does not have exclusive access to this table.

DBIERR_NOSUCHTABLE

The table specified in pszTableName and pszDriverType does not exist.

DBIERR_INVALIDPARAM

The pointer to the table name is NULL, or the table name is an empty string.

DBIERR_NOTSUFFTABLERIGHTS

The user does not have permission to perform this operation (Paradox only).

DBIERR_NOTSUFFSQLRIGHTS

Insufficient SQL rights to perform this operation (SQL only).

DBIERR_DETAILRECEXISTEMPTY

There are conflicting referential integrity constraints on the table (Paradox only).

See also

DbiOpenTable, DbiAddPassword