Commit b588280b authored by Matija Obreza's avatar Matija Obreza
Browse files

BUG: single null values in filter are ignored

parent 6840cb46
...@@ -173,7 +173,7 @@ public class DirectMysqlQuery { ...@@ -173,7 +173,7 @@ public class DirectMysqlQuery {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("Parameter count: " + params.size()); LOG.debug("Parameter count: " + params.size());
LOG.debug("Count query:\n" + sb.toString()); LOG.debug("Count query:\n" + sb.toString() + " " + whereBuffer.toString());
} }
return this; return this;
...@@ -214,11 +214,11 @@ public class DirectMysqlQuery { ...@@ -214,11 +214,11 @@ public class DirectMysqlQuery {
LOG.debug("Handling " + dbName); LOG.debug("Handling " + dbName);
} }
if (appliedFilter != null && appliedFilter.getValues().size() > 0) { if (appliedFilter != null && appliedFilter.size() > 0) {
Set<FilterValue> filterValues = appliedFilter.getValues(); Set<FilterValue> filterValues = appliedFilter.getValues();
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("Adding " + appliedFilter + " sz=" + filterValues.size() + " t=" + appliedFilter.getClass().getSimpleName()); LOG.debug("Adding " + appliedFilter + " sz=" + appliedFilter.size() + " t=" + appliedFilter.getClass().getSimpleName());
} }
if (sb.length() == 0) { if (sb.length() == 0) {
...@@ -226,7 +226,7 @@ public class DirectMysqlQuery { ...@@ -226,7 +226,7 @@ public class DirectMysqlQuery {
} else { } else {
sb.append(" and "); sb.append(" and ");
} }
// Opening // Opening
if (appliedFilter.isInverse()) { if (appliedFilter.isInverse()) {
sb.append(" NOT "); sb.append(" NOT ");
...@@ -234,12 +234,8 @@ public class DirectMysqlQuery { ...@@ -234,12 +234,8 @@ public class DirectMysqlQuery {
sb.append(" ( "); sb.append(" ( ");
// A filter value can be (a) explicit value or (b) an operation // A filter value can be (a) explicit value or (b) an operation
int toHandle=filterValues.size(); int toHandle = appliedFilter.size();
if (appliedFilter.getWithNull()) {
toHandle++;
}
// (a) explicit values are handled by =? or by IN (?,?,..) // (a) explicit values are handled by =? or by IN (?,?,..)
int handledCount = handleExplicitValues(sb, dbName, filterValues, params); int handledCount = handleExplicitValues(sb, dbName, filterValues, params);
......
...@@ -485,7 +485,15 @@ public class FilterHandler { ...@@ -485,7 +485,15 @@ public class FilterHandler {
return true; return true;
} }
/**
* Returns the number of applied values, +1 when null is included
*
* @return
*/
public int size() { public int size() {
if (withNull) {
return values.size() + 1;
}
return values.size(); return values.size();
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment