Fix sql op and add comment. (#6922)

This commit is contained in:
Nicolo Maio 2023-03-23 14:32:03 +00:00
parent fc135e1661
commit d4c67d4efc

View file

@ -258,11 +258,15 @@ function alert_store:build_sql_cond(cond, is_write)
elseif cond.field == 'alert_id' and tonumber(cond.value) ~= 0 then
local alert_id_bit = "bitShiftLeft(toUInt128('1'), "..cond.value..")"
sql_cond = string.format(" (%s %s %u %s (%s %s %s) ) ",
--[[
filter with the predominant alert_id and also search
the alert_id in the alerts_map where the other flow alerts are present.
--]]
self:get_column_name('alert_id', is_write),
sql_op, cond.value,
'OR',
"bitAnd("..alert_id_bit..",reinterpretAsUInt128(reverse(unhex(alerts_map))) )",
"=",
sql_op,
alert_id_bit)
-- Special case: ip (with vlan)