xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

OrdListAdd()

Opens and optionally activates a new index in a work area.

Syntax

OrdListAdd( <cIndexFile> ) --> NIL

Arguments

<cIndexFile>
<cIndexFile> is a character string with the name of the file containing the index(es) to add to the list of open indexes in a work area. The file name can be specified including path information and extension. When the file extension is omitted, it is determined by the database driver that opened the database file in the work area.

Return

The function always returns NIL.

Description

OrdListAdd() opens an index file in a used work area and adds all contained indexes to the list of open indexes. If <cIndexFile> is the first index file opened in the work area, the first index stored in the file becomes the controlling index and the record pointer is moved to the first logical record. If there is a controlling index already active when OrdListAdd() is called, both, record pointer and controlling index, remain unchanged.

Info

See also:DbClearIndex(), DbCreateIndex(), DbReindex(), DbSetOrder(), OrdCreate(), OrdListClear(), OrdListRebuild(), SET INDEX
Category: Database functions , Index functions
Source:rdd\dbcmd.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example shows the effect of OrdListAdd() when an index is opened
// a first index in a work area vs. the situation when an additional index
// is opened.

   PROCEDURE Main
      USE Customer
      INDEX ON Upper( LastName  ) TO Cust01
      INDEX ON Upper( FirstName ) TO Cust02

      // reopening the database closes all indexes
      USE Customer
      ? Recno(), LastName              // result:  1  Miller

      OrdListAdd( "Cust01" )
      ? Recno(), LastName              // result: 20  Alberts

      OrdListAdd( "Cust02" )
      ? Recno(), LastName              // result: 20  Alberts

      USE
   RETURN

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