16.20 - FNC_GetDatasetSchema - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
16.20
Release Date
April 2020
Content Type
Programming Reference
Publication ID
B035-1147-162K
Language
English (United States)

Purpose

Retrieves the schema for a DATASET data type instance.

Syntax

void
FNC_GetDatasetSchema ( DATASET_HANDLE              datasetHandle,
                       void*                       schemaBuf,
                       int                         schemaBufLen,
                       int*                        actualSchemaLength,
                       dataset_schema_encoding_t   schemaEncoding)
DATASET_HANDLE datasetHandle
A handle to a DATASET data type instance that is defined to be an input parameter to an external routine.
void* schemaBuf
Return parameter that contains the UNICODE characters in JSON format representing the schema.
int schemaBufLen
The length of the buffer used to store the schema, in bytes.
int* actualSchemaLength
Return parameter specifying the length of the schema for this DATASET data type instance, in bytes.
dataset_schema_encoding_t schemaEncoding
The encoding in which the user would like to retrieve the schema.

Usage Notes

FNC_GetDatasetSchema can be used to retrieve the schema of a DATASET data type, regardless of storage format or size. The schema is returned as UNICODE text, encoded in either UTF-8 or UTF-16, depending on the value of the schemaEncoding parameter.

Note that the schema is returned without any special formatting, in its JSON encoding and with UNICODE characters.

Use FNC_GetDatasetInfo to determine the appropriate buffer size that can store the schema. If the buffer passed into this routine is too small to contain the entire schema, an error is reported.

For best performance, Use FNC_GetDatasetSchema when the schema is not stored as a LOB. If FNC_GetDatasetInfo returns schemaLob = 0, you can use FNC_GetDatasetSchema; otherwise, you should use FNC_GetDatasetSchemaLob instead.