Conformance
Version Introduced: ODBC 1.0
Standards Compliance: ISO 92
Summary
f90SQLGetFunctions returns information about whether a driver supports a specific ODBC function. This function is implemented in the Driver Manager; it can also be implemented in drivers. If a driver implements f90SQLGetFunctions, the Driver Manager calls the function in the driver. Otherwise, it executes the function itself.
Syntax
| f90SQLGetFunctions | (ConnectionHandle, FunctionId, Supported, iRet) |
| integer(SQLHDBC_KIND),intent(in):: | ConnectionHandle |
| integer(SQLUSMALLINT_KIND),intent(in):: | FunctionId |
| { | |
| integer(SQLUSMALLINT_KIND),intent(out):: | Supported | |
| integer(SQLUSMALLINT_KIND),intent(out):: | Supported(:) |
| } | |
| integer(SQLRETURN_KIND),intent(out):: | iRet |
Arguments
ConnectionHandle [Input]
Connection Handle.
FunctionId [Input]
A constant value that identifies the ODBC function of interest; SQL_API_ODBC3_ALL_FUNCTIONS or SQL_API_ALL_FUNCTIONS. SQL_API_ODBC3_ALL_FUNCTIONS is used by an ODBC 3.0 application to determine support of ODBC 3.0 and earlier functions. SQL_API_ALL_FUNCTIONS is used by an ODBC 2.x application to determine support of ODBC 2.x and earlier functions.
For a list of constant values that identify ODBC functions, see the tables in "Comments."
Supported [Output]
If FunctionId identifies a single ODBC function, Supported is a single SQLUSMALLINT_KIND value that is SQL_TRUE if the specified function is supported by the driver, and SQL_FALSE if it is not supported.
If FunctionId is SQL_API_ODBC3_ALL_FUNCTIONS, Supported is a vector of SQLUSMALLINT_KIND with dimension equal to (4000/SQLUSMALLINT_KIND). This array is treated by the Driver Manager as a 4,000-bit bitmap that can be used to determine whether an ODBC 3.0 or earlier function is supported. The f90SQLFunctionExists function is called to determine function support (see "Comments"). An ODBC 3.0 application can call f90SQLGetFunctions with SQL_API_ODBC3_ALL_FUNCTIONS against either an ODBC 3.0 or ODBC 2.x driver.
If FunctionId is SQL_API_ALL_FUNCTIONS, Supported is a SQLUSMALLINT_KIND array of 100 elements. The array is indexed by constant values used by FunctionId to identify each ODBC function; some elements of the array are unused and reserved for future use. An element is SQL_TRUE if it identifies an ODBC 2.x or earlier function supported by the driver. It is SQL_FALSE if it identifies an ODBC function not supported by the driver or does not identify an ODBC function.
iRet [Output]
SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, or SQL_INVALID_HANDLE.
Diagnostics
When f90SQLGetFunctions returns SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value can be obtained by calling f90SQLGetDiagRec with a HandleType of SQL_HANDLE_DBC and a Handle of ConnectionHandle. The following table lists the SQLSTATE values commonly returned by f90SQLGetFunctions and explains each one in the context of this function; the notation "(DM)" precedes the descriptions of SQLSTATEs returned by the Driver Manager. The return code associated with each SQLSTATE value is SQL_ERROR, unless noted otherwise.
| SQLSTATE | Error | Description |
| 01000 | General warning | Driver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.) |
| 08S01 | Communication link failure | The communication link between the driver and the data source to which the driver was connected failed before the function completed processing. |
| HY000 | General error | An error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by f90SQLGetDiagRec in the MessageText buffer describes the error and its cause. |
| HY001 | Memory allocation error | The driver was unable to allocate memory required to support execution or completion of the function. |
| HY010 | Function sequence error | (DM) f90SQLGetFunctions
was called before f90SQLConnect, f90SQLBrowseConnect, or f90SQLDriverConnect. (DM) f90SQLBrowseConnect was called for the ConnectionHandle and returned SQL_NEED_DATA. This function was called before f90SQLBrowseConnect returned SQL_SUCCESS_WITH_INFO or SQL_SUCCESS. |
| HY013 | Memory management error | The function call could not be processed because the underlying memory objects could not be accessed, possibly because of low memory conditions. |
| HY095 | Function type out of range | (DM) An invalid FunctionId value was specified. |
| HYT01 | Connection timeout expired | The connection timeout period expired before the data source responded to the request. The connection timeout period is set through f90SQLSetConnectAttr, SQL_ATTR_CONNECTION_TIMEOUT. |
Comments
f90SQLGetFunctions always returns that f90SQLGetFunctions, f90SQLDataSources, and f90SQLDrivers are supported. It does this because these functions are implemented in the Driver Manager. The Driver Manager will map an ANSI function to the corresponding Unicode function if the Unicode function exists, and will map a Unicode function to the corresponding ANSI function if the ANSI function exists.
The following is a list of valid values for FunctionId for functions that conform to the ISO 92 standards - compliance level:
| SQL_API_SQLALLOCHANDLE | SQL_API_SQLGETDESCFIELD |
| SQL_API_SQLBINDCOL | SQL_API_SQLGETDESCREC |
| SQL_API_SQLCANCEL | SQL_API_SQLGETDIAGFIELD |
| SQL_API_SQLCLOSECURSOR | SQL_API_SQLGETDIAGREC |
| SQL_API_SQLCOLATTRIBUTE | SQL_API_SQLGETENVATTR |
| SQL_API_SQLCONNECT | SQL_API_SQLGETFUNCTIONS |
| SQL_API_SQLCOPYDESC | SQL_API_SQLGETINFO |
| SQL_API_SQLDATASOURCES | SQL_API_SQLGETSTMTATTR |
| SQL_API_SQLDESCRIBECOL | SQL_API_SQLGETTYPEINFO |
| SQL_API_SQLDISCONNECT | SQL_API_SQLNUMRESULTCOLS |
| SQL_API_SQLDRIVERS | SQL_API_SQLPARAMDATA |
| SQL_API_SQLENDTRAN | SQL_API_SQLPREPARE |
| SQL_API_SQLEXECDIRECT | SQL_API_SQLPUTDATA |
| SQL_API_SQLEXECUTE | SQL_API_SQLROWCOUNT |
| SQL_API_SQLFETCH | SQL_API_SQLSETCONNECTATTR |
| SQL_API_SQLFETCHSCROLL | SQL_API_SQLSETCURSORNAME |
| SQL_API_SQLFREEHANDLE | SQL_API_SQLSETDESCFIELD |
| SQL_API_SQLFREESTMT | SQL_API_SQLSETDESCREC |
| SQL_API_SQLGETCONNECTATTR | SQL_API_SQLSETENVATTR |
| SQL_API_SQLGETCURSORNAME | SQL_API_SQLSETSTMTATTR |
| SQL_API_SQLGETDATA |
The following is a list of valid values for FunctionId for functions conforming to the X/Open standards - compliance level:
| SQL_API_SQLCOLUMNS | SQL_API_SQLSTATISTICS |
| SQL_API_SQLSPECIALCOLUMNS | SQL_API_SQLTABLES |
The following is a list of valid values for FunctionId for functions conforming to the ODBC standards - compliance level:
| SQL_API_SQLBINDPARAMETER | SQL_API_SQLNATIVESQL |
| SQL_API_SQLBROWSECONNECT | SQL_API_SQLNUMPARAMS |
| SQL_API_SQLBULKOPERATIONS [1] | SQL_API_SQLPRIMARYKEYS |
| SQL_API_SQLCOLUMNPRIVILEGES | SQL_API_SQLPROCEDURECOLUMNS |
| SQL_API_SQLDESCRIBEPARAM | SQL_API_SQLPROCEDURES |
| SQL_API_SQLDRIVERCONNECT | SQL_API_SQLSETPOS |
| SQL_API_SQLFOREIGNKEYS | SQL_API_SQLTABLEPRIVILEGES |
| SQL_API_SQLMORERESULTS |
[1 ] When working with an ODBC 2.x driver, f90SQLBulkOperations will be returned as supported only if both of the following are true: the ODBC 2.x driver supports f90SQLSetPos, and the information type SQL_POS_OPERATIONS returns the SQL_POS_ADD bit as set.
f90SQLFunctionExists Function
The f90SQLFunctionExists(Supported, FunctionId) function is used to determine support of ODBC 3.0 or earlier functions after f90SQLGetFunctions has been called with a FunctionId argument of SQL_API_ODBC3_ALL_FUNCTIONS. The application calls f90SQLFunctionExists with the Supported argument set to the Supported passed in f90SQLGetFunctions, and with the FunctionId argument set to the constant identifier for the function. f90SQLFunctionExists returns SQL_TRUE if the function is supported, and SQL_FALSE otherwise.
Note: When working with an ODBC 2.x driver, the ODBC 3.0 Driver Manager will return SQL_TRUE for f90SQLAllocHandle and f90SQLFreeHandle, because f90SQLAllocHandle is mapped to SQLAllocEnv, SQLAllocConnect, or SQLAllocStmt, and f90SQLFreeHandle is mapped to SQLFreeEnv, SQLFreeConnect, or f90SQLFreeStmt. f90SQLAllocHandle or f90SQLFreeHandle with a HandleType argument of SQL_HANDLE_DESC is not supported, however, even though SQL_TRUE is returned for the functions, because there is no ODBC 2.x function to map to in this case.
Code Example
See Example 5.3, Chapter 5.
The following two examples show how an application uses f90SQLGetFunctions to determine if a driver supports f90SQLTables, f90SQLColumns, and f90SQLStatistics. If the driver does not support these functions, the application disconnects from the driver. The first example calls f90SQLGetFunctions once for each function.
|
The second example calls f90SQLGetFunctions a single time and passes it an array in which f90SQLGetFunctions returns information about all ODBC functions.
|
Related Subroutines
| For information about | See |
| Returning the setting of a connection attribute | f90SQLGetConnectAttr |
| Returning information about a driver or data source | f90SQLGetInfo |
| Returning the setting of a statement attribute | f90SQLGetStmtAttr |