SQLGetInfo() returns general information (including supported data conversions) about the Database Management System (DBMS) that the application is currently connected to.
SQLRETURN SQLGetInfo (SQLHDBC hdbc, SQLSMALLINT fInfoType, SQLPOINTER rgbInfoValue, SQLSMALLINT cbInfoValueMax, SQLSMALLINT *pcbInfoValue);
Data type | Argument | Use | Description |
---|---|---|---|
SQLHDBC | hdbc | Input | Database connection handle. |
SQLSMALLINT | fInfoType | Input | Type of the required information. |
SQLPOINTER | rgbInfoValue | Output (also input) | Pointer to buffer where this function stores the required information. Depending on the type of information being retrieved, four types of information can be returned:
|
SQLSMALLINT | cbInfoValueMax | Input | The maximum length of the buffer pointed by rgbInfoValue pointer. |
SQLSMALLINT * | pcbInfoValue | Output | Pointer to location where this function returns the total number of bytes available to return the required information. If the value in the location pointed to by pcbInfoValue is greater than the size of the rgbInfoValue buffer as specified in cbInfoValueMax, then the string output information is truncated to cbInfoValueMax - 1 bytes and the function returns with SQL_SUCCESS_WITH_INFO. |
fInfoType | Format | Description and notes |
---|---|---|
SQL_ACTIVE_CONNECTIONS | Short int | The maximum number of active connections
supported per application. Zero is returned, indicating that the limit is dependent on system resources. |
SQL_ACTIVE_STATEMENTS | Short int | The maximum number of active statements per
connection. Zero is returned, indicating that the limit is dependent on system resources. |
SQL_AGGREGATE_FUNCTIONS | 32-bit mask | A bit mask enumerating support for aggregation functions:
|
SQL_CATALOG_NAME | String | A character string of Y indicates that the server supports catalog names. N indicates that catalog names are not supported. |
SQL_COLUMN_ALIAS | String | Whether the connection supports column aliases. The value Y is returned if the connection supports the concept of a column alias. |
SQL_CONNECTION_JOB_NAME | String | When in server mode, this is a character string that contains the complete job name associated with the connection. When not in server mode, a function sequence error is returned. |
SQL_CONVERT_BIGINT |
32-bit mask | Indicates the conversions supported by the data source with the CONVERT scalar function for data of the type named in the infoType. If the bit mask equals zero, the data source does not support any conversions for the data of the named type, including conversions to the same data type. For example, to find out if a data source supports the conversion of SQL_INTEGER data to the SQL_DECIMAL data type, an application calls SQLGetInfo() with finfoType of SQL_CONVERT_INTEGER. The application then ANDs the returned bit mask with SQL_CVT_DECIMAL. If the resulting value is nonzero, then the conversion is supported. The following bit masks are used to determine which conversions are supported:
|
SQL_CONVERT_FUNCTIONS | 32 bit mask | Indicates the scalar conversion functions supported by the driver and associated data source:
|
SQL_CORRELATION_NAME | Short int | Indicates the degree of correlation name support by the server:
|
SQL_CURSOR_COMMIT_BEHAVIOR | 16-bit integer | Indicates how a COMMIT operation affects cursors:
Note: After the COMMIT operation, a FETCH must be issued to reposition
the cursor before actions such as positioned updates or deletes can be taken.
|
SQL_CURSOR_ROLLBACK_BEHAVIOR | 16-bit integer | Indicates how a ROLLBACK operation affects cursors:
Note: DB2® servers
do not have the SQL_CB_PRESERVE property.
|
SQL_DATA_SOURCE_NAME | String | Name of the connected data source for the connection handle. |
SQL_DATA_SOURCE_READ_ONLY | String | A character string of Y indicates that the database is set to READ ONLY mode; an N indicates that it is not set to READ ONLY mode. |
SQL_DATABASE_NAME |
String |
Name of the current database in use. This string is the same as that returned by the SELECT CURRENT SERVER SQL statement. |
SQL_DBMS_NAME | String | Name of the Database Management System (DBMS)
product being accessed. For example:
|
SQL_DBMS_VER | String | Version of the DBMS product accessed. |
SQL_DEFAULT_TXN_ISOLATION | 32-bit mask | The default transaction-isolation level supported. One of the following masks are returned:
In IBM terminology,
|
SQL_DESCRIBE_PARAMETER | String | Y if parameters can be described; N if not. |
SQL_DRIVER_NAME | String | File name of the driver used to access the data source. |
SQL_DRIVER_ODBC_VER | String | The version number of ODBC that the driver supports. DB2 ODBC returns 2.1. |
SQL_GROUP_BY | 16-bit integer | Indicates the degree of support for the
GROUP BY clause by the server:
|
SQL_IDENTIFIER_CASE | 16-bit integer | Indicates case sensitivity of object names (such as table-name).
Note: Identifier names in IBM DBMSs are not case sensitive.
|
SQL_IDENTIFIER_QUOTE_CHAR | String | Character used as the delimiter of a quoted string. |
SQL_KEYWORDS | String | A character string containing a comma-separated list of all data source-specific keywords. This is a list of all reserved keywords. Interoperable applications should not use these keywords in object names. This list does not contain keywords specific to ODBC or keywords used by both the data source and ODBC. |
SQL_LIKE_ESCAPE_CLAUSE | String | A character string that indicates whether an escape character is supported for the metacharacters percent and underscore in a LIKE predicate. |
SQL_MAX_CATALOG_NAME_LEN | 16-bit integer | The maximum length of a catalog qualifier name; first part of a three-part table name (in bytes). |
SQL_MAX_COLUMN_NAME_LEN | Short int | The maximum length of a column name. |
SQL_MAX_COLUMNS_IN_GROUP_BY | Short int | The maximum number of columns in a GROUP BY clause. |
SQL_MAX_COLUMNS_IN_INDEX | Short int | The maximum number of columns in an SQL index. |
SQL_MAX_COLUMNS_IN_ORDER_BY | Short int | Maximum number of columns in an ORDER BY clause. |
SQL_MAX_COLUMNS_IN_SELECT | Short int | The maximum number of columns in a SELECT statement. |
SQL_MAX_COLUMNS_IN_TABLE | Short int | The maximum number of columns in an SQL table. |
SQL_MAX_CURSOR_NAME_LEN | Short int | The maximum length of a cursor name. |
SQL_MAX_OWNER_NAME_LEN | Short int | The maximum length of an owner name. |
SQL_MAX_ROW_SIZE | 32–bit unsigned integer | The maximum length in bytes that the server supports in single row of a base table. It is zero if there is no limit. |
SQL_MAX_SCHEMA_NAME_LEN | Int | The maximum length of a schema name. |
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 | Short int | The maximum length of a table name. |
SQL_MAX_TABLES_IN_SELECT | Short int | The maximum number of tables in a SELECT statement. |
SQL_MULTIPLE_ACTIVE_TXN | String | The character string Y indicates that active transactions on multiple connections are allowed. N indicates that only one connection at a time can have an active transaction. |
SQL_NON_NULLABLE_COLUMNS | 16-bit integer | Indicates whether non-nullable columns
are supported:
|
SQL_NUMERIC_FUNCTIONS | 32-bit mask | The scalar numeric functions supported. The following bit masks are used to determine which numeric functions are supported:
|
SQL_ODBC_API_CONFORMANCE | 16-bit integer | The level of ODBC conformance:
|
SQL_ODBC_SQL_CONFORMANCE | 16-bit integer | A value of:
For the definition of the previous types of ODBC SQL grammar, see Microsoft® ODBC 3.0 Software Development Kit and Programmer's Reference. |
SQL_ORDER_BY_COLUMNS_IN_SELECT | String | Set to Y if columns in the ORDER BY clauses must be in the select list; otherwise set to N. |
SQL_OUTER_JOINS | String | The character string:
|
SQL_OWNER_TERM or SQL_SCHEMA_TERM | String | The database vendor terminology for a schema (owner). |
SQL_OWNER_USAGE or SQL_SCHEMA_USAGE | 32-bit mask | Indicates the type of SQL statements that
have schema (owners) associated with them when these statements are processed.
Schema qualifiers (owners) are as follows:
|
SQL_POSITIONED_STATEMENTS | 32-bit mask | Indicates the degree of support for positioned UPDATE and positioned DELETE statements:
|
SQL_PROCEDURE_TERM | String | Data source name for a procedure. |
SQL_PROCEDURES | String | Whether the current server supports SQL procedures. The value Y is returned if the connection supports SQL procedures. |
SQL_QUALIFIER_LOCATION or SQL_CATALOG_LOCATION | 16-bit integer | A 16-bit integer value indicated the position of the qualifier in a qualified table name. Zero indicates that qualified names are not supported. |
SQL_QUALIFIER_NAME_SEPARATOR or SQL_CATALOG_NAME_SEPARATOR | String | The characters used as a separator between a catalog name and the qualified name element that follows it. |
SQL_QUALIFIER_TERM or SQL_CATALOG_TERM | String | The database vendor terminology for a qualifier. This is the name that the vendor uses for the high-order part of a 3-part name. Because DB2 ODBC does not support 3-part names, a zero-length string is returned. For non-ODBC applications, the SQL_CATALOG_TERM symbolic name should be used instead of SQL_QUALIFIER_NAME. |
SQL_QUALIFIER_USAGE or SQL_CATALOG_USAGE | 32-bit mask | This is similar to SQL_OWNER_USAGE except that this is used for catalog. |
SQL_QUOTED_IDENTIFIER_CASE | 16-bit integer |
This should be contrasted with the SQL_IDENTIFIER_CASE fInfoType, which is used to determine how (unquoted) identifiers are stored in the system catalog. |
SQL_SEARCH_PATTERN_ESCAPE | String | Used to specify what the driver supports as an escape character for catalog functions, such as SQLTables() and SQLColumns(). |
SQL_SQL92_PREDICATES | 32-bit mask | Indicates the predicates supported in a SELECT statement that SQL-92 defines.
|
SQL_SQL92_VALUE_EXPRESSIONS | 32-bit mask | Indicates the value expressions supported that SQL-92 defines.
|
SQL_STRING_FUNCTIONS | 32-bit bit mask | Indicates which string functions are supported. The following bit masks are used to determine which string functions are supported:
If an application can call the LOCATE scalar function with the string1, string2, and start arguments, the SQL_FN_STR_LOCATE bit mask is returned. If an application can only call the LOCATE scalar function with the string1 and string2, the SQL_FN_STR_LOCATE_2 bit mask is returned. If the LOCATE scalar function is fully supported, both bit masks are returned. |
SQL_TIMEDATE_FUNCTIONS | 32-bit mask | Indicates which time and date functions are supported. The following bit masks are used to determine which date functions are supported:
|
SQL_TXN_CAPABLE | Short int | Indicates whether transactions can contain
DDL or DML or both:
|
SQL_USER_NAME |
String |
User name used in a particular database. |
SQLSTATE | Description | Explanation |
---|---|---|
01004 | Data truncated | The requested information is returned as a null-terminated string and its length exceeded the length of the application buffer as specified in cbInfoValueMax. The argument pcbInfoValue contains the actual (not truncated) length of the requested information. |
08003 | Connection not open | The type of information requested in fInfoType requires an open connection. Only SQL_ODBC_VER does not require an open connection. |
40003 * | Statement completion unknown | The communication link between the CLI and the data source fails before the function completes processing. |
58004 | System error | Unrecoverable system error. |
HY001 | Memory allocation failure | The driver is unable to allocate memory required to support the processing or completion of the function. |
HY009 | Argument value that is not valid | The argument rgbInfoValue is a null
pointer An fInfoType that is not valid is specified. |
HY013 * | Memory management problem | The driver is unable to access memory required to support the processing or completion of the function. |