16.20 - Statement Attributes - ODBC Driver for Teradata

ODBC Driver for Teradata® User Guide

prodname
ODBC Driver for Teradata
vrm_release
16.20
created_date
August 2020
category
User Guide
featnum
B035-2526-108K

The following table lists the statement attributes and their associated values.

Statement Attribute ValuePtr Contents
SQL_ATTR_AGKR An SQLUINTEGER value that determines the result from requests that insert into identity columns (INSERT, INSERT ... SELECT, UPSERT, MERGE-INTO). These requests can optionally return a result set containing identity column values (also known as auto-generated keys) for the inserted rows.
Values supported are as follows:
  • SQL_AGKR_NO
  • SQL_AGKR_IDENTITY_COLUMN
  • SQL_AGKR_WHOLE_ROW

The acronym AGKR is defined as Auto-Generated Key Retrieval.

This attribute can be set to SQL_AGKR_NO(0), SQL_AGKR_IDENTITY_COLUMN(1), or SQL_AGKR_WHOLE_ROW(2), meaning respectively that no keys are retrieved, only the identity column is retrieved, or the whole row is retrieved by ODBC Driver for Teradata after an insertion into a table containing an identity column.

An error is returned if the application tries to enable the auto-generated key retrieval and the database does not support the feature. The error returned is SQL_ERROR with SQLSTATE HY024 and the message is: Invalid attribute value.

SQL_ATTR_DATA_ENCRYPTION This SQLINTEGER statement attribute turns ON/OFF data encryption at statement level. All the transactions done under a statement handle are affected.
Values supported are as follows:
  • SQL_DATA_ENCRYPTION_ON
  • SQL_DATA_ENCRYPTION_OFF

This statement-level attribute overrides the connection-level data encryption option. For example, encryption can be turned ON or OFF with this attribute for a particular statement handle regardless of the connection-level setting. All other statement handles under the same connection handle use data encryption as per the default connection level setting.

SQL_ATTR_TDATAODBC_SBU_ROWCOUNT This attribute is an unsigned bigint (SQLUBIGINT) and lets 32-bit applications obtain the row count even if it is greater than the maximal signed integer (0x7FFFFFFF).
SQL_ATTR_TRUSTED_SQL SQL_ATTR_TRUSTED_SQL is an SQLUINTEGER value.
Values supported are as follows:
  • SQL_TRUE
  • SQL_FALSE

SQL_ATTR_TRUSTED_SQL attribute can be used to specify whether the next SQL that is executed (either through SQLExecute or SQLExecDirect) is trusted or not trusted.

Note that the value of SQL_ATTR_TRUSTED_SQL is SQL_FALSE by default, and it will be reset back to SQL_FALSE after any SQLExecute or SQLExecDirect is made.

The SQL_ATTR_TRUSTED_SQL attribute is a statement attribute.

When calling SQLSetStmtAttr() or SQLGetStmtAttr(), you must pass in the value SQL_IS_UINTEGER for the StringLength or BufferLength argument, respectively.

For more information, see Trusted Sessions.