Skip to content

CLI_Get_Database_Attribute

Obsolete

As of the DataFlex SQL Drivers (SQL Server, DB2, and ODBC) version 5, this command is replaced by the Get_Attribute and Set_Attribute commands.

Purpose

Get a database level attribute of a database connected to via a CLI Driver.

Syntax

CLI_Get_Database_Attribute <DriverName> <DatabaseHandle> <AttributeID>

Where:

  • <DriverName> is the name of the database driver. The names of drivers available from Data Access Worldwide are:
  • DATAFLEX for the embedded database
  • DB2_DRV for the DB2 Driver
  • DFBTRDRV for the Pervasive.SQL Driver
  • MSSQLDRV for the SQL Server Driver
  • ODBC_DRV for the ODBC Driver

If you are using drivers provided by other vendors, check the driver documentation for the driver name.

  • <DatabaseHandle> is the handle to the database.

  • <AttributeID> is the attribute identification. Attribute identifications can be:

Attribute Identification Short Description
DF_DATABASE_ID This attribute will return the handle of a database connection. The handle should be used when getting any of the other database level attributes. The database handle that should be passed when getting the DF_DATABASE_ID attribute is the index in the global driver and connection list.
DF_DATABASE_NUMBER_TYPES The number of types supported by the database.
DF_DATABASE_TYPE_NAME The name of the Nth type.
DF_DATABASE_TYPE_ID The identification of the Nth type.
DF_DATABASE_TYPE_AUTOINC Boolean that indicates if the type has the auto increment attribute.

What it does

The CLI_Get_Database_Attribute command returns information about a database connected to via a SQL Driver. The connection must exist, i.e., a login must have been executed or at least one table in the database must be open.

The database handle required to get the DF_DATABASE_ID attribute is the index in the lists maintained by the database API of the database connections. These lists can be enumerated using the DF_NUMBER_DRIVERS, DF_DRIVER_NAME, DF_DRIVER_NUMBER_SERVERS, and DF_DRIVER_SERVER_NAME global attributes. The handle returned by the DF_DATABASE_ID attribute must be used when getting any of the other database level attributes. An alternative way to obtain such a handle is via the DF_FILE_DATABASE_ID table attribute.

The individual attributes are discussed in the Database API Attributes section.