Retrieving Database Metadata
The parameter AddMetaDataForQueries
(X4 Server Revision 32408 or newer) enables to output database metadata to the respective result set in the result XML document, in common with the results of the SQL statement.
The name of each XML element containing the corresponding metadata consists of the value of the attribute resulttag
in the input document and the appendix -meta
, e. g. <result-meta>
.
No metadata can be output for SQL statements that do not produce a result set (e. g. UPDATE
or DELETE
). When using the adapter's batch mode (StatementBatch, PreparedStatementBatch
or CallableStatementBatch
) this feature is also not available.
Example
The following input XML document defines an SQL query and a result element with the name result
:
<Root>
<statement resulttag="result">
<sql> SELECT X4USER, STARTTIME FROM HISTORY WHERE PID='1279017294476' </sql>
</statement>
</Root>
Then, the JDBC Connector outputs e. g. the following result XML document that contains the SQL query's results as well as the result set's metadata:
<Data>
<result-meta columns="2">
<Column name="X4USER" label="X4USER" type="VARCHAR"
nullable="true" auto-increment="false" read-only="false"
writable="false" display-size="255" case-sensitive="true"
searchable="true" signed="false" />
<Column name="STARTTIME" label="STARTTIME" type="TIMESTAMP"
nullable="true" auto-increment="false" read-only="false"
writable="false" display-size="26" case-sensitive="false"
searchable="true" signed="false" />
</result-meta>
<result>
<X4USER>1</X4USER>
<STARTTIME>2010-07-13 12:34:54.553</STARTTIME>
</result>
</Data>