Skip to content

DF_FILE_TABLE_NAME

The name of the table.

Level

Table

Supported by

The DataFlex SQL Drivers (SQL Server, DB2, and ODBC)

Type

String, permanent

Access

Read / Write

Values

A valid table name.

Syntax

Use cli.pkg
Get_Attribute DF_FILE_TABLE_NAME of {tableNumber} to {StringVariable}
Set_Attribute DF_FILE_TABLE_NAME of {tableNumber} to {StringVariable}

Remarks

This attribute holds the name of the table in the back end. Depending on the back end, table names may be case sensitive, contain spaces, or other special characters. This attribute is used to determine a table’s back end name when using Embedded SQL. Since Embedded SQL works on the back end directly, the back end’s name must be used. In most cases, the back end name will be the same as the table name used in DataFlex.

This attribute can also be set through the intermediate file keyword Database_Name.

Example Procedures

ShowRow

Procedure ShowRow Handle hstmt
    Integer iNumCols iCol
    String sValue
    Get SQLStmtAttribute Of hstmt SQLSTMTATTRIB_COLUMNCOUNT To iNumCols
    For iCol From 1 To iNumCols
        If (iCol > 1) ;
            Show ", "
        Get SQLColumnValue Of hstmt iCol To sValue
        Show sValue
    Loop
    Showln
End_Procedure

ShowContents

Procedure ShowContents Handle hTable
    String sTable
    Handle hoSQL hdbc hstmt
    Integer iFetchResult
    Get_Attribute DF_FILE_TABLE_NAME Of hTable To sTable
    Get Create U_cSQLHandleManager To hoSQL
    If (hoSQL > 0) Begin
        Get SQLFileConnect Of hoSQL hTable To hdbc
        If (hdbc > 0) Begin
            Get SQLOpen Of hdbc To hstmt
            If (hstmt > 0) Begin
                Send SQLExecDirect Of hstmt ("select * from" * sTable)
                Repeat
                    Get SQLFetch Of hstmt To iFetchResult
                    If (iFetchResult <> 0) ;
                        Send ShowRow hstmt
                Until (iFetchResult = 0)
                Send SQLClose Of hstmt
            End
            Send SQLDisconnect Of hdbc
        End
        Send Destroy Of hoSQL
    End
End_Procedure

The sample procedures above show the use of the DF_FILE_TABLE_NAME attribute for an Embedded SQL statement.