livestatus: add = operator for lists comparison

refs #2743
This commit is contained in:
Michael Friedrich 2013-07-22 14:26:18 +02:00
parent 4306264217
commit 81b3b48998
1 changed files with 5 additions and 2 deletions

View File

@ -37,8 +37,9 @@ bool AttributeFilter::Apply(const Table::Ptr& table, const Value& row)
Value value = column.ExtractValue(row);
if (value.IsObjectType<Array>()) {
Array::Ptr array = value;
if (m_Operator == ">=") {
Array::Ptr array = value;
ObjectLock olock(array);
BOOST_FOREACH(const String& item, array) {
if (item == m_Operand)
@ -46,8 +47,10 @@ bool AttributeFilter::Apply(const Table::Ptr& table, const Value& row)
}
return false; /* Item not found in list. */
} else if (m_Operator == "=") {
return (array->GetLength() == 0);
} else {
BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid operator for column '" + m_Column + "': " + m_Operator + " (expected '>=')."));
BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid operator for column '" + m_Column + "': " + m_Operator + " (expected '>=' or '=')."));
}
} else {
if (m_Operator == "=") {