From 81b3b489989dfe38b392cc21c043a110464725b9 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Mon, 22 Jul 2013 14:26:18 +0200 Subject: [PATCH] livestatus: add = operator for lists comparison refs #2743 --- components/livestatus/attributefilter.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/components/livestatus/attributefilter.cpp b/components/livestatus/attributefilter.cpp index 6b510fad0..3f9b0f0df 100644 --- a/components/livestatus/attributefilter.cpp +++ b/components/livestatus/attributefilter.cpp @@ -37,8 +37,9 @@ bool AttributeFilter::Apply(const Table::Ptr& table, const Value& row) Value value = column.ExtractValue(row); if (value.IsObjectType()) { + 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 == "=") { -- 2.40.0