[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
DBSETINDEX()
Open an index
------------------------------------------------------------------------------
Syntax
DBSETINDEX(<cIndexName>) --> NIL
Arguments
<cIndexName> is a character value that specifies the filename of the
index file to be opened.
Returns
DBSETINDEX() always returns NIL.
Description
DBSETINDEX() opens an index file for the current work area. Any index
files already associated with the work area continue to be active. If
the newly opened index is the only index associated with the work area,
it becomes the controlling index; otherwise, the controlling order
remains unchanged.
After the new index file is opened, the work area is positioned to the
first logical record in the controlling order.
DBSETINDEX() performs the same function as the standard SET INDEX
command or the INDEX clause of the USE command. For more information,
refer to the SET INDEX command.
Notes
. Logical records: Activating an index affects the logical order
of records in the work area. That is, when an index is active,
commands which operate on logical records process records in indexed
order. If the controlling index is a unique index, records with
duplicate index keys are not logically visible.
. Network environment: DBSETINDEX() opens the index for shared
access if the associated database file was opened for shared access.
Otherwise, the index opens for exclusive access.
Examples
. The following example sets multiple indexes:
cLast := "Winston"
DBUSEAREA( .T., "DBFNTX", "Sales", "Sales", .T. )
DBSETINDEX( "FIRSTNAM" )
DBSETINDEX( "LASTNAME" )
//
IF ( Sales->(DBSEEK(cLast)) )
IF Sales->( DELETED() ) .AND. Sales->( RLOCK() )
Sales->( DBRECALL() )
? "Deleted record has been recalled."
ENDIF
ELSE
? "Not found"
ENDIF
Files: Library is CLIPPER.LIB.
See Also:
DBCLEARIND()
DBCREATEIND()
DBREINDEX()
DBSETORDER()
SET INDEX
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson