SQLGetFunctions function (CLI) - Get functions

Determines whether a specific CLI or ODBC function is supported. This allows applications to adapt to varying levels of support when connecting to different database servers.

Specification:

  • CLI 2.1
  • ODBC 1.0
  • ISO CLI

A connection to a database server must exist before calling this function.

Syntax

SQLRETURN   SQLGetFunctions  (
               SQLHDBC           ConnectionHandle,  /* hdbc */
               SQLUSMALLINT      FunctionId,        /* fFunction */
               SQLUSMALLINT      *SupportedPtr);    /* pfExists */

Function arguments

Table 1. SQLGetFunctions arguments
Data type Argument Use Description
SQLHDBC ConnectionHandle input Database connection handle.
SQLUSMALLINT FunctionId input The function being queried.
SQLUSMALLINT * SupportedPtr output Pointer to location where this function will return SQL_TRUE or SQL_FALSE depending on whether the function being queried is supported.

Usage

If FunctionId is set to SQL_API_ALL_FUNCTIONS, then SupportedPtr must point to an SQLSMALLINT array of 100 elements. The array is indexed by the FunctionId values used to identify many of the functions. Some elements of the array are unused and reserved. Since some FunctionId values are greater than 100, the array method can not be used to obtain a list of functions. The SQLGetFunctions() call must be explicitly issued for all FunctionId values equal to or above 100. The complete set of FunctionId values is defined in sqlcli1.h.

Note: The LOB support functions (SQLGetLength(), SQLGetPosition(), SQLGetSubString(), SQLBindFileToCol(), SQLBindFileToCol()) are not supported when connected to IBM RDBMSs that do not support LOB data types.

Return codes

  • SQL_SUCCESS
  • SQL_SUCCESS_WITH_INFO
  • SQL_ERROR
  • SQL_INVALID_HANDLE

Diagnostics

Table 2. SQLGetFunctions SQLSTATEs
SQLSTATE Description Explanation
40003 08S01 Communication link failure. The communication link between the application and data source failed before the function completed.
58004 Unexpected system failure. Unrecoverable system error.
HY001 Memory allocation failure. Db2® CLI is unable to allocate memory required to support execution or completion of the function. It is likely that process-level memory has been exhausted for the application process. Consult the operating system configuration for information about process-level memory limitations.
HY010 Function sequence error. SQLGetFunctions() was called before a database connection was established.
HY013 Unexpected memory handling error. Db2 CLI was unable to access memory required to support execution or completion of the function.

Authorization

None.

Example

  /* check to see if SQLGetInfo() is supported */
  cliRC = SQLGetFunctions(hdbc, SQL_API_SQLGETINFO, &supported);

References

None.