xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

HS_Delete()

Marks an index entry as deleted in a HiPer-SEEK index file.

Syntax

HS_Delete( <nHsxHandle>, <nIndexEntry> ) --> nErrorCode

Arguments

<nHsxHandle>
This is the numeric file handle of the HiPer-SEEK index file to mark an entry as deleted. The file handle is returned from HS_Open() or HS_Create().
<nIndexEntry>
The ordinal position of the index entry to delete must be specified as a numeric value.

Return

The function returns 1 when the index entry is successfully marked as deleted, or a negative numeber indicating an error condition:

Error codes of HS_Delete()
ValueDescription
-4Error while attempting to seek during buffer flushing.
-5Read error while reading.
-6Write error during buffer flushing.
-7<nIndexEntry> is out of bounds.
-8<nIndexEntry> is already marked for deletion.
-16Invalid parameters are passed.
-18Illegal HiPer-SEEK index file handle.

Description

HS_Delete() marks an index entry as deleted, but actually does not remove the entry from the file. The deletion mark can be removed with HS_Undelete(). This is similar to DbDelete() and DbRecall().

Info

See also:DbDelete(), HS_IfDel(), HS_Replace(), HS_Undelete()
Category: Database functions , HiPer-SEEK functions , Index functions , xHarbour extensions
Source:rdd\hsx\hsx.c
LIB:lib\xhb.lib
DLL:dll\xhbdll.dll

Example

// The example creates a new HiPer-SEEK index file and
// transfers the Deleted() flag from the database to
// the index.

   PROCEDURE Main
      LOCAL bIndex, nHandle, nIndex

      CLS
      USE Customer
      SET DELETED OFF

      nHandle := HS_Create( "Customer.hsx", 8, 3, .F., 2 )
      bIndex  := {|| Trim(LastName)+" "+Trim(FirstName) }

      DO WHILE .NOT. Eof()
         nIndex := HS_Add( nHandle, bIndex )
         IF Deleted()
            HS_Delete( nHandle, Recno() )
         ENDIF
         SKIP
      ENDDO

      HS_Close( nHandle )
      USE
   RETURN

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