Skip to content

DF_FILE_PHYSICAL_NAME

See Also: Get_Attribute, Set_Attribute, Output_Aux_File, Creating and Modifying Table Structures

The table name, including the path, of the table.

Level

Table

Supported by

All Drivers

Type

String, permanent

Access

Read / Write

Values

A string containing the physical name of the table.

Remarks

DF_FILE_PHYSICAL_NAME is the physical name of the opened table. This is not the same as the name used to open the table inside an application using the Open command. The name used to open a table using the Open command can be determined by using the DF_FILE_LOGICAL_NAME attribute. If the “open as” variant of the open command is used, one can specify the physical table name.

This attribute can only be set inside a Structure_Start ... Structure_End operation when creating a new table. It cannot be set when restructuring an existing table. The DF_FILE_PHYSICAL_NAME attribute can include a path, so it can be used to specify the location where the new data table should be created.

Setting the DF_FILE_PHYSICAL_NAME of a table does not add this table to the filelist. After creating a table with a valid physical name, the attributes DF_FILE_LOGICAL_NAME, DF_FILE_ROOT_NAME, and DF_FILE_DISPLAY_NAME must be set in order to add a table to a filelist.

The Embedded Database stores a table in several disk files. The data is stored in a .dat file (a .vld when compression is on), the indices in .k?? files, and the column names in a .tag file. All these disk files have the same name part; the extension is different. The physical name of a table is this common part.

The Pervasive.SQL Database Driver allows access to a table via an intermediate file or directly. If an intermediate file is present for the table, the physical name will be the path to the intermediate (.INT) file. If no intermediate file is present, the physical name will be the name of the table on disk.

The DataFlex SQL Drivers allow access to a table via an intermediate file or directly. If an intermediate file is used, the physical name of the table is the name of the intermediate (.INT) file. If a table is opened directly, the physical name is the string used to open the table. This string is of the form “:#@”.

Example

This sample procedure shows the physical name of every table in the filelist.

Procedure ShowPhysicalNames
    Handle hTable
    String sTable sPhysicalName
    Move 0 to hTable
    Repeat
        Get_Attribute DF_FILE_NEXT_USED of hTable to hTable
        If (hTable > 0) Begin
            Open hTable
            Get_Attribute DF_FILE_LOGICAL_NAME of hTable to sTable
            Get_Attribute DF_FILE_PHYSICAL_NAME of hTable to sPhysicalName
            Showln sTable " -- " sPhysicalName
            Close hTable
        End
    Until (hTable = 0)
End_Procedure

Example

This sample procedure creates an Embedded Database table called Contact.

Procedure CreateTable
    Handle hTable hoWorkspace
    Integer iColumn iIndex
    String sPath sOrigFolder

    //*** Make sure table comes in first folder of datapath by making that folder current
    Get phoWorkspace of ghoApplication to hoWorkspace
    Get psDataPath of hoWorkspace to sPath
    Get PathAtIndex of hoWorkspace sPath 1 to sPath
    Get_Current_Directory to sOrigFolder
    Set_Directory sPath

    //*** Create physical table contacts
    Move 0 to hTable
    Structure_Start hTable "DATAFLEX"
        Set_Attribute DF_FILE_PHYSICAL_NAME of hTable to "Contact"
        Set_Attribute DF_FILE_MAX_RECORDS of hTable to 150000

        Create_Field hTable At iColumn
        Set_Attribute DF_FIELD_NAME of hTable iColumn to "Customer_Number"
        Set_Attribute DF_FIELD_TYPE of hTable iColumn to DF_BCD
        Set_Attribute DF_FIELD_LENGTH of hTable iColumn to 6

        Move 0 to iColumn
        Create_Field hTable At iColumn
        Set_Attribute DF_FIELD_NAME of hTable iColumn to "ContactDate"
        Set_Attribute DF_FIELD_TYPE of hTable iColumn to DF_DATE

        Move 0 to iColumn
        Create_Field hTable At iColumn
        Set_Attribute DF_FIELD_NAME of hTable iColumn to "Comment"
        Set_Attribute DF_FIELD_TYPE of hTable iColumn to DF_TEXT
        Set_Attribute DF_FIELD_LENGTH of hTable iColumn to (8 * 1024)

        Move 0 to iIndex
        Create_Index hTable At iIndex
        Set_Attribute DF_INDEX_NUMBER_SEGMENTS of hTable iIndex to 2
        Set_Attribute DF_INDEX_SEGMENT_FIELD of hTable iIndex 1 to 1
        Set_Attribute DF_INDEX_SEGMENT_FIELD of hTable iIndex 2 to 2
        Set_Attribute DF_INDEX_SEGMENT_DIRECTION of hTable iIndex 2 to DF_DESCENDING
    Structure_End hTable

    Set_Directory sOrigFolder

    //*** Add to filelist and generate fd
    Move 0 to hTable
    Get_Attribute DF_FILE_NEXT_EMPTY of hTable to hTable
    If (hTable > 0) Begin
        Set_Attribute DF_FILE_ROOT_NAME of hTable to "Contact"
        Set_Attribute DF_FILE_DISPLAY_NAME of hTable to "Contact sample table"
        Set_Attribute DF_FILE_LOGICAL_NAME of hTable to "Contact"
        Open hTable
        Get psDDSRCPath of hoWorkspace to sPath
        Get PathAtIndex of hoWorkspace sPath 1 to sPath
        If (Right(sPath, 1) <> Sysconf(Sysconf_Dir_Separator)) ;
            Move (sPath - Sysconf(Sysconf_Dir_Separator)) to sPath
        Move (sPath - "Contact.fd") to sPath
        Output_Aux_File DF_AUX_FILE_FD For hTable to sPath
        Close hTable
    End
End_Procedure

Example

This sample procedure creates a SQL Server table called Clock. Note that the physical name of the table is set to the name of the intermediate file.

Procedure CreateClockTable
    Handle hTable hoWorkspace
    String sPath sOrigFolder
    Integer iColumn iIndex

    //*** Make sure int file comes in first folder of datapath by making that folder current
    Get phoWorkspace of ghoApplication to hoWorkspace
    Get psDataPath of hoWorkspace to sPath
    Get PathAtIndex of hoWorkspace sPath 1 to sPath
    Get_Current_Directory to sOrigFolder
    Set_Directory sPath

    //*** Create a SQL Server table to store clock in/out times of employees
    Move 0 to hTable
    Structure_Start hTable "MSSQLDRV"
        Set_Attribute DF_FILE_PHYSICAL_NAME of hTable to "Clock.int"
        Set_Attribute DF_FILE_RECNUM_TABLE of hTable to False

        // for a client/server database, you must provide a login to have rights to create the table
        Set_Attribute DF_FILE_LOGIN of hTable to "SERVER=(local);Trusted_Connection=yes;DATABASE=Northwind"
        Set_Attribute DF_FILE_TABLE_NAME of hTable to "Clock"
        Set_Attribute DF_FILE_USE_DUMMY_ZERO_DATE of hTable to True

        Create_Field hTable At iColumn
        Set_Attribute DF_FIELD_NAME of hTable iColumn to "EmployeeID"
        Set_Attribute DF_FIELD_TYPE of hTable iColumn to DF_BCD
        Set_Attribute DF_FIELD_LENGTH of hTable iColumn to 10
        Set_Attribute DF_FIELD_NATIVE_TYPE of hTable iColumn to SQL_INTEGER

        Move 0 to iColumn
        Create_Field hTable At iColumn
        Set_Attribute DF_FIELD_NAME of hTable iColumn to "ClockInTime"
        Set_Attribute DF_FIELD_TYPE of hTable iColumn to DF_DATE

        Move 0 to iColumn
        Create_Field hTable At iColumn
        Set_Attribute DF_FIELD_NAME of hTable iColumn to "ClockOutTime"
        Set_Attribute DF_FIELD_TYPE of hTable iColumn to DF_DATE

        Move 0 to iIndex
        Create_Index hTable At iIndex
        Set_Attribute DF_INDEX_NUMBER_SEGMENTS of hTable iIndex to 3
        Set_Attribute DF_INDEX_SEGMENT_FIELD of hTable iIndex 1 to 1
        Set_Attribute DF_INDEX_SEGMENT_FIELD of hTable iIndex 2 to 2
        Set_Attribute DF_INDEX_SEGMENT_DIRECTION of hTable iIndex 2 to DF_DESCENDING
        Set_Attribute DF_INDEX_SEGMENT_FIELD of hTable iIndex 3 to 3
        Set_Attribute DF_FILE_PRIMARY_INDEX of hTable to iIndex
        Set_Attribute DF_INDEX_NAME of hTable iIndex to "ClockPK"
    Structure_End hTable

    //*** Reset current working folder to original value
    Set_Directory sOrigFolder

    //*** Add to filelist and generate FD
    Move 0 to hTable
    Get_Attribute DF_FILE_NEXT_EMPTY of hTable to hTable
    If (hTable > 0) Begin
        Set_Attribute DF_FILE_ROOT_NAME of hTable to "MSSQLDRV:Clock"
        Set_Attribute DF_FILE_DISPLAY_NAME of hTable to "Clock sample table"
        Set_Attribute DF_FILE_LOGICAL_NAME of hTable to "Clock"
        Open hTable
        Get psDDSRCPath of hoWorkspace to sPath
        Get PathAtIndex of hoWorkspace sPath 1 to sPath
        If (Right(sPath, 1) <> Sysconf(Sysconf_Dir_Separator)) ;
            Move (sPath - Sysconf(Sysconf_Dir_Separator)) to sPath
        Move (sPath - "Clock.fd") to sPath
        Output_Aux_File DF_AUX_FILE_FD For hTable to sPath
        Close hTable
    End
End_Procedure