diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2017-07-30 17:57:14 +0200 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2017-07-30 20:23:09 +0200 |
commit | 2b1d6f0d3b0b025148c81986ba7f109659d838af (patch) | |
tree | 475feb3567e60c37b5bc6f669711c1b9a65c33ad /dbaccess/source/ui/browser/brwctrlr.cxx | |
parent | aba73077851a744c06e72b3bddf5a0bae85d7c28 (diff) |
tdf#96370 rework filtering to be aware of WHERE vs HAVING clause
Several bugs (AFAIK not filed into tdf bugzilla) fixed.
Remaining problems:
When some filter clauses go into WHERE and others in HAVING,
they are always logically ANDed (it cannot be any other way),
but that is not communicated to the user in the UI.
Some things left undone:
* DatabaseDataProvider (and its users?) needs to be updated
to be HAVING-aware, too.
* Form-based filter (.uno:FormFilter) not HAVING-aware
it reads the current filter in function
svxform::FormController::setFilter
in
svx/source/form/formcontrollers.cxx
That's one place that needs to be updated.
The other place is the one that applies the filter.
Change-Id: I0e9d30a1927b6739a16ae7627e8d0dae8823b376
Diffstat (limited to 'dbaccess/source/ui/browser/brwctrlr.cxx')
-rw-r--r-- | dbaccess/source/ui/browser/brwctrlr.cxx | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx index af094e97620d..4cc6913b0866 100644 --- a/dbaccess/source/ui/browser/brwctrlr.cxx +++ b/dbaccess/source/ui/browser/brwctrlr.cxx @@ -2006,18 +2006,7 @@ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< Property break; // check if the column is a aggregate function - bool bHaving = false; - OUString sName; - xField->getPropertyValue(PROPERTY_NAME) >>= sName; - Reference< XColumnsSupplier > xColumnsSupplier(m_xParser, UNO_QUERY); - Reference< css::container::XNameAccess > xCols = xColumnsSupplier.is() ? xColumnsSupplier->getColumns() : Reference< css::container::XNameAccess > (); - if ( xCols.is() && xCols->hasByName(sName) ) - { - Reference<XPropertySet> xProp(xCols->getByName(sName),UNO_QUERY); - static const char sAgg[] = "AggregateFunction"; - if ( xProp->getPropertySetInfo()->hasPropertyByName(sAgg) ) - xProp->getPropertyValue(sAgg) >>= bHaving; - } + const bool bHaving(isAggregateColumn(m_xParser, xField)); Reference< XSingleSelectQueryComposer > xParser = createParser_nothrow(); const OUString sOldFilter = xParser->getFilter(); @@ -2029,7 +2018,8 @@ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< Property // -> completely overwrite it, else append one if (!bApplied) { - DO_SAFE( (bHaving ? xParser->setHavingClause(OUString()) : xParser->setFilter(::OUString())), "SbaXDataBrowserController::Execute : caught an exception while resetting the new filter !" ); + DO_SAFE( xParser->setFilter( OUString()), "SbaXDataBrowserController::Execute : caught an exception while resetting unapplied filter !" ); + DO_SAFE( xParser->setHavingClause(OUString()), "SbaXDataBrowserController::Execute : caught an exception while resetting unapplied HAVING clause !" ); } bool bParserSuccess = false; |