15.10 - Schema Class - Parallel Transporter

Teradata Parallel Transporter Application Programming Interface

prodname
Parallel Transporter
vrm_release
15.10
category
Programming Reference
featnum
B035-2516-035K

Schema Class

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.

Note: 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.”

 

Table 3: 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 and the FIELD command in Teradata MultiLoad Reference, Teradata Parallel Data Pump Reference, and Teradata FastExport Reference.

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 Parameter 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

    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” on page 67.

    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