Skip to content

DF_DATABASE_IDENTIFIER_QUOTE

This attribute returns the identifier quote that can be used to surround SQL database identifiers like table names, column names, and schema names.

Level

Database

Supported by

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

Type

String, temporary

Access

Read Only

Values

String, usually a single character, such as ".

Syntax

Use cli.pkg
Get_Attribute DF_DATABASE_IDENTIFIER_QUOTE of {driverNumber} {databaseHandle} to {StringVariable}

Driver Configuration Keyword

None

Remarks

The identifier quote is database backend specific. Most SQL databases use the double quote character as the identifier quote. On some database systems, identifier quotes are needed to make identifiers case insensitive.

The identifier quote can be used to make SQL filters and Embedded SQL database independent.

Example

The following example shows how the identifier quote can be obtained from a managed connection.

String sIdentifierQuote
Get GetIdentifierQuoteFromConnection "MySQLOrderID" to sIdentifierQuote

Function GetIdentifierQuote String sDriver String sConnection Returns String
    Integer iDriverIndex
    Handle hDatabase
    String sIdentifierQuote

    Get DriverIndex sDriver to iDriverIndex
    If (iDriverIndex) Begin
        Get DatabaseHandle iDriverIndex sConnection to hDatabase
        If (hDatabase) Begin
            Get_Attribute DF_DATABASE_IDENTIFIER_QUOTE of iDriverIndex hDatabase to sIdentifierQuote
        End
    End

    Function_Return sIdentifierQuote
End_Function

Function DriverIndex String sDriver Returns Integer
    String sCurrentDriver
    Integer iDriver iNumDrivers

    Get_Attribute DF_NUMBER_DRIVERS to iNumDrivers
    For iDriver from 1 to iNumDrivers
        Get_Attribute DF_DRIVER_NAME of iDriver to sCurrentDriver
        If (Uppercase(sDriver) = Uppercase(sCurrentDriver)) ;
            Function_Return iDriver
        Loop
    Function_Return 0
End_Function

Function DatabaseHandle Integer iDriver String sServerName Returns Handle
    Handle hDatabase
    String sServer
    Integer iServer iNumServers

    If (iDriver > 0) Begin
        Get_Attribute DF_DRIVER_NUMBER_SERVERS of iDriver to iNumServers
        For iServer from 1 to iNumServers
            Get_Attribute DF_DRIVER_SERVER_NAME of iDriver iServer to sServer
            If (Uppercase(sServer) = Uppercase(sServerName)) Begin
                Get_Attribute DF_DATABASE_ID of iDriver iServer to hDatabase
            End
        Loop
    End

    Function_Return hDatabase
End_Function