Purpose
The dxxShredXML() stored procedure is the pairing stored procedure of dxxGenXML(). In order for dxxShredXML() to work, all tables specified in the DAD file must exist, and all columns and their data types that are specified in the DAD must be consistent with the existing tables. The stored procedure dxxShredXML() does not require the primary-foreign key relationship among joining tables, which is created by the XML Extender during the enable collection process. However, the join condition columns that are specified in the RDB_node of the root element_node must exist in the tables.
dxxShredXML(CLOB(100K) DAD, /* input */ CLOB(1M) xmlobj, /* input */ long returnCode, /* output */ varchar(1024) returnMsg) /* output */
Parameters
Table 48. dxxShredXML() parameters
Parameter | Description | IN/OUT parameter |
---|---|---|
DAD | A CLOB containing the DAD file. | IN |
xmlobj | An XML document object in XMLCLOB type. | IN |
returnCode | The return code from the stored procedure. | OUT |
returnMsg | The message text that is returned in case of error. | OUT |
Examples
The following is an example of a call to dxxShredXML().
#include "dxx.h" #include "dxxrc.h" EXEC SQL INCLUDE SQLCA; EXEC SQL BEGIN DECLARE SECTION; SQL TYPE is CLOB dad; /* DAD*/ SQL TYPE is CLOB_FILE dadFile; /* DAD file*/ SQL TYPE is CLOB xmlDoc; /* input XML document */ SQL TYPE is CLOB_FILE xmlFile; /* input XMLfile */ long returnCode; /* error code */ char returnMsg[1024]; /* error message text */ short dad_ind; short xmlDoc_ind; short returnCode_ind; short returnMsg_ind; EXEC SQL END DECLARE SECTION; /* initialize host variable and indicators */ strcpy(dadFile.name,"c:\dxx\samples\dad\getstart_xcollection.dad"); dadFile.name_length=strlen("c:\dxx\samples\dad\getstart_xcollection.dad"); dadFile.file_option=SQL_FILE_READ; strcpy(xmlFile.name,"c:\dxx\samples\cmd\getstart.xml"); xmlFile.name_length=strlen("c:\dxx\samples\cmd\getstart.xml"); xmlFile.file_option=SQL_FILE_READ; SQL EXEC VALUES (:dadFile) INTO :dad; SQL EXEC VALUES (:xmlFile) INTO :xmlDoc; returnCode = 0; returnMsg[0] = '\0'; dad_ind = 0; xmlDoc_ind = 0; returnCode_ind = -1; returnMsg_ind = -1; /* Call the store procedure */ EXEC SQL CALL db2xml!dxxShredXML(:dad:dad_ind; :xmlDoc:xmlDoc_ind, :returnCode:returnCode_ind,:returnMsg:returnMsg_ind);