skip to main content
OpenAccess SDK SQL Engine Core Functions API : Function Reference : dam_getInfo
 

dam_getInfo

This function returns the requested connection and statement level information from the OpenAccess SDK SQL engine. See Table 123 for the types of information that can be returned.
int dam_getInfo(
DAM_HDBC hdbc,
DAM_HSTMT hstmt,
int iInfoType,
void * pInfoValue
int iInfoValueMax,
int * piInfoValueLen)
Table 122. Parameters for dam_getInfo
Parameter
Type
Description
IN
hdbc
DAM_HDBC
The OpenAccess SDK SQL engine connection handle to be used for connection level options.
Set to NULL for statement level options.
hstmt
DAM_HSTMT
The statement handle to be used for statement level options.
Set to NULL for connection level options.
iInfoType
int
The type of information requested. See Table 123 for the types of information that can be returned.
iInfoValueMax
int
The size of the buffer pointed to by pInfoValue.
OUT
pInfoValue
void *
Short integer, integer, char or void pointer value, depending on the type of information requested. Strings are null terminated.
piInfoValueLen
int *
The number of bytes written at pInfoValue.
RETURN
int
Status of the call:
DAM_SUCCESS - retrieved the iInfoType value.
DAM_FAILURE - wrong value for iInfoType or the output buffer is not large enough.
Table 123. Information Type for dam_getInfo
Information Type
Description
DAM_INFO_BLOCKJOIN_IS_ENABLED
Statement level information. The return value is a short integer with Value 1 if Block Join is enabled for the query. The value is 0 if Block Join is disabled.
DAM_INFO_CLIENT_ADDRESS
Connection level information. Returns the local IP address of the client as a string of the form 'ddd.ddd.ddd.ddd' (for example, "100.23.24.25"). The value is a string of maximum 128 characters. This option can be used while running in DAM_MODE_CS to implement a client IP-based authentication scheme.
DAM_INFO_CLIENT_​APPLICATION_NAME
Connection level information indicating the name of the client application on this connection. The value is an ASCII string of maximum length 128.
DAM_INFO_CLIENT_PRODUCT_VERSION
Connection level information indicating the version of the client product that the OpenAccess SDK client is accessing for this connection. The value is a string of maximum 128 characters.
DAM_INFO_CLIENT_​PUBLIC_ADDRESS
Connection level information. Returns the public IP address of the client as a string of the form 'ddd.ddd.ddd.ddd' (for example, "100.23.24.25"). The value is a string of maximum 128 characters. This option can be used while running in DAM_MODE_CS to implement a client IP-based authentication scheme.
DAM_INFO_CLIENT_TYPE
Connection level information indicating the OpenAccess SDK client type for this connection. The value is a short integer. The possible values are:
*DAM_CLIENTTYPE_ODBC
*DAM_CLIENTTYPE_JDBC
*DAM_CLIENTTYPE_OLEDB
*DAM_CLIENTTYPE_NET
DAM_INFO_CONNECTION_ MODEL
Global information (set hstmt to NULL). Returns a short integer value indicating the threading mode of the service associated with this data source. The threading modes are:
*DAM_CONNECTMODEL_THREADPOOL
*DAM_CONNECTMODEL_PROCESS
*DAM_CONNECTMODEL_THREAD
DAM_INFO_CONNECTION_ALIVE
Connection level information. This value is returned as a short integer. A value 0 is returned if connection is not active. The IP can cancel its operations and return DAM_FAILURE. The SQL Engine then closes the connection.
Note that the ServiceSQLCheckConnectionAlive service attribute must be enabled to support this feature. The default is Enable. Refer to the OpenAccess SDK Administrator's Guide for more information about the ServiceSQLCheckConnectionAlive service attribute.
DAM_INFO_DAM_HDBC
Statement level information. Returns the connection handle for the given statement. The value is returned as void *. This must be casted to DAM_CONN_DA pointer.
DAM_INFO_DISTINCT_​OPTIMIZABLE
Statement level information. The return value is greater than 0 if the current query has a SELECT DISTINCT clause that can be processed by the IP. The value is returned as a short integer. If the IP decides to handle the DISTINCT processing, then it should call dam_setOption to set DAM_STMT_OPTION_DISTINCT to DAM_PROCESS_OFF.
DAM_INFO_DTC_GUID
Connection level information. Retrieves the unique ID to identify the DTC at the time of recovery of distributed transaction. The information is returned as a character string of 36 characters. This information is not available during an OAIP_startTransaction IP call.
DAM_INFO_ESTIMATED_NUM_​SUBQUERIES
Statement level information. Returns the expected number of subqueries to process the given query. The value returned is an int data type.
DAM_INFO_FETCH_​BLOCK_SIZE
This information can be retrieved both for Connection level and Statement level. It indicates the number of rows to be fetched each time EXECUTE is called. This information is used if the IP is implementing cursor based select processing. The value is returned as a short integer.
DAM_INFO_GROUP_BY_​OPTIMIZABLE
Statement level option. The returned value is greater than 0 if the current query has a GROUP BY clause that can be processed by the IP. This value is a short integer, and it indicates the number of columns in the GROUP BY clause. Use dam_getGroupByCol() to get information about the columns in GROUP BY.
DAM_INFO_IP_CLASS
Connection level information. Returns the DataSourceIPClass service attribute value. The value is an ASCII string of maximum length 128.
DAM_INFO_IP_HDBC
Returns the IP_HDBC (the IP connection pointer that was returned when CONNECT was called). The value is a void pointer which the IP should case to its IP_HDBC type. Pass in either the DAM_HDBC or the DAM_HSTMT.
DAM_INFO_IP_​SUPPORT_UNICODE_INFO
Connection level information. Returns a value that indicates that the IP supports Unicode options in OAIP_getInfo and OAIP_setInfo. The value returned is of a short data type.
DAM_INFO_JOIN_QUERY_SIZE
Statement level option. Returns size (in number of tables) of the join query being processed. This value is returned as a short integer. A value of 1 is returned if the query is a simple single table select.
The IP can call this function from EXECUTE to check if the current query being processed is part of a join and call dam_getInfo(DAM_INO_QUERY_PROCESS_ORDER) to get the process order of the current table.
DAM_INFO_LANGUAGE_ID
Connection level information. Returns the LANGUAGE ID. The value returned is an ASCII string having a maximum length of 128 characters.
DAM_INFO_LOGFILE
Connection level information. Returns the LOG file name. The value returned is an ASCII string having a maximum length of 128 characters.
DAM_INFO_MODE
Global information (set hdbc and hstmt to NULL). Returns a short integer with the value DAM_MODE_SERVER or DAM_MODE_LOCAL to indicate if the IP module has been loaded by an OpenAccess SDK Server or an OpenAccess SDK Local Server. Use this information to control the behavior of your IP for standalone operation and for client/server operation without having to have separate builds.
DAM_INFO_OASQL_INI
Global information (set hdbc and hstmt to NULL). Returns the path and the file name that is being used for the OpenAccess SDK configuration information. The information is returned as a character string.
DAM_INFO_ORDER_BY_​OPTIMIZABLE
Statement level option. The returned value is greater than 0 if the current query has an ORDER BY clause that can be processed by the IP. This value is a short integer and it indicates the number of columns in the ORDER BY clause. Use dam_getOrderByCol() to get information about the columns in ORDER BY.
DAM_INFO_ORIGINAL_​QUERY_STRING
Statement level information. Retrieves the SQL string as specified by the application. The information is returned as a character string. Can be used to implement your own logging of queries.
DAM_INFO_ORIGINAL_​QUERY_STRINGW
Statement level information. Retrieves the SQL string as specified by the application. The information is returned as a wide character string. Can be used to implement your own logging of queries.
DAM_INFO_OUTER_​TABLE_CUR_ROWCOUNT
Statement level information. Returns the outer table current rowcount. If query is not a join, 0 is returned.
When the IP is processing inner query, it can get row count of outer table. The IP can use this information to decide if inner table can be processed as TableRowset. If outer table row count is a small number like 1, the IP can process the inner query directly and not use TableRowset.
The return value is a 64-bit integer.
DAM_INFO_PASSTHROUGH_​QUERY
Statement level information. The return value is greater than 0 if the current query is being executed in pass-through mode. The value is a short integer.
DAM_INFO_QUERY_CANCEL
Statement level information. The return value is greater than 0 if the current query execution was requested to be cancelled. The value is a short integer. When the IP detects a CANCEL request, it must clean up its resources that were allocated to handle this statement and return a DAM_FAILURE.
DAM_INFO_QUERY_HAS_​NOWAIT
Statement level information. Indicates whether the NOWAIT clause was specified in the SELECT FOR UPDATE statement. Used to determine whether to wait or not to wait when a row needs to be locked but it is already locked. The return value is short integer, 1 if there is a NOWAIT clause and 0 otherwise.
DAM_INFO_QUERY_HAS_​SEARCH_CONDITION
Statement level information. Indicates whether a statement has a where clause or not. This can be used to detect operations that are on the entire table. The return value is short integer 1 if there is a where clause and 0 if there is no where clause.
DAM_INFO_QUERY_IS_NESTED
Statement level option. This function returns a short integer 1 if the current statement represents a inner query and it returns 0 if it represents an outer query. Note that if the outer query is a join the all queries on the tables in the join list are considered to be outer queries. For example, in the query: SELECT * FROM emp WHERE dept_id IN (SELECT dept_id FROM dept WHERE location='SJ') the table DEPT is considered an inner query.
DAM_INFO_QUERY_MAX_ROWS
Statement level information. Returns the least of MaxRows or TOP N value provided in the query. The value returned is an int64 data type.
DAM_INFO_QUERY_PROCESS_​ORDER
Statement level option. When executing a JOIN on M tables, the returned value indicates which of the M tables is being processed. A value of zero is returned for the first table and a value of M-1 for the last table. This value is returned as a short integer.
DAM_INFO_QUERY_TIMEOUT
Statement level option. Returns the query timeout value in seconds. This value is returned as an integer. A value of 0 is returned if the query does not have a timeout set.
DAM_INFO_QUERY_TOP_ROWS
Statement level information. For a query containing a TOP N clause, the return value is N if the TOP N can be pushed down to the IP. The value is 0 (DAM_MAX_ROWS_UNLIMITED) if query does not have a TOP N option or the option cannot be exposed to the IP. The value is a 64-bit integer.
DAM_INFO_QUERY_TYPE
Statement level information. Returns the type of query being processed. The query type value is returned as a short integer that is one of the constants defined for the statement type in OAIP_execute.
DAM_INFO_RM_GUID
Connection level information. Retrieves the resource manager ID of the current MTS transaction. The information is returned as a character string of 36 characters. This information is not available during an OAIP_startTransaction IP call.
DAM_INFO_SCHEMA_PATH
Connection level information. Retrieves the schema path for the connection. The information is returned as a character string.
DAM_INFO_​SERVICEIPPATH
Connection level information. Returns the path for the C IP files as set in the ServiceIPPath attribute. The value is an ASCII string of maximum length 256.
DAM_INFO_SESSION_CIPHER_SUITE
Connection level information. Returns the cipher suite used for communication between the OpenAccess SDK client and server. The value returned is a string data type.
DAM_INFO_SESSION_CRYPTO_PROTOCOL_VERSION
Connection level information. Returns the cryptographic protocol version that can be used to create an SSL connection between the OpenAccess SDK client and server. The value returned is an integer data type.
Valid or expected values are the following SSL/TLS versions:
*DAM_VERSION_UNDEFINED – 0
*DAM_VERSION_TLS1 – 1
*DAM_VERSION_TLS1_1 – 2
*DAM_VERSION_TLS1_2 – 3
*Default when SSL Enabled:
DAM_VERSION_TLS1_2 – 2
DAM_INFO_SESSION_TOKEN
Connection level information. Returns session token as defined by the DataSourceSessionToken service attribute. The value is an ASCII string of maximum length 1024.
For example:
Session from $ClientInfo connected to $DataSourceName
DAM_INFO_SET_FUNCTIONS_​IN_QUERY
Statement level information. Returns the number of set functions in the given query. The value returned is an int data type.
DAM_INFO_SETLOCALE
Connection level information. Returns the LOCALE information of the client. The value returned is an ASCII string having a maximum length of 128 characters.
DAM_INFO_STMT_IP_​CONTEXT
Statement level information. Retrieves the context information stored for the entire query. The returned value is a void * (pass in a address of a void * variable for pInfoValue and size of void * for iInfoValueMax).
DAM_INFO_TXN_ID
Connection level information. Retrieves the transaction ID of the current MTS transaction. The information is returned as a character string of 36 characters. This information is not available during startTransaction IP call.
DAM_INFO_TXN_INFO
Connection level information. Retrieves the transaction information associated with the current MTS transaction. The information is returned as a character string of up to 240 characters. This information is not available during a startTransaction IP call.
DAM_INFO_TXN_ISO_LEVEL
Connection level information. Returns the isolation level of the connection. The value returned is an int data type.
DAM_INFO_TXN_NESTING_LEVEL
Connection level information. Returns the nesting level of the transaction. The value returned is of a short data type.
DAM_INFO_TXN_TYPE
Connection level information. Provides information about the current mode of transaction processing. The value is returned as a short integer. The options are:
*DAM_TXN_IMPLICIT - the currently active transaction is a local transaction with AUTO COMMIT ON option set on the connection. In this mode, the ODBC driver and ADO data provider generate a COMMIT after each non-SELECT statement. This results in OAIP_endTransaction being called with the specified option. This is then followed by OAIP_startTransaction to start a new transaction.
*DAM_TXN_EXPLICIT - the currently active transaction is a local transaction with AUTO COMMIT OFF. In this mode, the application must call COMMIT or ROLLBACK. This results in OAIP_endTransaction being called with the specified option. This is then followed by OAIP_startTransaction to start a new transaction.
DAM_INFO_USER
Connection level information. Returns the user name of the connection. The value returned is an ASCII string having a maximum length of 128 characters.