xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

OrdCount()

Determines the number of indexes open in a work area.

Syntax

OrdCount( [<cIndexFile>] ) --> nOpenIndexes

Arguments

<cIndexFile>
This is a character string with the name of the file that stores the indexes. When the file extension is omitted, it is determined by the database driver that manages the file.

Return

The function returns the number of open indexes stored in <cIndexFile>. If this parameter is omitted, the return value is the total number of indexes open in a work area.

Description

The function delivers information about the number of indexes open in a work area, or indexes stored in a particular index file. It can be used as loop counter limit when information about all open indexes is collected.

Info

See also:DbOrderInfo(), OrdCreate(), OrdKey(), OrdNumber()
Category: Index functions , Database functions , xHarbour extensions
Source:rdd\dbcmd.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example shows a user defined function which collects information
// about open indexes in all work areas.

   FUNCTION AllOrders()
      LOCAL nArea     := Select()
      LOCAL aWorkArea := {}
      LOCAL aOrders   := {}
      LOCAL i, imax, j, jmax

      SELECT 0
      imax := Select() - 1

      FOR i:=1 TO imax
         DbSelectArea( i )

         jmax    := OrdCount()
         aOrders := Array( jmax )
         AAdd( aWorkArea, { Alias(), aOrders } )

         FOR j:=1 TO jmax
            aOrders[j] := { OrdBagName(j), OrdName(j) , ;
                            OrdKey(j)    , OrdCustom(j) }
         NEXT
      NEXT

      DbSelectArea( nArea )
   RETURN aWorkArea

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