An elementary query or statement is a (single select) statement whose parts are
not covered by the various set and get methods of the composer. That is, if the
elementary statement contains a filter clause, a call to
::com::sun::star::sdb::XSingleSelectQueryAnalyzer::getFilter will not return you this
filter. Instead, only filters which have been set using for instance setFilter
are covered by the get methods.
The only method which takes all parts of the elementary statement into account is
::com::sun::star::sdb::XSingleSelectQueryAnalyzer::getQuery , which always returns the complete
composed query.
As a result, you can use the composer to build culmulative filter expressions. That
is, you can set ElementaryQuery to a statement already containing
filters, and then use setFilter to append additional filters.
The very same holds for sort orders, HAVING
and GROUP BY
clauses.
There are various use cases for this. For instance, you might want to use the
statement represented by a ::com::sun::star::sdb::QueryDefinition , and extend it with additional
filters or sort orders, while not touching the respective parts already present
in QueryDefinition::Command . This can be achieved by setting the
QueryDefinition::Command as ElementaryQuery of a
::com::sun::star::sdb::SingleSelectQueryComposer .
If, in such a scenario, you would be interested in the filter part of the
QueryDefinition::Command , you would set it via
::com::sun::star::sdb::XSingleSelectQueryAnalyzer::setQuery , and retrieve the filter
part via ::com::sun::star::sdb::XSingleSelectQueryAnalyzer::getFilter .
If you'd be interested in the composed filter, you would set the
QueryDefinition::Command as ElementaryQuery , add your
filter, and propagate the resulting query ( ::com::sun::star::sdb::XSingleSelectQueryAnalyzer::getQuery )
to an ::com::sun::star::sdb::SingleSelectQueryAnalyzer instance via
::com::sun::star::sdb::XSingleSelectQueryAnalyzer::setQuery .