SQLGetInfo() - Get general information
SQLGetInfo() returns general information
about the database management systems to which the application is
currently connected. For example, SQLGetInfo() indicates
which data conversions are supported.
ODBC specifications for SQLGetInfo()
| ODBC specification level | In X/Open CLI CAE specification? | In ISO CLI specification? |
|---|---|---|
| 1.0 | Yes | Yes |
Syntax
SQLRETURN SQLGetInfo (SQLHDBC ConnectionHandle,
SQLUSMALLINT InfoType,
SQLPOINTER InfoValuePtr,
SQLSMALLINT BufferLength,
SQLSMALLINT *FAR StringLengthPtr);Function arguments
The following table lists the data type, use, and description for each argument in this function.
| Data type | Argument | Use | Description |
|---|---|---|---|
| SQLHDBC | ConnectionHandle | input | Specifies a connection handle |
| SQLUSMALLINT | InfoType | input | Specifies the type of information to request. This argument must be one of the values in the first column of Table 3. |
| SQLPOINTER | InfoValuePtr | output (and input) | Points to a buffer where this function stores the
retrieved information. Depending on the type of information that is
retrieved, one of the following 5 types of information is returned:
|
| SQLSMALLINT | BufferLength | input | Specifies the maximum length, in bytes, of the buffer to which the InfoValuePtr argument points. |
| SQLSMALLINT * | StringLengthPtr | output | Points to the buffer where this function returns
the number of bytes that are required to avoid truncation of the output
information. In the case of string output, this size does not include
the nul-terminator. If the value in the location pointed to by StringLengthPtr is greater than the size of the InfoValuePtr buffer as specified in BufferLength, the string output information is truncated to BufferLength - 1 bytes and the function returns with SQL_SUCCESS_WITH_INFO. |
Usage
Table 3 lists
the possible values for the InfoType argument
and a description of the information that SQLGetInfo() returns
for each value. This table indicates which InfoType argument
values were renamed in ODBC 3.0.
- Character string containing 'Y' or 'N', 'N' is returned.
- Character string containing a value other than just 'Y' or 'N', an empty string is returned.
- 16-bit integer, 0 (zero).
- 32-bit integer, 0 (zero).
- 32-bit mask, 0 (zero).
| InfoType | Format | Description and notes |
|---|---|---|
| SQL_ACCESSIBLE_PROCEDURES | string | A character string of
'Y' indicates that the user can execute all procedures returned by
the function SQLProcedures(). 'N' indicates
that procedures can be returned that the user cannot execute. |
| SQL_ACCESSIBLE_TABLES | string | A character string of
'Y' indicates that the user is guaranteed SELECT privilege to all
tables returned by the function SQLTables().
'N' indicates that tables can be returned that the user cannot access. |
| SQL_ACTIVE_ENVIRONMENTS | 16-bit integer | The maximum number of active environments that the Db2 ODBC driver can support. If the limit is unspecified or unknown, this value is set to zero. |
| SQL_AGGREGATE_FUNCTIONS | 32-bit mask | A bit mask enumerating support for
aggregation functions:
|
| SQL_ALTER_DOMAIN | 32-bit mask | Db2 ODBC
returns 0 indicating that the ALTER DOMAIN statement is not supported.
ODBC also defines the following values that Db2 ODBC does not return:
|
| SQL_ALTER_TABLE | 32-bit mask | Indicates which clauses
in ALTER TABLE are supported by the database management system.
|
| SQL_ASCII_GCCSID | 32-bit integer | Specifies the ASCII GCCSID value currently set in the AGCCSID field of Db2 DSNHDECP. |
| SQL_ASCII_MCCSID | 32-bit integer | Specifies the ASCII MCCSID value currently set in the AMCCSID field of Db2 DSNHDECP. |
| SQL_ASCII_SCCSID | 32-bit integer | Specifies the ASCII SCCSID value currently set in the ASCCSID field of Db2 DSNHDECP. |
| SQL_BATCH_ROW_COUNT | 32-bit mask | Indicates the availability of row
counts. Db2 ODBC always returns
SQL_BRC_ROLLED_UP indicating that row counts for consecutive INSERT,
DELETE, or UPDATE statements are rolled up into one. ODBC also defines
the following values that Db2 ODBC
does not return:
|
| SQL_BATCH_SUPPORT | 32-bit mask | Indicates which level of batches are
supported:
|
| SQL_BOOKMARK_PERSISTENCE | 32-bit mask | Reserved attribute, zero is returned for the bit-mask. |
| SQL_CATALOG_LOCATION
(In previous versions of Db2 ODBC, this InfoType is SQL_QUALIFIER_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_CATALOG_NAME | string | A character string of 'Y' indicates that the server supports catalog names. 'N' indicates that catalog names are not supported. |
| SQL_CATALOG_NAME_SEPARATOR
(In previous versions of Db2 ODBC, this InfoType is SQL_QUALIFIER_NAME_SEPARATOR.) |
string | The characters used as a separator between a catalog name and the qualified name element that follows it. |
| SQL_CATALOG_TERM (In previous versions of Db2 ODBC, this InfoType is SQL_QUALIFIER_TERM.) |
string | The database vendor's
terminology for a qualifier. The name that the vendor uses for the high order part of a three part name. Because Db2 ODBC does not support three 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_CATALOG_USAGE (In previous versions of Db2 ODBC, this InfoType is SQL_QUALIFIER_USAGE.) | 32-bit mask | This is similar to SQL_OWNER_USAGE except that this is used for catalog. |
| SQL_COLLATION_SEQ | string | The name of the collation sequence. This is a character string that indicates the name of the default collation for the default character set for this server (for example, EBCDIC). If this is unknown, an empty string is returned. |
| SQL_COLUMN_ALIAS | string | Returns 'Y' if column aliases are supported, or 'N' if they are not. |
| SQL_CONCAT_NULL_BEHAVIOR | 16-bit integer | Indicates how the concatenation
of null valued character data type columns with non-null valued character
data type columns is handled.
|
| SQL_CONVERT_BIGINT
SQL_CONVERT_BINARY SQL_CONVERT_BIT SQL_CONVERT_CHAR SQL_CONVERT_DATE SQL_CONVERT_DECIMAL SQL_CONVERT_DOUBLE SQL_CONVERT_FLOAT SQL_CONVERT_INTEGER SQL_CONVERT_INTERVAL_DAY_TIME SQL_CONVERT_INTERVAL_YEAR_MONTH SQL_CONVERT_LONGVARBINARY SQL_CONVERT_LONGVARCHAR SQL_CONVERT_NUMERIC SQL_CONVERT_REAL SQL_CONVERT_ROWID SQL_CONVERT_SMALLINT SQL_CONVERT_TIME SQL_CONVERT_TIMESTAMP SQL_CONVERT_TINYINT SQL_CONVERT_VARBINARY SQL_CONVERT_VARCHAR |
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 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 | 16-bit integer | Indicates the degree
of correlation name support by the server:
|
| SQL_CLOSE_BEHAVIOR | 32-bit integer | Indicates whether locks
are released when the cursor is closed. The possible values are:
SQLFreeStmt() is
called with fOption set to SQL_CLOSE or
the statement handle is freed with SQLFreeHandle().
In addition, the end of the transaction (when a commit or rollback
is issued) can also cause the closing of the cursor (depending on
the WITH HOLD attribute currently in use). |
| SQL_CREATE_ASSERTION | 32-bit mask | Indicates which clauses in the CREATE
ASSERTION statement are supported by the database management system. Db2 ODBC always returns zero; the
CREATE ASSERTION statement is not supported. ODBC also defines the
following values that Db2 ODBC
does not return:
|
| SQL_CREATE_CHARACTER_SET | 32-bit mask | Indicates which clauses in the CREATE
CHARACTER SET statement are supported by the database management system. Db2 ODBC always returns zero; the
CREATE CHARACTER SET statement is not supported. ODBC also defines
the following values that Db2 ODBC
does not return:
|
| SQL_CREATE_COLLATION | 32-bit mask | Indicates which clauses in the CREATE
COLLATION statement are supported by the database management system. Db2 ODBC always returns zero; the
CREATE COLLATION statement is not supported. ODBC also defines the
following values that Db2 ODBC
does not return:
|
| SQL_CREATE_DOMAIN | 32-bit mask | Indicates which clauses in the CREATE
DOMAIN statement are supported by the database management system. Db2 ODBC always returns zero; the
CREATE DOMAIN statement is not supported. ODBC also defines the following
values that Db2 ODBC does not
return:
|
| SQL_CREATE_SCHEMA | 32-bit mask | Indicates which clauses in the CREATE
SCHEMA statement are supported by the database management system:
|
| SQL_CREATE_TABLE | 32-bit mask | Indicates which clauses in the CREATE
TABLE statement are supported by the database management system. The
following bit masks are used to determine which clauses are supported:
|
| SQL_CREATE_TRANSLATION | 32-bit mask | Indicates which clauses in the CREATE
TRANSLATION statement are supported by the database management system. Db2 ODBC always returns zero; the
CREATE TRANSLATION statement is not supported. ODBC also defines the
following value that Db2 ODBC
does not return:
|
| SQL_CURSOR_COMMIT_BEHAVIOR | 16-bit integer | Indicates how a COMMIT
operation affects cursors. A value of:
After COMMIT, 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. A value of:
Db2 servers do not have the SQL_CB_PRESERVE property. |
| SQL_CURSOR_SENSITIVITY | 32-bit unsigned integer | Indicates support for cursor sensitivity:
|
| SQL_DATA_SOURCE_NAME | string | The name used as data
source on the input to SQLConnect(), or the DSN keyword
value in the SQLDriverConnect() connection string. |
| 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 | The name of the current database in use. Also, this information returned by SELECT CURRENT SERVER on IBM database management systems. |
| SQL_DBMS_NAME | string | The name of the database management system product being accessed. |
| SQL_DBMS_VER | string | The version of the database management system product being accessed. A string of the form 'mm.vv.rrrr' where mm is the major version, vv is the minor version and rrrr is the release. For example, "02.01.0000" translates to major version 2, minor version 1, release 0. |
| SQL_DDL_INDEX | 32-bit unsigned integer | Indicates support for the creation
and dropping of indexes:
|
| SQL_DEFAULT_TXN_ISOLATION | 32-bit mask | The default transaction
isolation level supported. One of the following masks are returned:
|
| SQL_DESCRIBE_PARAMETER | STRING | 'Y' if parameters can be described; 'N' if not. |
| SQL_DRIVER_HDBC | 32 bits | Db2 ODBC's current database handle. |
| SQL_DRIVER_HENV | 32 bits | Db2 ODBC's environment handle. |
| SQL_DRIVER_HLIB | 32 bits | Reserved. |
| SQL_DRIVER_HSTMT | 32 bits | Db2 ODBC's current statement handle for the current connection. |
| SQL_DRIVER_NAME | string | The file name of the Db2 ODBC implementation. Db2 ODBC returns NULL. |
| SQL_DRIVER_ODBC_VER | string | The version number of ODBC that the driver supports. Db2 ODBC returns "3.00". |
| SQL_DRIVER_VER | string | The
version of the CLI driver. A string of the form 'mm.vv.rrrr'
major version 3, minor version 1, release 0. |
| SQL_DROP_ASSERTION | 32-bit mask | Indicates which clause in the DROP
ASSERTION statement is supported by the database management system. Db2 ODBC always returns zero; the
DROP ASSERTION statement is not supported. ODBC also defines the following
value that Db2 ODBC does not
return:
|
| SQL_DROP_CHARACTER_SET | 32-bit mask | Indicates which clause in the DROP
CHARACTER SET statement is supported by the database management system. Db2 ODBC always returns zero; the
DROP CHARACTER SET statement is not supported. ODBC also defines the
following value that Db2 ODBC
does not return.
|
| SQL_DROP_COLLATION | 32-bit mask | Indicates which clause in the DROP
COLLATION statement is supported by the database management system. Db2 ODBC always returns zero; the
DROP COLLATION statement is not supported. ODBC also defines the following
value that Db2 ODBC does not
return:
|
| SQL_DROP_DOMAIN | 32-bit mask | Indicates which clauses in the DROP
DOMAIN statement are supported by the database management system. Db2 ODBC always returns zero; the
DROP DOMAIN statement is not supported. ODBC also defines the following
values that Db2 ODBC does not
return:
|
| SQL_DROP_SCHEMA | 32-bit mask | Indicates which clauses in the DROP
SCHEMA statement are supported by the database management system.
|
| SQL_DROP_TABLE | 32-bit mask | Indicates which clauses in the DROP
TABLE statement are supported by the database management system:
|
| SQL_DROP_TRANSLATION | 32-bit mask | Indicates which clauses in the DROP
TRANSLATION statement are supported by the database management system. Db2 ODBC always returns zero; the
DROP TRANSLATION statement is not supported. ODBC also defines the
following value that Db2 ODBC
does not return:
|
| SQL_DROP_VIEW | 32-bit mask | Indicates which clauses in the DROP
VIEW statement are supported by the database management system.
|
| SQL_DYNAMIC_CURSOR_ATTRIBUTES1 | 32-bit mask | Indicates the attributes of a dynamic
cursor that Db2 ODBC supports
(subset 1 of 2).
|
| SQL_DYNAMIC_CURSOR_ATTRIBUTES2 | 32-bit mask | Indicates the attributes of a dynamic
cursor that Db2 ODBC supports
(subset 2 of 2).
|
| SQL_EBCDIC_GCCSID | 32-bit integer | Specifies the EBCDIC GCCSID value currently set in the AGCCSID field of Db2 DSNHDECP. |
| SQL_EBCDIC_MCCSID | 32-bit integer | Specifies the EBCDIC MCCSID value currently set in the AMCCSID field of Db2 DSNHDECP. |
| SQL_EBCDIC_SCCSID | 32-bit integer | Specifies the EBCDIC SCCSID value currently set in the ASCCSID field of Db2 DSNHDECP. |
| SQL_EXPRESSIONS_IN_ORDERBY | string | The character string 'Y' indicates the database server supports the DIRECT specification of expressions in the ORDER BY list, 'N' indicates that is does not. |
| SQL_FETCH_DIRECTION | 32-bit mask | The supported fetch directions.
The following bit-masks are used in conjunction with the flag
to determine which attribute values are supported.
|
| SQL_FILE_USAGE | 16-bit integer | Reserved. Zero is returned. |
| SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1 | 32-bit mask | Indicates the attributes of a forward-only
cursor that Db2 ODBC supports
(subset 1 of 2).
|
| SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 | 32-bit mask | Indicates the attributes of a forward-only
cursor that Db2 ODBC supports
(subset 2 of 2).
|
| SQL_GETDATA_EXTENSIONS | 32-bit mask | Indicates whether extensions
to the SQLGetData() function are supported.
The following extensions are currently identified and supported by Db2 ODBC:
ODBC also defines the following extensions, which are not
returned by Db2 ODBC:
|
| 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). A value of:
IBM specific: Identifier names in IBM database management systems are not case sensitive. |
| SQL_IDENTIFIER_QUOTE_CHAR | string | Indicates the character used to surround a delimited identifier. |
| SQL_INFO_SCHEMA_VIEWS | 32-bit mask | Indicates the views in the INFORMATIONAL_SCHEMA
that are supported. Db2 ODBC
always returns zero; no views in the INFORMATIONAL_SCHEMA are supported.
ODBC also defines the following values that Db2 ODBC does not return:
|
| SQL_INSERT_STATEMENT | 32-bit mask | Indicates support for INSERT statements:
|
| SQL_INTEGRITY (In previous versions of Db2 ODBC, this InfoType is SQL_ODBC_SQL_OPT_IEF.) | string | A 'Y' indicates that the data source supports Integrity Enhanced Facility (IEF) in SQL89 and in X/Open XPG4 Embedded SQL; an 'N' indicates that it does not. |
| SQL_KEYSET_CURSOR_ATTRIBUTES1 | 32-bit mask | Indicates the attributes of a keyset
cursor that Db2 ODBC supports
(subset 1 of 2).
|
| SQL_KEYSET_CURSOR_ATTRIBUTES2 | 32-bit mask | Indicates the attributes of a keyset
cursor that Db2 ODBC supports
(subset 2 of 2).
|
| SQL_KEYWORDS | string | A string of all the keywords at the database management system that are not in the ODBC's list of reserved words. |
| SQL_LIKE_ESCAPE_CLAUSE | string | A character string that indicates if an escape character is supported for the metacharacters percent and underscore in a LIKE predicate. |
| SQL_LOCK_TYPES | 32-bit mask | Reserved attribute, zero is returned for the bit mask. |
| SQL_MAX_ASYNC_CONCURRENT_STATEMENTS | 32-bit unsigned integer | The maximum number of active concurrent statements in asynchronous mode that Db2 ODBC can support on a given connection. This value is zero if this number has no specific limit, or the limit is unknown. |
| SQL_MAX_BINARY_LITERAL_LEN | 32-bit integer | A 32-bit integer value specifying the maximum length of a hexadecimal literal in a SQL statement. |
| SQL_MAX_CATALOG_NAME_LEN (In previous versions of Db2 ODBC, this InfoType is SQL_MAX_QUALIFIER_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_CHAR_LITERAL_LEN | 32-bit 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_COLUMNS_IN_TABLE | 16-bit integer | Indicates the maximum number of columns that the server supports in a base table. Zero if no limit. |
| SQL_MAX_CONCURRENT_ACTIVITIES (In previous versions of Db2 ODBC, this InfoType is SQL_ACTIVE_STATEMENTS.) | 16-bit integer | The maximum number of
active statements per connection. Zero is returned, indicating that the limit is dependent on database system and Db2 ODBC resources, and limits. |
| SQL_MAX_CURSOR_NAME_LEN | 16-bit integer | The maximum length of a cursor name (in bytes). |
| SQL_MAX_DRIVER_CONNECTIONS (In previous versions of Db2 ODBC, this InfoType is SQL_ACTIVE_CONNECTIONS.) | 16-bit integer | The maximum number of
active connections supported per application. Zero is returned, indicating that the limit is dependent on system resources. The MAXCONN keyword in the initialization file or the SQL_MAX_CONNECTIONS environment and connection attribute can be used to impose a limit on the number of connections. This limit is returned if it is set to any value other than zero. |
| SQL_MAX_IDENTIFIER_LEN | 16-bit integer | The maximum size (in characters) that the data source supports for user-defined names. |
| SQL_MAX_INDEX_SIZE | 32-bit integer | Indicates the maximum size in bytes that the server supports for the combined columns in an index. Zero if no limit. |
| SQL_MAX_PROCEDURE_NAME_LEN | 16-bit integer | The maximum length of a procedure name (in bytes). |
| SQL_MAX_ROW_SIZE | 32-bit integer | Specifies the maximum length, in bytes, that the server supports in single row of a base table. Zero if no limit. |
| SQL_MAX_ROW_SIZE_INCLUDES_LONG | string | Returns 'Y' if SQLGetInfo() with InfoType set
to SQL_MAX_ROW_SIZE includes the length of product-specific long
string data types. Otherwise, returns 'N'. |
| SQL_MAX_SCHEMA_NAME_LEN (In previous versions of Db2 ODBC, this InfoType is SQL_MAX_OWNER_NAME_LEN.) | 16-bit integer | The maximum length of a schema qualifier name (in bytes). |
| SQL_MAX_STATEMENT_LEN | 32-bit integer | Indicates the maximum length, in bytes, of an SQL statement string, which includes 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_MULT_RESULT_SETS | string | The character string 'Y' indicates that the database supports multiple result sets, 'N' indicates that it does not. |
| 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_NEED_LONG_DATA_LEN | string | A character string reserved for the use of ODBC. 'N' is always returned. |
| SQL_NON_NULLABLE_COLUMNS | 16-bit integer | Indicates whether non-nullable
columns are supported:
|
| SQL_NULL_COLLATION | 16-bit integer | Indicates where null
values are sorted in a list:
|
| SQL_NUMERIC_FUNCTIONS | 32-bit mask | Indicates the ODBC scalar
numeric functions supported. These functions are intended to be used
with the ODBC vendor escape sequence. 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_SAG_CLI_CONFORMANCE | 16-bit integer | The compliance to the
functions of the SQL Access Group (SAG) CLI specification. A
value of:
|
| SQL_ODBC_SQL_CONFORMANCE | 16-bit integer | A value of:
|
| SQL_ODBC_VER | string | The version number of
ODBC that the driver manager supports. Db2 ODBC returns the string "03.01.0000". |
| SQL_OJ_CAPABILITIES | 32-bit mask | A 32-bit bit mask enumerating
the types of outer join supported. The bit masks are:
|
| 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 (In previous versions of Db2 ODBC, this InfoType is SQL_SCHEMA_TERM.) | string | The database vendor's (owner's) terminology for a schema |
| SQL_PARAM_ARRAY_ROW_COUNTS | 32-bit unsigned integer | Indicates the availability of row
counts in a parameterized execution:
|
| SQL_PARAM_ARRAY_SELECTS | 32-bit unsigned integer | Indicates the availability of result
sets in a parameterized execution:
|
| SQL_POS_OPERATIONS | 32-bit mask | Reserved attribute, zero is returned for the bit mask. |
| SQL_POSITIONED_STATEMENTS | 32-bit mask | Indicates the degree
of support for positioned UPDATE and positioned DELETE statements:
|
| SQL_PROCEDURE_TERM | string | The name a database vendor uses for a procedure |
| SQL_PROCEDURES | string | 'Y' indicates that the data source supports procedures and Db2 ODBC supports the ODBC procedure invocation syntax. 'N' indicates that it does not. |
| SQL_QUOTED_IDENTIFIER_CASE | 16-bit integer | Returns:
|
| SQL_ROW_UPDATES | string | A character string of "Y" indicates changes are detected in rows between multiple fetches of the same rows, "N" indicates that changes are not detected. |
| SQL_SCHEMA_USAGE (In previous versions of Db2 ODBC, this InfoType is SQL_OWNER_USAGE.) | 32-bit mask | Indicates the type of
SQL statements that have schema (owners) associated with them when
these statements are executed. Schema qualifiers (owners) are:
|
| SQL_SCROLL_CONCURRENCY | 32-bit mask | Indicates the concurrency
options that are supported for the cursor. The following bit-masks
are used in conjunction with the flag to determine which attribute
values are supported:
Db2 ODBC returns SQL_SCCO_LOCK, indicating that the level of locking that is used is the lowest level of locking that is sufficient to ensure the row can be updated is used. |
| SQL_SCROLL_OPTIONS | 32-bit mask | The scroll options that
are supported for scrollable cursors. The following bit masks
are used in conjunction with the flag to determine which attribute
values are supported:
|
| SQL_SEARCH_PATTERN_ESCAPE | string | Used to specify what
the driver supports as an escape character for catalog functions such
as (SQLTables(), SQLColumns()). |
| SQL_SERVER_NAME | string | The name of the Db2 subsystem to which the application is connected. |
| SQL_SPECIAL_CHARACTERS | string | Contains all the characters that the server allows in non-delimited identifiers. This includes a...z, A...Z, 0...9, and _. |
| SQL_SQL92_PREDICATES | 32-bit mask | Indicates those predicates that are
defined by ANSI/ISO SQL standard of 1992 and
that are supported in a SELECT statement.
|
| SQL_SQL92_VALUE_EXPRESSIONS | 32-bit mask | Indicates those value expressions
that are defined by SQL92 and that are supported.
|
| SQL_STATIC_CURSOR_ATTRIBUTES1 | 32-bit mask | Indicates the attributes of a static cursor that Db2 ODBC supports (subset 1 of 2).
|
| SQL_STATIC_CURSOR_ATTRIBUTES2 | 32-bit mask | Indicates the attributes of a static cursor that Db2 ODBC supports (subset 2 of 2).
|
| SQL_STATIC_SENSITIVITY | 32-bit mask | Indicates whether changes
made by an application with a positioned UPDATE or DELETE statement
can be detected by that application:
|
| SQL_STRING_FUNCTIONS | 32-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_SUBQUERIES | 32-bit mask | Indicates which predicates
support subqueries:
|
| SQL_SYSTEM_FUNCTIONS | 32-bit mask | Indicates which scalar
system functions are supported. The following bit masks are used
to determine which scalar system functions are supported:
Tip: These functions are intended to be used with the escape sequence in ODBC. |
| SQL_TABLE_TERM | string | The database vendor's terminology for a table. |
| SQL_TIMEDATE_ADD_INTERVALS | 32-bit mask | Indicates whether the
special ODBC system function TIMESTAMPADD is supported, and, if it
is, which intervals are supported. The following bit masks are
used to determine which intervals are supported:
|
| SQL_TIMEDATE_DIFF_INTERVALS | 32-bit mask | Indicates whether the
special ODBC system function TIMESTAMPDIFF is supported, and, if it
is, which intervals are supported. The following bit masks are
used to determine which intervals are supported:
|
| 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:
Tip: These functions are intended to be used with the escape sequence in ODBC. |
| SQL_TXN_CAPABLE | 16-bit integer | Indicates whether transactions
can contain Data Definition Language, or Data Manipulation Language,
or both.
|
| SQL_TXN_ISOLATION_OPTION | 32-bit mask | The transaction isolation
levels available at the currently connected database server. The
following bit masks are used in conjunction with the flag to determine
which attribute values are supported:
|
| SQL_UNICODE_GCCSID | 32-bit integer | Specifies the UNICODE GCCSID value currently set in the UGCCSID field of Db2 DSNHDECP. |
| SQL_UNICODE_MCCSID | 32-bit integer | Specifies the UNICODE MCCSID value currently set in the UMCCSID field of Db2 DSNHDECP. |
| SQL_UNICODE_SCCSID | 32-bit integer | Specifies the UNICODE SCCSID value currently set in the USCCSID field of Db2 DSNHDECP. |
| SQL_UNION | 32-bit mask | Indicates whether the
server supports the UNION operator:
|
| SQL_USER_NAME | string | The user name that is
used in a particular database. This is the identifier specified on
the SQLConnect() call. |
| SQL_XOPEN_CLI_YEAR | string | Indicates the year of publication of the X/Open specification with which the version of the driver fully complies. |
Return codes
SQLGetInfo(),
it returns one of the following values: - SQL_SUCCESS
- SQL_SUCCESS_WITH_INFO
- SQL_ERROR
- SQL_INVALID_HANDLE
Diagnostics
The following table lists each SQLSTATE that this function generates, with a description and explanation for each value.
| SQLSTATE | Description | Explanation |
|---|---|---|
| 01004 | Data truncated. | The requested information is returned as a string
and its length exceeds the length of the application buffer as specified
in the BufferLength argument. The StringLengthPtr argument
contains the actual (not truncated) length, in bytes, of the requested
information. (SQLGetInfo() returns SQL_SUCCESS_WITH_INFO
for this SQLSTATE.) |
| 08003 | Connection is closed. | The type of information that the InfoType argument requests requires an open connection. Only the value SQL_ODBC_VER does not require an open connection. |
| 08S01 | Communication link failure. | The communication link between the application and data source fails before the function completes. |
| 58004 | Unexpected system failure. | Unrecoverable system error. |
| HY001 | Memory allocation failure. | Db2 ODBC is not able to allocate the required memory to support the execution or the completion of the function. |
| HY090 | Invalid string or buffer length. | The value specified for the argument BufferLength is less than 0. |
| HY096 | Invalid information type. | An invalid value is specified for the InfoType argument. |
| HYC00 | Driver not capable. | The value specified in the argument InfoType is not supported by Db2 ODBC or is not supported by the data source. |
Example
SQLGetInfo() to retrieve the current
data source name: SQLCHAR buffer[255];
SQLSMALLINT outlen;
rc = SQLGetInfo(hdbc, SQL_DATA_SOURCE_NAME, buffer, 255, &outlen);
printf("\nServer Name: %s\n", buffer);