Schema Class - Parallel Transporter

Teradata® Parallel Transporter Application Programming Interface Programmer Guide

Product
Parallel Transporter
Release Number
17.10
Published
June 2021
Language
English (United States)
Last Update
2021-07-01
dita:mapPath
ang1608578408836.ditamap
dita:ditavalPath
obe1474387269547.ditaval
dita:id
B035-2516
lifecycle
previous
Product Category
Teradata Tools and Utilities

The schema class of attributes contains information about the format of the data used in the task. This information is used by the drivers to process the data being loaded and exported.

When loading data with the Load, Update, or Stream drivers, ensure that the row data is consistent with the layout defined in the input schema. Discrepancies in the length of the row data could result in data corruption. If the row data is longer than defined in the input schema during PutRow or PutBuffer, Teradata PT will terminate with an error.

On mainframe-attached z/OS platforms, connection.h is located in TWB.H(CONNECTI). Notes have been made for the following syntax examples to use #include “connecti.h” instead of “connection.h.”
Schema Class Objects 
Object Name and Function Structure and Notes Return Codes
AddColumn

Defines a column variable within the schema.

Used to specify the name and type for a field in input and output data. Similar to the DEFINE command in Teradata FastLoad Reference (B035-2411) and the FIELD command in Teradata MultiLoad Reference (B035-2409), Teradata Parallel Data Pump Reference (B035-3021), and Teradata FastExport Reference (B035-2410).

For example, the calls to schema- > AddColumn() map to the DEFINE fields in the Teradata FastLoad script file.

#include "connection.h"
Void
AddColumn(
     char* colName,
     TD_DataType datatype,
     TD_ColumnSize
       size = 0,
     TD_ColumnPrecision
       precision = 0
     TD_ColumnScale
       scale = 0);

where these parameters specify:

  • colName – Input for column name.
  • dataType – Input for the column’s SQL data type.
  • size – Input for column size.
  • precision – Input for Column precision (Only applicable to decimal and period types).
  • scale – Input for Column scale (Only applicable to decimal type).

On mainframe-attached z/OS platforms, connection.h is located in TWB.H(CONNECTI). Use #include “connecti.h” instead of “connection.h.”

None
AddColumn

Specifies the column class and adds the column.

#include "connection.h"
Void
AddColumn(Column*);

where Column is the input of type vector.

* On mainframe-attached z/OS platforms, connection.h is located in TWB.H(CONNECT). Use #include "connecti.h" instead of "connection.h"

None
AddAttributeForColumn

Defines additional attributes for the already added columns to the schema class

#include "connection.h"
Void AddAttributeForColumn(Char* colName, 
     Char* colAttrName,  	
     Void* colAttrValue,
     TD_Length  colAttrLength,
     TD_DataType colAttrDataType);

Where the parameters specify:

  • colName – Input for an already added column to schema class.
  • colAttrName – Input for the name of the new attribute for the above column.
  • colAttrValue – Input for the value of the above new attribute.
  • colAttrLength – Input for the length of the above new attribute.
  • colAttrDataType – Input for the data type of the above new attribute.

Errors/Exceptions handled in this function will be reported back to the TPTAPI User application by the TPTAPI Connection Initiate().

On mainframe-attached z/OS platforms, connection.h is located in TWB.H(CONNECTI). Use #include "connecti.h" instead of "connection.h."

None
Class Constructor

Returns Schema class instance.

#include “connection.h”
using namespace teradata::client::API;
Schema*
Schema(
     Char* stype);

where stype is the input parameter for the type of schema (input or output).

On mainframe-attached z/OS platforms, connection.h is located in TWB.H(CONNECTI). Use #include “connecti.h” instead of “connection.h.”

None
Class Constructor

Specifies the Schema class and returns the instance.

#include "connection.h"
using namespace 
teradata::client::API;
Schema::Schema(const Schema& s)

where s is the type of the Parameter schema.

* On mainframe-attached z/OS platforms, connection.h is located in TWB.H(CONNECT). Use #include "connecti.h" instead of "connection.h"

None
Class Constructor

Specifies encoding for the Schema class and returns the Schema class instance.

#include “connection.h”
using namespace teradata::client::API;
Schema*
Schema(
     TD_Encoding  encoding);

where encoding is the input parameter for the type of encoding for this class. Valid values are TD_UTF8_ENCODING (the default) and TD_UTF16_ENCODING.

This Class Constructor is not supported on mainframe-attached z/OS platforms.

None
Column

Specifies the column class and returns the instance.

#include "connection.h"
Column(const Column& c);

* On mainframe-attached z/OS platforms, connection.h is located in TWB.H(CONNECT).Use #include ""connecti.h"" instead of ""connection.h

None
GetColumn

Gets the specific column and returns the column vector.

#include "connection.h"
Column* Schema::GetColumn(Int index)

where index is for the specific column

* On mainframe-attached z/OS platforms, connection.h is located in TWB.H(CONNECT).Use #include "connecti.h" instead of "connection.h"

Returns the vector holding the particular column.
GetColumns

Returns the column vector.

#include "connection.h"
vector<Column*> Schema::GetColumns()

* On mainframe-attached z/OS platforms, connection.h is located in TWB.H(CONNECT).Use #include "connecti.h" instead of "connection.h"

Returns the vector holding the columns.
GetColumnCount

Returns the number of columns.

#include "connection.h"
TD_Count Schema::GetColumnCount()

* On mainframe-attached z/OS platforms, connection.h is located in TWB.H(CONNECT).

Use #include "connecti.h" instead of "connection.h"

Returns the integer holding the column count.
GetDataType

Returns the column data type.

#include "connection.h"
int GetDataType();

* On mainframe-attached z/OS platforms, connection.h is located in TWB.H(CONNECT).Use #include "connecti.h" instead of "connection.h"

Returns the integer holding data type of TD_INTEGER and TD_CHAR. See TD_DataType.
GetEncoding

Gets encoding return the TD_ENCODING.

#include "connection.h"
TD_Encoding Schema::GetEncoding()

* On mainframe-attached z/OS platforms, connection.h is located in TWB.H(CONNECT).Use #include "connecti.h" instead of "connection.h"

TD_UTF8_ENCODING

TD_EBCDIC_ENCODING

TD_UTF16_ENCODING

GetName

Returns the table name.

#include "connection.h"
string Schema::GetName()

* On mainframe-attached z/OS platforms, connection.h is located in TWB.H(CONNECT).Use #include "connecti.h" instead of "connection.h"

Returns the string holding the table name.
GetName

Gets the column name.

#include "connection.h"
char* GetName();

* On mainframe-attached z/OS platforms, connection.h is located in TWB.H(CONNECT).Use #include "connecti.h" instead of "connection.h"

Returns the character pointer holding the column name.
GetPrecision

Returns the precision of the decimal column.

#include "connection.h"
int GetPrecision();

* On mainframe-attached z/OS platforms, connection.h is located in TWB.H(CONNECT).Use #include "connecti.h" instead of ""connection.h"

Returns the integer holding the decimal precision.
GetScale

Returns the scale of the decimal column.

#include "connection.h"
int GetScale();

* On mainframe-attached z/OS platforms,connection.h is located in TWB.H(CONNECT). Use #include "connecti.h" instead of "connection.h"

Returns the integer holding the scale precision.
GetSchemaType

Returns the schema type.

#include "connection.h"
PX_SchemaType Schema::GetSchemaType()

* On mainframe-attached z/OS platforms, connection.h is located in TWB.H(CONNECT).Use #include ""connecti.h"" instead of ""connection.h"

PX_NoSchema, PX_InputSchema

PX_OutputSchema

GetSize

Returns the column size.

#include "connection.h"
int GetSize();

* On mainframe-attached z/OS platforms, connection.h is located in TWB.H(CONNECT). Use #include "connecti.h" instead of "connection.h"

Returns the integer holding the size of the column.
IsNullable

Returns the boolean value.

#include "connection.h"
bool IsNullable();

* On mainframe-attached z/OS platforms, connection.h is located in TWB.H(CONNECT). Use #include "connecti.h" instead of "connection.h

False (or) True
SetName

Sets the table name.

#include ""connection.h"
void Schema::SetName(string name)

where name is the table name input to the Set name

* On mainframe-attached z/OS platforms, connection.h is located in TWB.H(CONNECT).Use #include ""connecti.h"" instead of ""connection.h

None
SetNullable

Sets the boolean value to the column.

#include ""connection.h"
void  SetNullable();

* On mainframe-attached z/OS platforms, connection.h is located in TWB.H(CONNECT). Use #include "connecti.h" instead of "connection.h"

None
SetOffset

Sets the offset of the column.

#include "connection.h"
void SetOffset(int offset);

* On mainframe-attached z/OS platforms, connection.h is located in TWB.H(CONNECT). Use #include "connecti.h" instead of "connection.h"

None
SetType

Sets the schema type (input or output).

#include “connection.h”
void
SetType(
	Char* stype);

where stype is an input parameter for the type of schema (input or output).

On mainframe-attached z/OS platforms, connection.h is located in TWB.H(CONNECTI). Use #include “connecti.h” instead of “connection.h.”

None