SQLGetEnvAttr - Return current setting of an environment Attribute

Purpose

SQLGetEnvAttr() returns the current settings for the specified environment attribute.

These options are set using the SQLSetEnvAttr() function.

Syntax

SQLRETURN SQLGetEnvAttr (SQLHENV      henv,
                         SQLINTEGER   Attribute,
                         SQLPOINTER   Value,
                         SQLINTEGER   BufferLength,
                         SQLINTEGER   *StringLength);

Function arguments

Table 1. SQLGetEnvAttr arguments
Data type Argument Use Description
SQLHENV henv Input Environment handle.
SQLINTEGER * StringLength Output Length in bytes of the output data if the attribute value is a character string; otherwise, unused.
SQLINTEGER Attribute Input Attribute to retrieve. Refer to Table 2 for more information.
SQLINTEGER BufferLength Input Maximum size of buffer pointed to by Value, if the attribute value is a character string; otherwise, unused.
SQLPOINTER Value Output Current value associated with Attribute. The type of the value returned depends on Attribute.

If Attribute does not denote a string, then DB2® UDB CLI ignores BufferLength and does not set StringLength.

Usage

SQLGetEnvAttr() can be called at any time between the allocation and freeing of the environment handle. It obtains the current value of the environment attribute.

Diagnostics

Table 2. SQLGetEnvAttr SQLSTATEs
SQLSTATE Description Explanation
HY001 Memory allocation failure The driver is unable to allocate memory required to support the processing or completion of the function.
HY009 Attribute out of range An Attribute value that is not valid is specified.

The argument Value or StringLength is a null pointer.