目的
これは 2 つの入力パラメーターとして、使用可能な XML コレクションの名前、 および分解される XML 文書を取り、2 つの出力パラメーターとして、 戻りコード、および戻りメッセージを戻します。
dxxInsertXML(char(UDB_SIZE) collectionName, /* input */ CLOB(1M) xmlobj, /* input */ long returnCode, /* output */ varchar(1024) returnMsg) /* output */
パラメーター
パラメーター | 説明 | IN/OUT パラメーター |
---|---|---|
collectionName | 使用可能な XML コレクションの名前 | IN |
xmlobj | CLOB タイプの XML 文書オブジェクト | IN |
returnCode | ストアード・プロシージャーからの戻りコード | OUT |
returnMsg | エラー発生時に戻されるメッセージ・テキスト | OUT |
例
以下の例では、 dxxInsertXML() 呼び出しによって入力 XML 文書 e:\xml\order1.xml を分解し、 この XML を使用可能にした DAD ファイル内のマッピングに従って、 データを SALES_ORDER コレクション表に挿入します。
#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);