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 {
if (LOG.isDebugEnabled()) {
LOG.debug("Parameter count: " + params.size());
LOG.debug("Count query:\n" + sb.toString());
LOG.debug("Count query:\n" + sb.toString() + " " + whereBuffer.toString());
}
return this;
......@@ -214,11 +214,11 @@ public class DirectMysqlQuery {
LOG.debug("Handling " + dbName);
}
if (appliedFilter != null && appliedFilter.getValues().size() > 0) {
if (appliedFilter != null && appliedFilter.size() > 0) {
Set<FilterValue> filterValues = appliedFilter.getValues();
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) {
......@@ -226,7 +226,7 @@ public class DirectMysqlQuery {
} else {
sb.append(" and ");
}
// Opening
if (appliedFilter.isInverse()) {
sb.append(" NOT ");
......@@ -234,12 +234,8 @@ public class DirectMysqlQuery {
sb.append(" ( ");
// A filter value can be (a) explicit value or (b) an operation
int toHandle=filterValues.size();
if (appliedFilter.getWithNull()) {
toHandle++;
}
int toHandle = appliedFilter.size();
// (a) explicit values are handled by =? or by IN (?,?,..)
int handledCount = handleExplicitValues(sb, dbName, filterValues, params);
......
......@@ -485,7 +485,15 @@ public class FilterHandler {
return true;
}
/**
* Returns the number of applied values, +1 when null is included
*
* @return
*/
public int size() {
if (withNull) {
return values.size() + 1;
}
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