xHarbour Reference Documentation > Function Reference |
Changes a HiPer-SEEK index entry.
HS_Replace( <nHsxHandle>, ; <cNewIndex> , ; <nIndexEntry> ) --> nErrorCode
The function returns numeric 1 whan the index entry is successfully changed, or a negative number as error code:
Error codes of HS_Replace()
Value | Description |
---|---|
-4 | Error while attempting to seek during buffer flushing. |
-6 | Write error during buffer flushing. |
-7 | <nIndexEntry> is out of bounds. |
-16 | Invalid parameters are passed. |
-18 | Illegal HiPer-SEEK index file handle. |
-20 | File cannot be locked. |
-21 | Lock table exhausted. |
-22 | File cannot be unlocked. |
HS_Replace() changes the value of the index entry <nIndexEntry> in a HiPer-SEEK index file. This is necessary, for example, when a database record is changed with REPLACE and the changes must be reflected in the index file. HiPer-SEEK index files are not automatically updated with REPLACE operations, but must be updated programmatically.
See also: | HS_Add(), HS_Delete(), 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 demonstrates how a HiPER seek index is updated after // a database record is changed. PROCEDURE Main LOCAL cIndex := "Cust->Lastname + Cust->Firstname + Cust->City" LOCAL nHandle, nRet USE Customer ALIAS Cust EXCLUSIVE nHandle := HS_Index( "Customer.hsx", cIndex, 3, 1 ) GOTO 10 REPLACE Cust->City WITH "New York" COMMIT nRet := HS_Replace( nHandle, &(cIndex), Recno() ) IF nRet < 1 ? "Error on updating index:", nRet ELSE ? "Index updated" ENDIF HS_Close( nHandle ) USE RETURN
http://www.xHarbour.com