DbiPackTable

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

DbiPackTable

Return to chapter overview

C syntax

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

Delphi syntax

function DbiPackTable (hDb: hDBIDb; hCursor: hDBICur; pszTableName: PChar; pszDriverType: PChar; bRegenIdxs: Bool): DBIResult stdcall;

Description

DbiPackTable optimizes table space by rebuilding the table associated with hCursor and releasing any free space.

Parameters

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

hCursor                Type: hDBICur                (Input)
Specifies the cursor on the table to be packed. 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, pszTblName and pszTblType determine the table to be used. (If both pszTableName and hCursor are specified, pszTableName is ignored.) 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.

pszDriverType                Type: pCHAR                (Input)
Pointer to the driver type. Optional. This parameter is required if pszTableName has no extension. The only valid pszDriverType is szDBASE.

bRegenIdxs                Type: BOOL                (Input)
Specifies whether or not to regenerate out-of-date table indexes. If TRUE, all out-of-date table indexes are regenerated (applies to maintained indexes only). Otherwise, out-of-date indexes are not regenerated.

Usage

dBASE or FoxPro: dBASE and FoxPro let users mark a record for deletion (as opposed to actually removing it from the table). The only way to permanently remove marked records is with DbiPackTable.

Paradox: This function is not valid for Paradox tables. Use DbiDoRestructure with the bPack option, instead.

SQL, Access: This function is not valid for SQL or Access tables.

Prerequisites

Exclusive access to the table is required.

DbiResult

Meaning

DBIERR_NONE

The table was successfully rebuilt.

DBIERR_INVALIDPARAM

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

DBIERR_INVALIDHNDL

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

DBIERR_NOSUCHTABLE

Table name does not exist.

DBIERR_UNKNOWNTBLTYPE

Table type is unknown.

DBIERR_NEEDEXCLACCESS

The table is not open in exclusive mode.

See also

DbiOpenTable, DbiDeleteRecord, DbiDoRestructure