summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2018-10-24 18:13:56 +0200
committerLionel Elie Mamane <lionel@mamane.lu>2018-10-25 10:03:23 +0200
commit424454997a2a464d99c0e7125ea6b143716715b0 (patch)
treedb555db490d2316e3a7e817eebc599673f70760b /svx
parent1805239ffd35a4ee87b6c9ac05891ec60f7d577a (diff)
tdf#120713 correctly handle boolean values in filters
This commit has two parts: - Hardcode the correct BooleanComparisonMode in the firebird-sdbc driver (this fixes on Firebird databases, among others, the AutoFilter for bools) - Generic to all DBMS, have the "form-based filter" obey the BooleanComparisonMode Change-Id: Ib14e6c3d5cb773ae1f972840f8b53062f0224396 Reviewed-on: https://gerrit.libreoffice.org/62320 Reviewed-by: Lionel Elie Mamane <lionel@mamane.lu> Tested-by: Jenkins
Diffstat (limited to 'svx')
-rw-r--r--svx/source/fmcomp/gridcell.cxx13
1 files changed, 10 insertions, 3 deletions
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index 222267f4b85e..a6abdc7cdc83 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -3099,20 +3099,27 @@ void DbFilterField::UpdateFromField(const Reference< XColumn >& /*_rxField*/, co
IMPL_LINK_NOARG(DbFilterField, OnClick, VclPtr<CheckBox>, void)
{
TriState eState = static_cast<CheckBoxControl*>(m_pWindow.get())->GetBox().GetState();
- OUString aText;
+ OUStringBuffer aTextBuf;
+
+ Reference< XRowSet > xDataSourceRowSet(
+ Reference< XInterface >(*m_rColumn.GetParent().getDataSource()), UNO_QUERY);
+ Reference< XConnection > xConnection(getConnection(xDataSourceRowSet));
+ const sal_Int32 nBooleanComparisonMode = ::dbtools::DatabaseMetaData( xConnection ).getBooleanComparisonMode();
switch (eState)
{
case TRISTATE_TRUE:
- aText = "1";
+ ::dbtools::getBooleanComparisonPredicate("", true, nBooleanComparisonMode, aTextBuf);
break;
case TRISTATE_FALSE:
- aText = "0";
+ ::dbtools::getBooleanComparisonPredicate("", false, nBooleanComparisonMode, aTextBuf);
break;
case TRISTATE_INDET:
break;
}
+ const OUString aText(aTextBuf.makeStringAndClear());
+
if (m_aText != aText)
{
m_aText = aText;