xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

OrdDestroy()

Deletes an index from an index file.

Syntax

OrdDestroy( <cIndexName> [, <cIndexFile>] )  --> NIL

Return

The function always returns NIL.

Description

OrdDestroy() deletes an open index and removes it from an index file. If the index file contains only one index, the file is erased from disc. When the controlling index is removed, no index is active after OrdDestroy() returns and the database is navigated in physical order. Function OrdNumber() returns 0 in that case, although other indexes may be open. Use OrdSetFocus() to activate another index.

Info

See also:DELETE TAG, OrdCreate()
Category: Database functions , Index functions
Source:rdd\dbcmd.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example creates two indexes and destroys the controlling
// index.

   PROCEDURE Main
      USE Customer
      OrdCreate( "Customer1", "ID"  , "CUSTNO"  )
      OrdCreate( "Customer2", "NAME", "Upper(LastName+FirstName)" )

      OrdSetFocus( "ID" )

      ? OrdNumber()               // result: 1
      ? OrdName()                 // result: ID
      ? OrdKey()                  // result: CUSTNO

      ? OrdSetfocus( "NAME" )     // result: ID

      ? OrdName()                 // result: NAME
      ? OrdNumber()               // result: 2
      ? OrdKey()                  // result: Upper(LastName+FirstName)

      OrdDestroy( "NAME" )

      ? OrdNumber()               // result: 0
      ? OrdName()                 // result: (empty string)
      ? OrdKey()                  // result: (empty string)

      USE
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe