SQLGetInfo--Get general information

Purpose

Specification: DB2 CLI 1.1 ODBC 1.0 ISO CLI

SQLGetInfo() returns general information (including supported data conversions) about the DBMS to which the application is connected.

Syntax

SQLRETURN   SQLGetInfo       (
                SQLHDBC          ConnectionHandle,   /* hdbc */
                SQLUSMALLINT      InfoType,      /* fInfoType */
                SQLPOINTER        InfoValuePtr,    /* rgbInfoValue */
                SQLSMALLINT       BufferLength,        /* cbInfoValueMax */                
                SQLSMALLINT     *FAR StringLengthPtr,        /* pcbInfoValue */ 
                

Function arguments

Tabulka 69. SQLGetInfo arguments

Data type Argument Use Description
SQLHDBC ConnectionHandle input Database connection handle
SQLUSMALLINT InfoType output The type of information desired. The argument must be one of the values in the first column of the tables in Data Types and Data Conversion.
SQLPOINTER InfoValuePtr output (also input) Pointer to buffer where this function stores the necessary information. Depending on the type of information being retrieved, 5 types of information can be returned:

16-bit integer value

32-bit integer value

32-bit binary value

32-bit mask

Null-terminated character string

SQLSMALLINT BufferLength input Maximum size of the buffer pointed to by InfoValuePtr.
SQLSMALLINT * StrLen_or_IndPtr output Pointer to location where this function returns the total number of bytes available to return the desired information. In the case of string output, this size does not include the null terminating character.

If the value in the location pointed to by StringLengthPtr is greater than the size of the InfoValuePtr buffer as specified in BufferLength, then the string output information would be truncated to BufferLength - 1 bytes and the function would return with SQL_SUCCESS_WITH_INFO.

Usage

Refer to Information Returned By SQLGetInfo for a list of the possible values of InfoType and a description of the information that SQLGetInfo() would return for that value.

DB2 CLI returns a value for each InfoType in this table. If the InfoType does not apply or is not supported, the result is dependent on the return type:

Information Returned By SQLGetInfo

SQL_DBMS_NAME (string)
Tthe name of the DBMS product being accessed. For example: "DB2 Everyplace".

SQL_DBMS_VER (string)
Tthe version of DB2 Everyplace DBMS product. The information returned is string of the form: DB2 Everyplace Vm.v.r Build yyyy-mm-dd, where m is the major version, v is the minor version, r is the release, and yyyy-mm-dd is the date of the build in ISO format.

For example:

'DB2 Everyplace V8.1.2 Build 2003-04-01'
is DB2 Everyplace Version 8.1.2 built on April 01, 2003
Poznámka:
Applications require a buffer that can contain at least 39 characters (BUFSIZE). For example:
rc = SQLGetInfo(hdbc, SQL_DBMS_VER, buf, BUFSIZE, &len); 

SQL_IDENTIFIER_QUOTE_CHAR (string)
Indicates the character used to surround a delimited identifier.

SQL_MAX_BINARY_LITERAL_LEN (32-bit unsigned integer)
A 32-bit unsigned integer value specifying the maximum length of a hexadecimal literal in a SQL statement.

SQL_MAX_CHAR_LITERAL_LEN (32-bit unsigned integer)
The maximum length of a character literal in an SQL statement (in bytes).

SQL_MAX_COLUMN_NAME_LEN (16-bit integer)
The maximum length of a column name (in bytes).

SQL_MAX_COLUMNS_IN_GROUP_BY (16-bit integer)
Indicates the maximum number of columns that the server supports in a GROUP BY clause. Zero if no limit.

SQL_MAX_COLUMNS_IN_INDEX (16-bit integer)
Indicates the maximum number of columns that the server supports in an index. Zero if no limit.

SQL_MAX_COLUMNS_IN_ORDER_BY (16-bit integer)
Indicates the maximum number of columns that the server supports in an ORDER BY clause. Zero if no limit.

SQL_MAX_COLUMNS_IN_SELECT (16-bit integer)
Indicates the maximum number of columns that the server supports in a select list. Zero if no limit.

SQL_MAX_CONCURRENT_ACTIVITIES (16-bit integer)
The maximum number of active environments that the DB2 Everyplace CLI driver can support. If there is no specified limit or the limit is unknown, this value is set to zero.

SQL_MAX_DRIVER_CONNECTIONS (16-bit integer)
The maximum number of active connections supported per application.

SQL_MAX_INDEX_SIZE (32-bit unsigned integer)
Indicates the maximum size in bytes that the server supports for the combined columns in an index. Zero if no limit.

SQL_MAX_ROW_SIZE (32-bit unsigned integer)
Specifies the maximum length in bytes that the server supports in single row of a base table. Zero if no limit.

SQL_MAX_STATEMENT_LEN (32-bit unsigned integer)
Indicates the maximum length of an SQL statement string in bytes, including the number of white spaces in the statement.

SQL_MAX_TABLE_NAME_LEN (16-bit integer)
The maximum length of a table name (in bytes).

SQL_MAX_TABLES_IN_SELECT (16-bit integer)
Indicates the maximum number of table names allowed in a FROM clause in a query specification.

SQL_MAX_USER_NAME_LEN (16-bit integer)
Indicates the maximum size allowed for a user identifier (in bytes).

SQL_SEARCH_PATTERN_ESCAPE (string)
Used to specify what the driver supports as an escape character for catalog functions such as (SQLTables(), SQLColumns()).

SQL_TXN_CAPABLE (16-bit integer)
Indicates whether transactions can contain DDL or DML or both.

SQL_USER_NAME (string)
The user name used in a particular database. This is the identifier specified on the SQLConnect() call.

Return codes

Restrictions

None.

Související odkazy