Functions.DbZap Method (Usual)
Remove all records from open files.
XSharp.RT (in XSharp.RT.dll) Version: 2.16
Syntax Request Example
uArea AS USUAL
) AS LOGIC
public static bool DbZap(
- Type: Usual
Specifies the work area name or number for a table on which the operation must be performed.
TRUE if successful; otherwise, FALSE.
DBZap() permanently removes all records from files open in the work area.
This includes the database file, index files, and associated memo file. Disk space previously occupied by the zapped files is released to the operating system.
If all the records in the database file are marked for deletion, DBZap() performs the same operation as DBPack(), but is almost instantaneous.
By default, this function operates on the currently selected work area.
It can be made to operate on an unselected work area by specifying
it within an aliased expression or by calling the overload that accepts a workarea
parameter (a workarea number or alias ).
This operation requires that the current database be open in exclusive mode (see SetExclusive()).
If this condition is not met when the function is invoked, a runtime error is raised.
Otherwise, the operation proceeds and, upon termination, resets the record pointer to the first logical record in the current work area.
This example demonstrates a typical DBZap() operation:
1USE sales EXCLUSIVE NEW
3 SET INDEX TO sales, branch, salesman
4 IF DBZap()
5 ? "Zapped OK"
7 ? "Error detected during ZAP"
9 CLOSE sales
11 ? "Error detected when opening the file"