Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Mach SIx v1.1c - Reference Guide - <b>delete - mark records for deletion</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  DELETE           - Mark records for deletion
-------------------------------------------------------------------------------

  Syntax:

  DELETE [<scope>] [WHILE <lCondition>] [FOR <lCondition>]
         [NOOPTIMIZE]

  Arguments:

  <scope> is the portion of the current database file to DELETE.  If a
  scope is not specified, DELETE acts only on the current record.  If a
  conditional clause is specified, the default becomes ALL records.  Mach
  SIx will only optimize the ALL scope.

  WHILE <lCondition> specifies the set of records meeting the condition
  from the current record until the condition fails.  Mach SIx does not
  support a WHILE condition.  Specifying a WHILE will cancel optimization.

  FOR <lCondition> specifies the conditional set of records to DELETE
  within the given scope.  Mach SIx will optimize a FOR condition that
  contains one or more active index keys.

  NOOPTIMIZE, preempts optimization and forces default Clipper processing.

  Description:

  DELETE is a database command that tags records so they can be filtered
  with SET DELETED ON, queried with DELETED(), or physically removed from the
  database file with PACK.  In addition, display commands such as LIST and
  DISPLAY identify deleted records with an asterisk (*) character.  Once
  records are deleted, you can reinstate them by using RECALL.  If you want
  to remove all records from a database file, use ZAP instead of DELETE ALL
  and PACK.

  In a network environment, DELETE requires the current record be locked
  with RLOCK() if you are DELETEing a single record.  If you are DELETEing
  several records, the current database file must be locked with FLOCK() or
  USEed EXCLUSIVEly.  Refer to the Network Programming chapter in Clipper's
  Programming and Utilities book for more information.

  The DELETE command may be optimized by specifying one or more active index
  keys in the FOR condition.  Note that Mach SIx will only optimize a DELETE
  with a FOR condition and a scope of ALL.  WHILE conditions and alternate
  scopes cannot be optimized by Mach SIx.

  Notes:

  DELETE with SET DELETED ON: If the current record is deleted with SET
  DELETED ON, it is still visible until the record pointer is moved.

  ---------------------------------| EXAMPLE |--------------------------------
  /*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  *  Demonstrates an optimized DELETE command                               *
  *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/

  #include "DBFSIX.CH"
  #include "MACHSIX.CH"

  LOCAL nCount := 0

  USE Account VIA "DBFSIX"  // Structural index ACCOUNT.CDX opened
                            // automatically
  CLEAR SCREEN
  ? "Example of an optimized DELETE command."
  ?

  // Fully optimized deletion of all records where last name is empty().
  // Note that the FOR condition in this example does not exactly match the
  // index key for tag NAME.  However, Mach SIx will optimize this query by
  // locating the index key within the empty() function call and translate
  // the empty() portion of the condition into one that can be optimized.

  DELETE FOR empty( Last )
  CLOSE ALL


See Also: RECALL

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson