FNC_TblOpGetExternalQuery Function | C Library Functions | Teradata Vantage - 17.10 - FNC_TblOpGetExternalQuery - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1147-171K
Language
English (United States)

Generates the text query string for the foreign server and returns the interface version that is currently supported.

Syntax

void
FNC_TblOpGetExternalQuery(FNC_TblOpColumnDef_t *colDefs,
                          ServerType             serverType,
                          ExtOpSetType           opSet,
                          int                  *interfaceVersion,
                          unsigned char       **extQryPtr,
                          unsigned int         *extQryLenPtr)

Syntax Elements

colDefs
IN parameter

A list of column definitions that may occur in a WHERE clause by the foreign server.

serverType
IN parameter
ServerType is defined as follows:
typedef enum
{
   ANSISQL = 1,
   HADOOP = 2
} serverType_et;

typedef int ServerType;
  • If ANSI SQL, the entire subquery for the table of the foreign server is returned.
  • If HADOOP, only the WHERE clause portion of the query is returned.
opSet
IN parameter

A set of valid operators supported on the foreign server.

ExOpSetType is defined as follows:
typedef enum
{
   Eq_ET,
   Ne_ET,
   Gt_ET,
   Le_ET,
   Lt_ET,
   And_ET,
   Or_ET,
   Not_ET,
   Between_ET,
   In_ET,
   NotIn_ET,
   Ge_ET,
   Like_ET
} extoptype_et;

typedef BYTE ExtOpType;
typedef unsigned int ExtOpSet;

typedef struct ExtOpSetType {
   ExtOpSet ExtOpSetList;
} ExtOpSetType;
interfaceVersion
IN/OUT parameter
A pointer to the interface version:
  • The caller passes in the desired interface version as the argument.
  • The routine returns the actual interface version that is currently returns the actual interface version that is currently
extQryLenPtr
OUT parameter

A pointer to the generated text query string for the foreign server. The query string is null-terminated.

extQryLenPtr
OUT parameter

A pointer to the length of the external query (in bytes).

Usage Notes

This routine is callable on a PE vproc only by a table operator.

FNC_TblOpGetExternalQuery calls FNC_malloc to allocate memory for the buffer specified by *extQryPtr. Unless the routine returns *extQryPtr as NULL, you must use FNC_free to free the allocated memory after processing the data.