xBus

XML documents to access databases

The request and response files of example 5 are a good reference for the XML documents described here.

 Request

01 <?xml version="1.0" encoding="UTF-8"?>
02 <Example5>
03     <Statement>INSERT INTO example5 (text) VALUES ('Example5')</Statement>
04     <Statement>SELECT * FROM example5 ORDER BY number ASC</Statement>
05     <Statement>SELECT * FROM example5 ORDER BY number DESC</Statement>
06 </Example5>

02:
The name of the root element is an arbitrary string, which will not be evaluated.
03 - 05:
The DBSender will take the SQL statements from the tags named "Statement" and sends them one after the other to the database.
 Response

01 <?xml version="1.0" encoding="UTF-8"?>
02 <Example5Database>
03    <Result statement="INSERT INTO example5 (text) VALUES ('Example5')" rowcount="1" />
04    <Result statement="SELECT * FROM example5 ORDER BY number ASC">
05       <Record>
06          <EXAMPLE5.NUMBER>1</EXAMPLE5.NUMBER>
07          <EXAMPLE5.TEXT>Example5</EXAMPLE5.TEXT>
08       </Record>
09       <Record>
10          <EXAMPLE5.NUMBER>2</EXAMPLE5.NUMBER>
11          <EXAMPLE5.TEXT>Example5</EXAMPLE5.TEXT>
12       </Record>
13    </Result>
14    <Result statement="SELECT * FROM example5 ORDER BY number DESC">
15       <Record>
16          <EXAMPLE5.NUMBER>2</EXAMPLE5.NUMBER>
17          <EXAMPLE5.TEXT>Example5</EXAMPLE5.TEXT>
18       </Record>
19       <Record>
20          <EXAMPLE5.NUMBER>1</EXAMPLE5.NUMBER>
21          <EXAMPLE5.TEXT>Example5</EXAMPLE5.TEXT>
22       </Record>
23    </Result>
24 </Example5Database>

02:
The name of the root element is the name of the interface as defined in the configuration.
03, 04 - 13, 14 -23:
For every SQL statement in the request there is a result. The "Result" tag contains an attribute (statement) with the SQL statement.
03:
The result of INSERT, UPDATE or DELETE statements is stored in one tag with an additional attribute (rowcount) with the number of rows affected by the statement.
04 - 13:
The result of SELECT statements is more complex:
  • 05 - 08, 09 - 12: Every row of the resultset is inside a "Record" tag.
  • 06, 07, 10, 11: The name of every column tag is a concatenation of the table name and the column name. The data of the column is embedded here.