Click or drag to resize

DbZap Function (Usual)

Remove all records from open files.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.4a
Syntax
 FUNCTION DbZap(
	uArea AS USUAL
) AS LOGIC
View Source

Parameters

uArea
Type: Usual
Specifies the work area name or number for a table on which the operation must be performed.

Return Value

Type: Boolean
TRUE if successful; otherwise, FALSE.
Remarks
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 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.
Examples
This example demonstrates a typical DBZap() operation:
X#
 1USE sales EXCLUSIVE NEW
 2IF !NetErr()
 3    SET INDEX TO sales, branch, salesman
 4    IF DBZap()
 5        ? "Zapped OK"
 6    ELSE
 7        ? "Error detected during ZAP"
 8    ENDIF
 9    CLOSE sales
10ELSE
11    ? "Error detected when opening the file"
12ENDIF
See Also