xHarbour Reference Documentation > Command Reference xHarbour Developers Network  

SET AUTOPEN

Toggles automatic opening of a structural index file.

Syntax

SET AUTOPEN ON | off | (<lOnOff>)

Arguments

ON | off | (<lOnOff>)
The option toggles if a structural index file is automatically opened with the USE command. With ON or .T. (true), an index file is automatically opened. OFF or .F. (false) switch this mode off.

Description

Some replaceable database drivers support automatic opening of index files with the USE command when the index file has the same file name as the database file (without extension). An example is the DBFCDX driver. SET AUTOPEN toggles this behavior.

When SET AUTOPEN is set to ON, which is the default, the USE command automatically opens an index file having the same name as the database file and the file extension returned from OrdBagExt().

Note:  if an index file is automatically opened, a controlling index is not activated. The default index order is zero, i.e. records are accessible in physical order in the work area. To select a controlling index, call OrdSetFocus() or use SET AUTORDER for a default controlling index.

Info

See also:OrdListAdd(), OrdSetFocus(), Set(), SET AUTORDER, SET AUTOSHARE, USE
Category: Database commands , SET commands , xHarbour extensions
Source:rtl\set.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example demonstrates the effect of SET AUTOPEN with the
// DBFCDX driver.

   REQUEST DBFCDX

   PROCEDURE Main

      RddSetDefault( "DBFCDX" )
      SET AUTOPEN OFF

      USE Customer
      INDEX ON CustID                    TAG ID   TO Customer
      INDEX ON Upper(LastName+FirstName) TAG Name TO Customer

      USE Customer
      ? OrdCount(), OrdKey()        // result: 0  ""

      SET AUTOPEN ON

      USE Customer
      ? OrdCount(), OrdKey()        // result: 2  ""

      SET AUTORDER TO 1

      USE Customer
      ? OrdCount(), OrdKey()        // result: 2  CUSTID
      ? Ordkey( 2 )                 // result: Upper(LastName+FirstName)

      USE
   RETURN

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