共用方式為


Data Tab, Options Dialog Box

Contains options for controlling data in tables.

When you choose Set As Default — which appears on every tab in the dialog box — Visual FoxPro saves all the options on all tabs.

  • Open exclusive
    Specifies whether Visual FoxPro opens tables and databases exclusively, so that no one else can view or modify them while you are working on them. Opening files exclusively can result in better performance. Use this option when processing large numbers of records under circumstances when other users do not need access to data (such as at night). This option corresponds to the SET EXCLUSIVE Command.
  • Show field names
    Specifies whether Visual FoxPro displays a field name as a column heading above each field in the output of the AVERAGE Command, CALCULATE Command, DISPLAY Command, LIST Command, and SUM Command. This option corresponds to the SET HEADINGS Command.
  • Prompt for code page
    Specifies whether Visual FoxPro prompts you to attach a code page when you open tables that do not already have one attached. This option corresponds to the SET CPDIALOG Command.
  • Ignore deleted records
    Specifies whether Visual FoxPro ignores records marked for deletion when executing commands that use a scope clause. If this option is cleared, Visual FoxPro includes the marked records. This option corresponds to the SET DELETED Command.
  • Rushmore optimization
    Specifies whether Visual FoxPro uses Rushmore optimization when executing commands that include a FOR clause. This option corresponds to the SET OPTIMIZE Command. For more information, see Optimizing Applications.
  • Unique records in indexes
    Specifies whether Visual FoxPro allows records with duplicate index key values in an index file. If you choose this option, only the first record containing the original key index is indexed. This option corresponds to the SET UNIQUE Command.
  • Collating sequence
    Specifies a collation sequence (sort order) for character fields in indexing and sorting operations. This option corresponds to the SET COLLATE Command.
  • Record counter interval
    Specifies how many records should be processed during commands such as COPY TO before Visual FoxPro updates the record counter display in the status line. The range is from 1 to 32,767 records. The higher the number you specify, the longer the delay between updates, but the command can run faster. You must choose the Status Bar option on the View tab for this option to have effect. This option corresponds to the SET ODOMETER Command.
  • Memo block size (bytes)
    Specifies the block size in which disk space for memo fields is allocated. The value you enter specifies the minimum disk space required for a memo field, and the size by which memo fields increase as data is added to them. If you specify a value between 1 and 32, Visual FoxPro multiplies your value by 512, and then allocates disk space in a block of that size. If you specify a value greater than 32, Visual FoxPro allocates blocks of only that size; specifying a number greater than 32 can therefore save disk space. This option corresponds to the SET BLOCKSIZE Command.
  • Browse refresh interval (sec)
    Specifies how often Visual FoxPro updates the display of records in an active Browse window, which is useful in a multiuser environment. Possible values are 0 to 3600. Set this value to 0 to prevent updates. Set this value to a high number to update the Browse window less often, which can increase performance. This option corresponds to the SET REFRESH Command.
  • Table refresh interval (sec)
    Specifies how often Visual FoxPro should update the display of an active table, which is useful in a multiuser environment. Possible values are 0 to 3600. Set this value to 0 to prevent updates; set this value to a high number to update the table less often, which can increase performance. This option corresponds to the SET REFRESH Command.

String comparisons

  • SET NEAR on
    Specifies that Visual FoxPro positions the record pointer on the closest matching record after an unsuccessful FIND or SEEK command. This option corresponds to the SET NEAR Command.

  • SET EXACT on
    Specifies that Visual FoxPro uses the full length of both string expressions (except for trailing blanks) when using the comparison operator (=). If you clear this option, Visual FoxPro stops comparing two strings when the end of the expression on the right side of the comparison operator (=) is reached. This option corresponds to the SET EXACT Command.

    Note   This setting has no effect on the results of the = operator.

  • SET ANSI on
    Specifies whether Visual FoxPro pads strings when comparing them with the SQL = operator, which compares character by character until the shorter string is finished. If you choose this option, Visual FoxPro pads the shorter string with spaces, so a SQL comparison fails ("Tommy" is not equivalent to "Tom "). If you clear this option, the shorter string is not padded, so strings of unequal length can be equivalent ("Tommy" is equivalent to "Tom"). This option corresponds to the SET ANSI Command.

Locking and buffering

  • Automatic file locking
    Specifies that Visual FoxPro automatically locks files for certain commands that do not change data including AVERAGE, COPY TO, INDEX, REPORT, SORT, and TOTAL. If you clear this option, the file is not locked during these commands, and other users can change records while your command is being executed. This option corresponds to the SET LOCK Command.
  • Multiple record locks
    Specifies whether Visual FoxPro locks multiple records concurrently. If you clear this option, Visual FoxPro clears all current locks and makes it possible for you to lock only one record at a time; the current record is unlocked when you lock the next one. This option corresponds to the SET MULTILOCKS Command.
  • Buffering
    Specifies for multiuser environments whether to buffer record changes locally, and if so, whether to do so optimistically or pessimistically. Buffering can improve performance and provide greater concurrency control. You must choose the Multiple Record Locks option for this option to have effect. It corresponds to the CURSORSETPROP( ) Function. Options are:
    • Off Changes are not buffered, and record updates are made immediately to disk. This mode is recommended only when working in a single-user environment.

    • Record (Pessimistic) The current record is locked when the user makes a change to it, and changes are buffered. Other users can read but not change the record on disk. When the record pointer moves to another record, the current record is written back automatically from the buffer to the source table, and then unlocked. Pessimistic record locking is useful for interactive editing in a table subject to many updates by other users.

    • Record (Optimistic) Changes for a single record are buffered but not locked when the user moves the record pointer to the record. Other users can read and change the record on disk. When the user moves the record pointer to another record, Visual FoxPro checks changes in the current record against the record on disk. If the record on disk has been changed, Visual FoxPro offers options to discard current changes or overwrite the record on disk. Optimistic record buffering is recommended primarily when updating tables in which there is little activity.

    • Table (Pessimistic) Record changes are buffered and locked when the user moves the record pointer to them, and remain so until TABLEUPDATE( ) Function is called. Pessimistic table buffering is the safest mode for updating multiple records in a table, but because it locks every changed record, it can limit other users' access to the data. It is therefore recommended only to help speed data entry when users will be entering new records in batches, or when it is essential for the application that all currently used records be held exclusively by the application.

      Note   When using table buffering, you must issue TABLEUPDATE( ) to write buffered record changes to the disk. If you don't, the changed records are discarded when the user quits Visual FoxPro.

    • Table (Optimistic) Record changes are buffered, but not locked, when the user moves the record pointer to the record. Other users can read and change the records on disk. When TABLEUPDATE( ) is issued, Visual FoxPro checks for changes in each record as the record is written to disk; records that have changed are not written. Optimistic table buffering is useful for optimizing update performance in tables in which there is little activity. When using this option, issue TABLEUPDATE( ) often so that the chances of buffered records changing on disk is minimized.

      Note   When using table buffering, you must issue TABLEUPDATE( ) to write buffered record changes to the disk. If you don't, the changed records are discarded when the user quits Visual FoxPro.

  • Reprocessing
    Specifies how many times or for how long Visual FoxPro attempts to lock a record or table that is already locked by another user. This option corresponds to the SET REPROCESS Command. Choices are:
    • Attempt Lock (Default). Attempts to lock one time only.
    • Attempt Lock (Automatic). Continues to attempt the lock until successful or until the user cancels the attempt by pressing ESC. Equivalent to SET REPROCESS TO AUTO.
    • Wait for Lock. Continues to attempt a lock until the record becomes available. This option does not provide a way for the user to stop trying to lock the record. Equivalent to SET REPROCESS TO -1.
    • Retry Attempts. Attempts to lock the record or table the specified number of times. If the lock is still unsuccessful, an error message is displayed. SET REPROCESS TO n, where n is the number of retry attempts.
    • Retry Seconds. Attempts to lock the record or table for the specified number of seconds. If the lock is still unsuccessful, an error message is displayed. SET REPROCESS TO n SECONDS, where n is the number of seconds to retry.

See Also

AVERAGE Command | CALCULATE Command | DISPLAY Command | LIST Command | SET ANSI Command | SET BLOCKSIZE Command | SET COLLATE Command | SET CPDIALOG Command | SET DELETED Command | SET EXACT Command | SET HEADINGS Command | SET NEAR Command | SET ODOMETER Command | SET OPTIMIZE Command | SET REFRESH Command | SET REPROCESS Command | SET UNIQUE Command | SUM Command | Options Dialog Box