FNC_TblOpGetExternalQuery Function | C Library Functions | Teradata Vantage - FNC_TblOpGetExternalQuery - Analytics Database - Teradata Vantage

SQL External Routine Programming

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-07-11
dita:mapPath
iiv1628111441820.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1147
lifecycle
latest
Product Category
Teradata Vantageā„¢

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.