FLUSH Command

Saves table and index changes to disk.

You can use FLUSH to explicitly save to disk all changes that you make to all open tables and indexes. You can also save changes to a specific table by specifying a work area, table alias, or path and name of a currently opened file.

FLUSH [[IN nWorkArea | cTableAlias] | [cFileSpec]] [FORCE]

Parameters

  • [IN nWorkArea | cTableAlias] | [cFileSpec]
    Specifies the work area number, table alias, or the name of a currently opened file name, for example, an index file or a file opened using the FOPEN( ) function. When specifying a file name, include the path, for example, C:\MyApp\MyTable.dbf.

    Note

    If you specify cFileSpec, only changes to the specified file are saved unless cFileSpec is the name of a table (.dbf) file in which case FLUSH applies to the table memo (.fpt) file and all open indexes for that table, even if the table is open in another data session.

    If you do not specify nWorkArea, cTableAlias, or cFileSpec, FLUSH applies to all open tables and indexes in the current data session.

  • FORCE
    Calls the Windows API FlushFileBuffers function for all affected files but does not apply to temporary files and files opened as read-only. For more information, see the MSDN online documentation.

Remarks

Visual FoxPro automatically saves changes to disk when performing the following operations:

  • Closing a table using the USE, CLOSE ALL, or CLOSE DATABASES command. Only the information for the file or files you close is saved to disk.

  • Unlocking a record or file. Only the information for the unlocked record or file is saved to disk.

See Also

Reference

FFLUSH( ) Function
SET AUTOSAVE Command

Other Resources

Commands (Visual FoxPro)
Language Reference (Visual FoxPro)