See Also: Lock, Memory, Open, Reread, Runprogram
To close a database table.
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.
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.
Close Invt Vendors
In this example, the database tables Invt and Vendors are closed.
Although it would usually be inefficient to do so, you may reopen database tables that you have closed.
Make certain that no Relate, Attach, or other command addresses a closed table through a relationship with a child table.
Never use the Close command within a transaction.
The DF_TEMPORARY and DF_PERMANENT parameters may only be use with DF_ALL, not a specific table name.