ODBC - odbc function

Retrieving an ODBC database property at run time

The properties of an ODBC database can be retrieved by means of the property function odbc(). The function cannot be used to modify properties.

A property function is called as if it were a property of an ODBC table:

file_id->odbc(property_set, “property_name”)


file_id

A file (or table) is defined within the ODBC definition using ![o]file. See Declaring an ODBC database.

property_set

Property sets are defined in <sculptor.h> with the prefix ODBC_SQL_. The possible values are:

ODBC_SQL_ENV_INFO
ODBC_SQL_CONNECT_INFO
ODBC_SQL_STMT_INFO
ODBC_SQL_DRIVER_INFO
ODBC_SQL_RDBMS_INFO
ODBC_SQL_DATASOURCE_INFO
ODBC_SQL_SUPPORTEDSQL_INFO
ODBC_SQL_SQLLIMITS_INFO
ODBC_SQL_SCALARFUNCTIONS_INFO
ODBC_SQL_CONVERSION_INFO
ODBC_SQL_STD_INFO

property_name

The required property from the property set specified. This must be a quoted string. Refer to the ODBC documentation for details of the properties available.

EXAMPLE

+database DB1 (
     type = DBT_ODBC
     source = "db_source"
!ofile MainFile "data/file1" update
}

     info "ODBC version = " + MainFile->odbc(ODBC_SQL_ENV_INFO, "SQL_ATTR_ODBC_VERSION")
     info "Database name = " + MainFile->odbc(ODBC_SQL_RDBMS_INFO,"SQL_DATABASE_NAME")...

RELATED TOPICS

ODBC

Modifying or retrieving an ODBC property at run time