コンストラクタ メソッドのC関数定義 - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL外部ルーチン プログラミング

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
2020年6月
Language
日本語
Last Update
2021-03-30
dita:mapPath
ja-JP/qwr1571437338192.ditamap
dita:ditavalPath
ja-JP/qwr1571437338192.ditaval
dita:id
B035-1147
Product Category
Software
Teradata Vantage

以下のコード サンプルは、コンストラクタ メソッドを実装します。

/* File: c_circle_t.c */

#define SQL_TEXT Latin_Text
#include <sqltypes_td.h>
#include <string.h>

void circle_t_constructor( UDT_HANDLE *circleUdt,
                           INTEGER    *x_center,
                           INTEGER    *y_center,
                           INTEGER    *radius,
                           UDT_HANDLE *colorUdt,
                           UDT_HANDLE *resultCircleUdt,
                           char       sqlstate[6])
{
    INTEGER x, y;
    int nullIndicator;
    VARCHAR_LATIN color[31];
    int length;
    int len;

    /* Set the x and y coordinates in the result circle UDT. */
    nullIndicator = 0;
    FNC_SetStructuredAttribute(*resultCircleUdt, "x", x_center,
nullIndicator, SIZEOF_INTEGER);
    nullIndicator = 0;
    FNC_SetStructuredAttribute(*resultCircleUdt, "y", y_center,
nullIndicator, SIZEOF_INTEGER);

    /* Set the radius. */
    nullIndicator = 0;
    FNC_SetStructuredAttribute(*resultCircleUdt, "radius", radius,
nullIndicator, SIZEOF_INTEGER);

    /* Get the color UDT value and set it in the result circle UDT. */
    FNC_GetDistinctValue(*colorUdt, color, SIZEOF_VARCHAR_LATIN_WITH_NULL(30), &length);
    nullIndicator = 0;
    len = strlen(color);
    FNC_SetStructuredAttribute(*resultCircleUdt, "color", color,
nullIndicator, SIZEOF_VARCHAR_LATIN(len));
}