This protocol is a backwards compatible extension of the protocol used by ODBC Socket Server written by Team fXML, details of which can be found elsewhere.
To simplify determining the CLIENT version, I have designated the old (fXML)
protocol as Protocol Version 1 (V1). My extensions are designated Protocol
Version 2 (V2). The server can tell which version the client supports by looking
for the version="x.x"
attribute at various places in the request. The client
can query the server to find out which protocol it supports by sending a V2
version request (see below) and testing for a successful response - a V1 server
will not understand the query and will send an error response.
The V1 protocol used a simple XML encoding to send a DSN and query to the V1 server.
The XML is shown "pretty-printed" here but, as with all XML, the exact formatting and layout of whitespace should not be counted upon.
<?xml version="1.0"?> <request> <connectionstring>DSN=XXX_my_dsn_XXX</connectionstring> <sql>SELECT * FROM XXX_my_table_or_view_XXX</sql> </request>
<?xml version="1.0"?> <result state="success"> <row> <column name="XXX_my_column_1_XXX">XXX_DATA_XXX</column> <column name="XXX_my_column_2_XXX">XXX_DATA_XXX</column> <column name="XXX_my_column_3_XXX">XXX_DATA_XXX</column> <column name="XXX_my_column_4_XXX">XXX_DATA_XXX</column> </row> <row> <column name="XXX_my_column_1_XXX">XXX_DATA_XXX</column> <column name="XXX_my_column_2_XXX">XXX_DATA_XXX</column> <column name="XXX_my_column_3_XXX">XXX_DATA_XXX</column> <column name="XXX_my_column_4_XXX">XXX_DATA_XXX</column> </row> </result>
name
attribute on the <column>
element
may or may not be present in the second and subsiquent <row>
element.
Their presence depends on a server configuration variable. In the HaqaSoft
V2 protocol they are ALWAYS PRESENT in EVERY row.<?xml version="1.0"?> <result state="failure"> <error>XXX_system_error_message_goes_here_XX</error> </result>
The V2 protocol builds on this solid foundation by adding the ability to retreive a list of tables, the structure of a table and to execute multiple queries within a single transaction.
<?xml version="1.0"?> <request version="2.0"> <connectionstring>DSN=XXX_my_dsn_XXX</connectionstring> <sql>SELECT * FROM XXX_my_table_or_view_XXX</sql> </request>
All of the following requests are only valid with the version="2.0"
attribute
included, both servers will produce an error if this is omitted. Depending
on the configuration of the server, any of the responses shown here may be
compressed.
<?xml version="1.0"?> <request version="2.0"> <version /> </request>
<?xml version="1.0"?> <result state="success" version="2.0" />
<?xml version="1.0"?> <request version="2.0"> <connectionstring>DSN=XXX_my_dsn_XXX</connectionstring> <catalog /> </request>
<?xml version="1.0"?> <result state="success" version="2.0"> <table>XXX_table_name_1_XXX</table> <table>XXX_table_name_2_XXX</table> <table>XXX_table_name_3_XXX</table> </result>
<?xml version="1.0"?> <request multiple="3" version="2.0"> <connectionstring>DSN=XXX_my_dsn_XXX</connectionstring> <subrequest id="1"> <sql>SELECT * FROM Table1</sql> </subrequest> <subrequest id="2"> <sql>SELECT * FROM Table2</sql> </subrequest> <subrequest id="3"> <connectionstring>DSN=SomeOtherDSN</connectionstring> <catalog /> </subrequest> </request>
<?xml version="1.0"?> <result multiple="3" version="2.0"> <subresult id="1" state="success"> <schema table="XXX_table_name_1_XXX"> <column name="XXX_my_column_1_XXX">XXX</column> <column name="XXX_my_column_2_XXX">XXX</column> <column name="XXX_my_column_3_XXX">XXX</column> <column name="XXX_my_column_4_XXX">XXX</column> </schema> </subresult> <subresult id="2" state="success"> <column name="XXX_my_column_1_XXX">XXX</column> <column name="XXX_my_column_2_XXX">XXX</column> <column name="XXX_my_column_3_XXX">XXX</column> <column name="XXX_my_column_4_XXX">XXX</column> </subresult> <subresult id="3" state="failure"> <error>XXX_system_error_message_goes_here_XX</error> </subresult> </result>
multiple
attribute of the request
element is set to a count of the
number of subrequests. This may be zero or any positive integer.subrequest
has an id
attribute, which allows the client
to match subresults to subrequest.request
element, and/or
in the subrequest
elments.<?xml version="1.0"?> <request version="2.0"> <connectionstring>DSN=XXX_my_dsn_XXX</connectionstring> <schema>XXX_table_name_XXX</schema> </request>
<?xml version="1.0"?> <result state="success" version="2.0"> <schema table="XXX_table_name_1_XXX"> <column name="XXX_my_column_1_XXX" /> <column name="XXX_my_column_2_XXX" /> <column name="XXX_my_column_3_XXX" /> <column name="XXX_my_column_4_XXX" /> </schema> </result>
<?xml version="1.0"?> <request version="2.0"> <connectionstring>DSN=XXX_my_dsn_XXX</connectionstring> <schema /> </request>
<?xml version="1.0"?> <result multiple="2" version="2.0"> <subresult id="1" state="success"> <schema table="XXX_table_name_1_XXX"> <column name="XXX_my_column_1_XXX" /> <column name="XXX_my_column_2_XXX" /> <column name="XXX_my_column_3_XXX" /> <column name="XXX_my_column_4_XXX" /> </schema> </subresult> <subresult id="2" state="success"> <schema table="XXX_table_name_1_XXX"> <column name="XXX_my_column_1_XXX" /> <column name="XXX_my_column_2_XXX" /> <column name="XXX_my_column_3_XXX" /> <column name="XXX_my_column_4_XXX" /> </schema> </subresult> </result>
id
attributes are auto generated
for the individual subresult
elements.