FNC_MBBSetValue Function | C Library Functions | Teradata Vantage - FNC_MBBSetValue - Analytics Database - Teradata Vantage

SQL External Routine Programming

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-07-11
dita:mapPath
iiv1628111441820.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1147
lifecycle
latest
Product Category
Teradata Vantageā„¢

Set the value of an MBB (minimum bounding box) type using a buffer of six double precision values. The values represent the xmin, ymin, zmin, xmax, ymax, and zmax coordinates that define the MBB.

Syntax

void
FNC_MBBSetValue(GEO_HANDLE    mbbHandle,
                double *      mbbValue)

Syntax Elements

mbbHandle
A handle to an MBB type that is defined to be a return value for a UDF/UDM or an INOUT/OUT parameter to an external stored procedure.
mbbValue
A pointer to a buffer containing the six double precision values.

Usage Notes

FNC_MBBSetValue sets the value of an MBB type. A buffer mbbValue containing six double precision values is provided as input to the routine along with the MBB handle.

Example: Using FNC calls to set an MBB type value

The following function takes six double precision values as input, and returns an MBB value.

CREATE FUNCTION mbbUDF1(P0 DOUBLE PRECISION, P1 DOUBLE PRECISION, P2 DOUBLE PRECISION, 
                        P3 DOUBLE PRECISION, P4 DOUBLE PRECISION, P5 DOUBLE PRECISION)
RETURNS MBB
NO SQL
PARAMETER STYLE SQL
DETERMINISTIC
LANGUAGE C
EXTERNAL NAME 'CS!mbbUDF1!mbbUDF1.c';

void mbbUDF1 (DOUBLE_PRECISION* p0,
              DOUBLE_PRECISION * p1,
              DOUBLE_PRECISION * p2,
              DOUBLE_PRECISION * p3,
              DOUBLE_PRECISION * p4,
              DOUBLE_PRECISION * p5,
              GEO_HANDLE* resultMBB,
              int* indicator_p0,
              int* indicator_p1,
              int* indicator_p2,
              int* indicator_p3,
              int* indicator_p4,
              int* indicator_p5,
              int* indicator_Result,
              char       sqlstate[6],
              SQL_TEXT   extname[129],
              SQL_TEXT   specific_name[129],
              SQL_TEXT   error_message[257] )
{
     double* mbbBuffer;
     int returnSize;
     int mbbBufferSize;

     mbbBufferSize = 6 * SIZEOF_DOUBLE_PRECISION;
     mbbBuffer = (double*)FNC_Malloc(mbbBufferSize);
     /* Set the double precision values in the buffer */
      mbbBuffer[0] = *p0;
      mbbBuffer[1] = *p1;
      mbbBuffer[2] = *p2;
      mbbBuffer[3] = *p3;
      mbbBuffer[4] = *p4;
      mbbBuffer[5] = *p5;

      /* Set the MBB value */
       FNC_MBBSetValue(*resultMBB, mbbBuffer); 

     *indicator_Result = 0;
      FNC_free(mbbBuffer);
}