aboutsummaryrefslogtreecommitdiffstats
path: root/lualib
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-11-26 14:39:05 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-11-26 14:39:05 +0000
commit8cc76b5f2fde9e664221832ab414c23ac9af3dfd (patch)
tree7b493688549d3d62dbc13e3ad4e900f38b9e6ec9 /lualib
parent340d2e50d3fed6514a26566612534c384a008f4c (diff)
downloadrspamd-8cc76b5f2fde9e664221832ab414c23ac9af3dfd.tar.gz
rspamd-8cc76b5f2fde9e664221832ab414c23ac9af3dfd.zip
[Minor] Clickhouse: one more text related fix
Diffstat (limited to 'lualib')
-rw-r--r--lualib/lua_clickhouse.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/lualib/lua_clickhouse.lua b/lualib/lua_clickhouse.lua
index 4e20229b0..42dba7dc8 100644
--- a/lualib/lua_clickhouse.lua
+++ b/lualib/lua_clickhouse.lua
@@ -60,9 +60,12 @@ end
-- Converts an array to a string suitable for clickhouse
local function array_to_string(ar)
for i,elt in ipairs(ar) do
- if type(elt) == 'string' then
- ar[i] = '\'' .. clickhouse_quote(elt) .. '\''
- elseif type(elt) == 'number' then
+ local t = type(elt)
+ if t == 'string' then
+ ar[i] = string.format('\'%s\'', clickhouse_quote(elt))
+ elseif t == 'userdata' then
+ ar[i] = string.format('\'%s\'', clickhouse_quote(tostring(elt)))
+ elseif t == 'number' then
ar[i] = ch_number(elt)
end
end