xHarbour Reference Documentation > Function Reference |
Adds a text string entry to a HiPer-SEEK index file.
HS_Add( <nHsxHandle>, <bText> ) --> nIndexEntry
The function returns a numeric value. Positive values identify the ordinal number of the new index entry, while negative numbers are error codes:
Error codes of HS_Add()
Value | Description |
---|---|
-4 | Error while attempting to seek during buffer flushing. |
-6 | Write error during buffer flushing. |
-16 | Invalid parameters are passed. |
-18 | Illegal HiPer-SEEK index file handle. |
Function HS_Add() is used to fill a HyPer-SEEK index file after it is created with HS_Create(), or opened with HS_Open(). The code block <bText> must return a character string. HS_Add() calculates an index key for this text string and adds it to the HiPer-SEEK index file.
See also: | HS_Delete(), HS_Replace() |
Category: | Database functions , HiPer-SEEK functions , Index functions , xHarbour extensions |
Source: | rdd\hsx\hsx.c |
LIB: | lib\xhb.lib |
DLL: | dll\xhbdll.dll |
// The example outlines the steps required to create a // HiPer-SEEK index file and fill with information // from a database file. 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 nIndex <> Recno() ? "Error adding index:", nIndex ENDIF SKIP ENDDO HS_Close( nHandle ) USE RETURN
http://www.xHarbour.com