This procedure is called from the SQL language and will import data in the XML format stored in the xml variable according to the mapping specified in the DAD. The entire import is a part of a transaction. If an error occurs during import, an exception is raised.
The dad_ref parameter may have two forms. If it is in the object_name prefixed with an asterisk (*object_name), the DAD will search the current opened application for a transfer type object, otherwise it is read from the specified variable.
The 602xml extension must be loaded in order to export to XML. It is required to prefix the function name with the extension name (CALL `602xml`.Export_to_XML). You must load the extension in advance on Linux (before compilation) with the following command:
CALL load_server_extension('602xml')
Download the attached XML file from e-mail and store this file into a table. Then transfer the XML data into various tables according to the DAD description.
SET Err = MailBoxSaveFileDBs(box,id_mail,0,"","XML_srcs","XML_src","id_xmlsrc=xml_src_seq.CURRVAL"); IF Err > 0 THEN // mail error does not cause a rollback!! if an error occurs, delete the record in the table manually CALL Log_write("Error when saving the file "+Int2str(Err)); DELETE FROM XML_srcs WHERE id_xmlsrc=xml_src_seq.CURRVAL; ELSE //OK SET dad = "*Dad_order"; SELECT xml_src INTO xml_source FROM XML_srcs WHERE id_xmlsrc=xml_src_seq.CURRVAL; // execute the transfer into the tables CALL`602xml`.Import_from_XML_CLOB (dad,xml_source); END IF;