summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorFabio Buso <dev.siroibaf@gmail.com>2016-08-09 10:25:37 +0200
committerLionel Elie Mamane <lionel@mamane.lu>2016-08-10 14:32:32 +0000
commit2c76fd1e04441889fbc416d4e5815ef31b474193 (patch)
treecd7aea0a33a0df8a3bef79ec801db5bed2fd62bf /wizards
parentd6e8d4f773d970b69baedd8523a426f18a8d8eef (diff)
tdf#67647 getStructuredFilter returns operator
Change-Id: I010ea3c24b4d5411711a93e35d4b173f5bde9e55 Reviewed-on: https://gerrit.libreoffice.org/28000 Reviewed-by: Lionel Elie Mamane <lionel@mamane.lu> Tested-by: Lionel Elie Mamane <lionel@mamane.lu>
Diffstat (limited to 'wizards')
-rw-r--r--wizards/com/sun/star/wizards/db/SQLQueryComposer.java56
-rw-r--r--wizards/com/sun/star/wizards/ui/FilterComponent.java2
2 files changed, 1 insertions, 57 deletions
diff --git a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java
index d169f7dd951a..17bc953affa9 100644
--- a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java
+++ b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java
@@ -429,62 +429,6 @@ public class SQLQueryComposer
}
}
- /**
- * retrieves a normalized structured filter
- *
- * <p>XSingleSelectQueryComposer.getStructuredFilter has a strange habit of returning the predicate (equal, not equal, etc)
- * effectively twice: Once as SQLFilterOperator, and once in the value. That is, if you have a term {@literal "column <> 3"}, then
- * you'll get an SQLFilterOperator.NOT_EQUAL (which is fine), <strong>and</strong> the textual value of the condition
- * will read {@literal "<> 3"}. The latter is strange enough, but even more strange is that this behavior is not even consistent:
- * for SQLFilterOperator.EQUAL, the "=" sign is not include in the textual value.</p>
- *
- * <p>To abstract from this weirdness, use this function here, which strips the unwanted tokens from the textual value
- * representation.</p>
- */
- public PropertyValue[][] getNormalizedStructuredFilter()
- {
- final PropertyValue[][] structuredFilter = m_queryComposer.getStructuredFilter();
- for (int i = 0; i < structuredFilter.length; ++i)
- {
- for (int j = 0; j < structuredFilter[i].length; ++j)
- {
- if (!(structuredFilter[i][j].Value instanceof String))
- {
- continue;
- }
- final StringBuffer textualValue = new StringBuffer((String) structuredFilter[i][j].Value);
- switch (structuredFilter[i][j].Handle)
- {
- case SQLFilterOperator.EQUAL:
- break;
- case SQLFilterOperator.NOT_EQUAL:
- case SQLFilterOperator.LESS_EQUAL:
- case SQLFilterOperator.GREATER_EQUAL:
- textualValue.delete(0, 2);
- break;
- case SQLFilterOperator.LESS:
- case SQLFilterOperator.GREATER:
- textualValue.delete(0, 1);
- break;
- case SQLFilterOperator.NOT_LIKE:
- textualValue.delete(0, 8);
- break;
- case SQLFilterOperator.LIKE:
- textualValue.delete(0, 4);
- break;
- case SQLFilterOperator.SQLNULL:
- textualValue.delete(0, 7);
- break;
- case SQLFilterOperator.NOT_SQLNULL:
- textualValue.delete(0, 11);
- break;
- }
- structuredFilter[i][j].Value = textualValue.toString().trim();
- }
- }
- return structuredFilter;
- }
-
public XSingleSelectQueryComposer getQueryComposer()
{
return m_queryComposer;
diff --git a/wizards/com/sun/star/wizards/ui/FilterComponent.java b/wizards/com/sun/star/wizards/ui/FilterComponent.java
index ad1eb18ca318..b6c39fc55603 100644
--- a/wizards/com/sun/star/wizards/ui/FilterComponent.java
+++ b/wizards/com/sun/star/wizards/ui/FilterComponent.java
@@ -274,7 +274,7 @@ public class FilterComponent
composer.getQueryComposer().appendFilterByColumn(columnSet, getfilterstate() == this.SOI_MATCHALL, nOperator);
}
}
- filterconditions = composer.getNormalizedStructuredFilter();
+ filterconditions = composer.getQueryComposer().getStructuredFilter();
int[] iduplicate = JavaTools.getDuplicateFieldIndex(filterconditions);
if (iduplicate[0] != -1)
{