Close

See Also: Lock, Memory, Open, Reread, Runprogram

Purpose

To close a database table.

Syntax

Close {table} [… {table}]

or:

Close DF_ALL [ DF_TEMPORARY | DF_PERMANENT ]

Where {table} is the name or filelist number of one or more database tables. The DF_ALL option closes all open database tables. The close-type parameter (DF_TEMPORARY) allows tables to be temporarily closed, so that system resources may be recovered. The behavior of a table that is temporarily closed depends on the database driver used to access the table.

Any globally set attributes (such as DF_FILE_ALIAS and DF_FIELD_RELATED_FIELD or relationships applied using Set_Relate) are lost when a table is closed.

What It Does

Close closes one or more database tables named in the command. When a database table has been closed, any program command that addresses the table, or fields in it, will cause DataFlex errors to occur, as if the table had never been opened.

Using the DF_TEMPORARY option may allow you to recover the use of system resources—it is dependent on the driver. For the DataFlex driver, using this option will close the physical table(s). The next time the table is accessed (e.g., by doing a find) it will automatically be re-opened.

You may close a database table when a record is in its record buffer. The buffer data is lost to the program, and the buffer may not be addressed after the table has been closed.

Using Close to stop accessing unneeded tables may improve the speed at which your program runs. The time required for processing Lock and Reread commands, required with every save in multi user environments, is proportional to the number of open database tables. When inactive tables are closed, Lock and Reread commands operate on fewer tables, reducing the time required for saves.

Example

Close Invt Vendors

In this example, the database tables Invt and Vendors are closed.

Notes