IBM Books

XML Extender Administration and Programming

dxxInsertXML()

Purpose

Takes two input parameters, the name of an enabled XML collection and the XML document that are to be decomposed, and returns two output parameters, a return code and a return message.

dxxInsertXML(char(UDB_SIZE) collectionName,   /* input */
             CLOB(1M)       xmlobj,           /* input */
             long           returnCode,       /* output */
             varchar(1024)  returnMsg)        /* output */

Parameters

Table 49. dxxInsertXML() parameters
Parameter Description IN/OUT parameter
collectionName The name of an enabled XML collection. IN
xmlobj An XML document object in CLOB type. IN
returnCode The return code from the stored procedure. OUT
returnMsg The message text that is returned in case of error. OUT

Examples

In the following example, the dxxInsertXML() call decomposes the input XML document e:\xml\order1.xml and inserts data into the SALES_ORDER collection tables according to the mapping that is specified in the DAD file with which it was enabled with.

#include "dxx.h" 
#include "dxxrc.h"
 
EXEC SQL INCLUDE SQLCA;
            EXEC SQL BEGIN DECLARE SECTION;
              char                  collection[64];  /* name of an XML collection */
              SQL TYPE is CLOB_FILE xmlDoc;          /* input XML document */
              long                  returnCode;      /* error code */
              char                  returnMsg[1024]; /* error message text */
              short                 collection_ind;
              short                 xmlDoc_ind;
              short                 returnCode_ind;
              short                 returnMsg_ind;
              EXEC SQL END DECLARE SECTION;
              
              /* initialize host variable and indicators */
              strcpy(collection,"sales_ord")
              strcpy(xmlobj.name,"c:\dxx\samples\cmd\getstart.xml");
              xmlobj.name_length=strlen("c:\dxx\samples\cmd\getstart.xml");
              xmlobj.file_option=SQL_FILE_READ;
              returnCode = 0;
              returnMsg[0] = '\0';
              collection_ind = 0;
              xmlobj_ind = 0;
              returnCode_ind = -1;
              returnMsg_ind = -1;
 
              /* Call the store procedure */
              EXEC SQL CALL db2xml!dxxInsertXML(:collection:collection_ind;
                              :xmlobj:xmlobj_ind,
                              :returnCode:returnCode_ind,:returnMsg:returnMsg_ind); 


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]