@ComponentProfile(summary="Output all result sets as a JSON Array", tag="json,jdbc") public class JdbcJsonArrayOutput extends JdbcJsonOutput
ResultSetTranslator
that iterates over all resultsets as a json array.
This differs from JdbcJsonOutput
in that it will iterate over all possible result sets returned by the JDBC operation;
generally speaking for a select, it will only be 1, but for a Stored procedured it could be multiple; and outputs each result set
as an element of a array. So if you have multiple result sets then this would be the output:
[{
"result": [{
"firstName": "John",
"lastName": "Doe"
}, {
"firstName": "Anna",
"lastName": "Smith"
}, {
"firstName": "Peter",
"lastName": "Jones"
}]
}, {
"result": [{
"firstName": "Sherlock",
"lastName": "Holmes"
}, {
"firstName": "John",
"lastName": "Watson"
}, {
"firstName": "Charles",
"lastName": "Darwin"
}]
}]
In the adapter configuration file this class is aliased as jdbc-json-all-resultset-output which is the preferred alternative to the fully qualified classname when building your configuration.
StyledResultTranslatorImp.ColumnStyle
mapper
log
Constructor and Description |
---|
JdbcJsonArrayOutput() |
Modifier and Type | Method and Description |
---|---|
void |
translate(JdbcResult source,
AdaptrisMessage target) |
withColumnStyle, writeResultSet
getColumnNameStyle, setColumnNameStyle, withColumnNameStyle
prepare
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, init, start, stop
public void translate(JdbcResult source, AdaptrisMessage target) throws java.sql.SQLException, ServiceException
translate
in interface ResultSetTranslator
translate
in class JdbcJsonOutput
java.sql.SQLException
ServiceException