Skip to content

DF_FILE_MULTIUSER

See Also: Get_Attribute, Set_Attribute

Specifies whether the table is to be usable by more than one user concurrently.

Level

Table

Supported by

All Drivers

Type

Enumeration list, permanent

Access

Read / Write

Values

  • DF_FILE_USER_MULTI
  • DF_FILE_USER_SINGLE

Remarks

When the attribute is set to DF_FILE_USER_MULTI, the table can be accessed in a multi-user fashion. If the attribute is set to DF_FILE_USER_SINGLE, the table can only be accessed by one process at a time. There is no built-in check to guarantee that only one process is accessing the table. This means that if a table’s DF_FILE_MULTIUSER attribute is set to DF_FILE_USER_SINGLE and multiple processes access it at the same time, the table will be corrupted. This attribute is set to DF_FILE_USER_SINGLE automatically if the DF_FILE_LOCK_TYPE attribute is set to DF_LOCK_TYPE_NONE.

This attribute is a remnant from the time when single-user/process operating systems were common. Modern operating systems allow multiple processes to run simultaneously. When two (or more) processes access a table at the same time, they are effectively using the table in a multi-user fashion.

This attribute can only be set inside a Structure_Start ... Structure_End operation. It is expected that this attribute will very rarely be set, and the default value will be used in most cases.

This attribute is part of the basic set of attributes that must be supported by all drivers. However, it does not make sense in some backends. That is why the Pervasive.SQL and DataFlex SQL Drivers will return DF_FILE_USER_MULTI for every table accessed, and attempts to set the attribute will be ignored.

Procedure ShowPotentialProblemTables
    Handle hTable
    Integer iMultiUser
    String sTable
    Integer iDangerous

    Move 0 To hTable
    Move 0 To iDangerous

    Repeat
        Get_Attribute DF_FILE_NEXT_USED of hTable To hTable
        If (hTable > 0) Begin
            Open hTable
            Get_Attribute DF_FILE_MULTIUSER of hTable To iMultiUser
            Get_Attribute DF_FILE_LOGICAL_NAME of hTable To sTable
            If (iMultiUser = DF_FILE_USER_SINGLE) Begin
                Showln "DANGER! Table " sTable " will not be locked!"
                Increment iDangerous
            End
            Close hTable
        End
    Until (hTable = 0)

    If (iDangerous = 0) ;
        Showln "All tables in the filelist will be properly locked."
End_Procedure // ShowPotentialProblemTables

The sample procedure above will check every table in the file list for its multi-user setting. When tables exist that have their multi-user setting set to DF_FILE_USER_SINGLE, these will be reported as potential problem tables.