«

»

Sep 22 2014

How to Upload XML info into BLOB field in table?

VN:F [1.9.22_1171]
Rating: 5.0/5 (3 votes cast)

 

Some time we need to upload XML info into table by using BLOB field.

How can we achieve that, here are the steps

  1. Create or search for table that has BLOB field (example standard table : F70XMLZ1)
  2. Create BSFN or modify standard BSFN (depending on your requirement )
  3. Add following code to update or insert BLOB field in table: 

Add following code in BSFN: 

Convert XML doc into XML string:

xmlcStatus = XRCS_serializeDocumentToXMLString(hDoc,&szXMLString);

 Copy table info:                      

jdeNIDcpy(dbRef.szTable, NID_F70XMLZ1);                 

dbRef.idInstance = 0L;                          

 Copy BLOB field:

jdeNIDcpy(dbRef.szDict, NID_G70TXFT);

 Calculate BLOB field size:

blobSize = ( (jdeStrlen(szXMLString)+ 1) * sizeof(JCHAR ) ) ;

 Set BLOB Size:

dsF70XMLZ1.syg70txft.lpValue = JDB_SetBLOBSize(hReqF70XMLZ1, dbRef, blobSize);                                  

dsF70XMLZ1.syg70txft.lSize = blobSize;

dsF70XMLZ1.syg70txft.lMaxSize = MAX_BLOB_SIZE;

 Copy XML string into BLOB field :

memcpy((void*)dsF70XMLZ1.syg70txft.lpValue, (void*)szXMLString,dsF70XMLZ1.syg70txft.lSize);

 call JDE data base API to insert or update table.

Published under the license.

VN:F [1.9.22_1171]
Rating: 5.0/5 (3 votes cast)
How to Upload XML info into BLOB field in table?, 5.0 out of 5 based on 3 ratings
(Visited 390 times, 2 visits today)

About the author

Shrikanth Hegde

Leave a Reply