XML.Import |
Imports data presented in the USoft XML single-table format or the USoft XML multi-table format. Processes the row elements found in the XML document one-by-one in document order. The exact behaviour is "UPSERT" handling by default, but this may be modified by the usoft-xml processing instruction supplied at the top of the import document, by DML instruction tags supplied inside the row elements, and by the VerifyOriginalValues and UseIOFormats parameters of XML.Import itself. If a DTD is specified in the XML document, the document contents must be in accordance with this DTD. Refer to: "Document Type Definition (DTD) Specification". Syntax
The required SELECT output-list is made up of 0 or more value parameter pairs and 1 required (SQL) expression, which may be named by the optional XMLDocument alias. Possible values for the value parameter pairs are listed in the table below. Expression is usually a filepath pointing to a file on the file system, in which case the optional FROM clause is typically omitted. If expression refers to a database column, the possible values for expression are: column OLD( column )
OLD() is not typical here. Other SQL functions than OLD() are NOT supported. It is customary, but not mandatory, to list value parameter-list pairs before expression. Example 1
Example 2
ParametersThis table lists all value-parameter pairs supported in the SELECT output lists passed to XML.Import. For each parameter, possible values are listed. The use of each parameter is optional. If you do not specify a given parameter and it has a default value associated with it, that is the value applied. Both parameter and value are case-insensitive.
VerifyOriginalValuesIMPORTANT: If the XML document being imported has a usoft-xml processing instruction specifying a verify-original-values attribute, then that attribute setting will silently override any setting specified for VerifyOriginalValues in the INVOKE XML.IMPORT statement. Setting the VerifyOriginalValues parameter allows optimistic locking mechanisms and prevents lost updates if different client applications change the same information concurrently. The VerifyOriginalValues parameter has an effect only on records in the XML document that contain an Update or Delete instruction tag. It determines whether or not the Rules Engine will perform 2 types of check before attempting the import instructions: •A check whether a record with the primary key value mentioned in the XML actually exists in the database. •A check that old values mentioned in the XML are the same as the old values in the database record. If any of these checks is performed and fails, a blocking error is raised, causing the import operation to be unsuccessful. Old values are non-primary-key values mentioned in the XML or found in the database before the Update or Delete. In the USoft XML format, old values are optional. By default, in an Update instruction, the old values are mentioned for each of the columns that are to be updated. The values of the VerifyOriginalValues parameter have the following meaning:
Example In this example, a blocking error is raised if one or more of the following apply: •There is no PERSON database record with ID = 112. •There is no PERSON database record with ID = 203. •There is a PERSON database record with ID = 112, but either its FAMILY_NAME value is other than "Smith" or its FIRST_NAME value is other than "John" (or both). •There is a PERSON database record with ID = 203, but either its FAMILY_NAME value is other than "Sutcliff" or its FIRST_NAME value is other than "Bill" (or both).
See also |