Skip to content

DF_FILE_LOGIN

See Also: Get_Attribute, Set_Attribute, DF_DRIVER_SERVER_NAME

The string used to log in to the server/database that contains this table.

Level

Table

Supported by

All Drivers

Type

String, permanent

Access

Read / Write

Values

String value.

Remarks

The DF_FILE_LOGIN attribute holds the back end specific string that is needed to log in to the server/database that contains the table.

For SQL Based Database Drivers, this attribute should contain a so-called connection string. See Server_Name intermediate file keyword for details on connection strings.

For Pervasive.SQL, it depends on the database mode the driver is running under. If the database mode is off, the DF_FILE_LOGIN attribute has no meaning. If the database mode is on, the DF_FILE_LOGIN attribute contains the Uniform Resource Indicator (URI) that identifies the table. See URI intermediate file keyword for details on URIs.

For the Embedded Database, this attribute has no meaning. Attempting to access this attribute for the embedded database will trigger an error.

This attribute can only be set inside a Structure_Start ... Structure_End operation.

Procedure CreateClockTable
    Handle hTable
    Handle hoWorkspace
    String sPath
    String sOrigFolder
    Integer iColumn
    Integer 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
    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 // CreateClockTable

The sample procedure above creates a table called Clock in the Northwind database of the SQL Server instance running on the local machine. Next, it adds the table to the filelist.