Example Using FNC_GLOP_Map_Page - 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ā„¢

Consider an external routine that maps one of five XML syntax rules pages depending on the type of document it must process. The XML rules are kept in a read-only system map in the "XML_Document_Syntax" set. The reason for using a system map is that the GLOP is read-only, so only one copy needs to exist and the XML document syntax rules are system wide and all documents need to use the same syntax.

Remember that more than one system type GLOP can be defined in a set. So if there is a need for specific generic system GLOP data, it can be mapped also.

#define XML_INDEX  0
XML_Rules   Current_XML_Rules;
GLOP_Map_t *MyGLOP;
int         Page_map;
int         glop_status

. . .

glop_status = FNC_Get_GLOP_Map(&MyGLOP);
if (!glop_status)
   ... process error: Not a member of any GLOP table
if ( MyGLOP->GLOP[XML_INDEX].GLOP_Ptr == NULL)
{
   ... process error: XML Syntax map does not exist
};

/* Determine page to map, based on "document_type" input parameter */
switch (*document_type)
{
   case WEB_page:
      Page_map = 1;
      break;
   case PDF_page:
      Page_map = 2;
      break;
   case Text_page:
      Page_map = 3;
      break;
   case Graphic_page:
      Page_map = 4;
      break;
   case Formula_page:
      Page_map = 5;
      break;
   Default:
      /* error: invalid documents option - generate an error */
}

if (MyGLOP->GLOP[XML_INDEX].page != Page_map)
{   if (!FNC_GLOP_Map_Page(XML_INDEX, Page_map)) 
      ... error: could not map page
}

Current_XML_Rules = MyGLOP->GLOP[XML_INDEX].GLOP_ptr;

/* process the document */