xHarbour Reference Documentation > Command Reference |
Toggles automatic opening of a structural index file.
SET AUTOPEN ON | off | (<lOnOff>)
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.
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 |
// 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
http://www.xHarbour.com