Row by Row Loading into the Database - Parallel Transporter

Teradata® Parallel Transporter Application Programming Interface Programmer Guide

Product
Parallel Transporter
Release Number
17.00
Published
November 30, 2020
Language
English (United States)
Last Update
2020-11-18
dita:mapPath
fcz1544831938753.ditamap
dita:ditavalPath
obe1474387269547.ditaval
dita:id
B035-2516
lifecycle
previous
Product Category
Teradata Tools and Utilities
There are three parts to loading data into the database using Teradata PT:
  • Load rows
  • Inform Teradata PT that acquisition is complete
  • Apply rows to the database

Data is loaded using the Connection object’s PutRow function. The PutRow function accepts as its arguments a pointer to a single row of data in null-indicator mode format, and the length of the data row (including the length of the null-indicator bytes). See Data Format for an illustration of the indicator-mode input data format.

The PutRow length is the total length of all the column values (including the length bytes for variable-length values) plus the number of indicator bytes. See Data Format for information on how to determine the number of indicator bytes in a row.

while (!endOfData) {
/* Assemble a row in null-indicator format */
   ...
/* Pass a row to the Teradata Database */
 conn->PutRow(buffer, length);
}

Although the application passes a row at a time, the Load, Update, and Stream drivers accumulate the rows in the CLIv2 buffer and then send them to the database by the buffer load.

Once all data has been loaded, the acquisition method is completed by calling the Connection object’s EndAcquisition function. This must be done before the data can be applied.

conn->EndAcquisition( );

When the acquisition method has been completed, the data is applied in the database by using the Connection object’s ApplyRows method. This method should only be called when using the Load or Update driver. The Stream driver automatically applies the changes which means the ApplyRows method should not be called when using the Stream driver.

conn->ApplyRows( );