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

SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
qwr1571437338192.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1147
lifecycle
previous
Product Category
Teradata Vantage™

Purpose

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)
FNC_TblOpColumnDef_t *colDefs
IN parameter

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

ServerType 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.
ExtOpSetType 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;
int *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
unsigned char **extQryLenPtr
OUT parameter

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

unsigned int *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.