16.4.3 SQLGetInfo, SQLGetInfoW
- Organization of this subsection
(1) Function
This ODBC function returns general information about the driver and data source associated with a connection.
(2) Format
-
For SQLGetInfo
SQLRETURN SQLGetInfo ( SQLHDBC ConnectionHandle, /* In */ SQLUSMALLINT InfoType, /* In */ SQLPOINTER InfoValuePtr, /* In/Out */ SQLSMALLINT BufferLength, /* In */ SQLSMALLINT * StringLengthPtr /* Out */ )
-
For SQLGetInfoW
SQLRETURN SQLGetInfoW ( SQLHDBC ConnectionHandle, /* In */ SQLUSMALLINT InfoType, /* In */ SQLPOINTER InfoValuePtr, /* In/Out */ SQLSMALLINT BufferLength, /* In */ SQLSMALLINT * StringLengthPtr /* Out */ )
(3) Arguments
- ConnectionHandle
-
Specifies a connection handle.
- InfoType
-
Specifies a type of information.
For details about the types of information that can be specified, see 16.13 Information types that can be specified for InfoType in SQLGetInfo and SQLGetInfoW.
- InfoValuePtr
-
Specifies a pointer to the buffer in which the information is to be returned. The function returns the information for the requested InfoType. If a specifiable information type is specified for InfoType but that information type is not supported, the function might return the null character string or zero.
- BufferLength
-
Specifies the length (in bytes) of the *InfoValuePtr buffer. This length includes the null terminating character. SQL_NTS cannot be specified.
If the *InfoValuePtr value is not a character string or InfoValuePtr is a null pointer, this argument is ignored.
If the value of InfoValuPtr is not a character string, the HADB ODBC driver assumes that the size of *InfoValuePtr is either SQLUSMALLINT or SQLUINTEGER based on InfoType. If the buffer is too small, operation is not guaranteed.
- StringLengthPtr
-
Specifies a pointer to the buffer that returns the total valid length (in bytes) to be returned to *InfoValuePtr. This length does not include the null terminating character.
- Important
-
For character string data, if this length (in bytes) is greater than the value of BufferLength without the length of the null terminating character, the character string stored in *InfoValuePtr is truncated to the length (in bytes) equivalent to BufferLength without the null terminating character, and then the null terminating character is added at the end. For any other data type, the value of BufferLength is ignored, in which case the driver assumes that the size of *InfoValuePtr is either SQLUSMALLINT or SQLUINTEGER based on InfoType.
(4) Return value
This ODBC function returns SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, or SQL_INVALID_HANDLE.
(5) SQLSTATE
This ODBC function returns one of the following SQLSTATE values:
SQLSTATE |
Description |
Remarks |
Returned |
---|---|---|---|
01000 |
General warning |
-- |
N |
01004 |
Character string data was right-truncated |
Not all of the requested information could be stored because the *InfoValuePtr buffer was too small (the information was truncated). The length of the untruncated requested information is stored in *StringLengthPtr. The function returns SQL_SUCCESS_WITH_INFO. |
Y |
01S51 |
Code replacement occurred during conversion of character encoding |
A character code that cannot be converted was detected and then replaced with the specified character. The function returns SQL_SUCCESS_WITH_INFO. |
Y |
08003 |
Connection does not exist |
-- |
N |
08S01 |
Communication link failure |
N |
|
HY000 |
General error |
N |
|
HY001 |
Memory allocation error |
N |
|
HY009 |
Invalid use of null pointer |
N |
|
HY013 |
Memory management error |
N |
|
HY024 |
Invalid attribute value |
N |
|
HY090 |
Invalid string or buffer length |
An invalid value (SQL_NTS) was specified in BufferLength. |
Y |
HY096 |
Out-of-range information type |
The value specified in InfoType is not supported. |
Y |
HY117 |
Connection suspended |
-- |
N |
HYC00 |
Optional feature not implemented |
N |
|
HYT01 |
Connection timeout expired |
N |
|
IM001 |
Driver does not support this function |
N |
- Legend:
-
Y: This SQLSTATE might be returned by the HADB ODBC driver.
N: This SQLSTATE is not returned by the HADB ODBC driver.
--: None
(6) Notes
If the information type specified for InfoType is not SQL_DRIVER_ODBC_VER, the connection must have already been established.