From c68ef64bb810ff50d82d39dca342ba5294a50274 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 18 Feb 2019 09:55:36 +0000 Subject: [PATCH] [Fix] Clickhouse: Fix database usage Issue: #2759 Closes: #2759 --- lualib/lua_clickhouse.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lualib/lua_clickhouse.lua b/lualib/lua_clickhouse.lua index dbb74e283..96ea59f02 100644 --- a/lualib/lua_clickhouse.lua +++ b/lualib/lua_clickhouse.lua @@ -227,7 +227,7 @@ exports.select = function (upstream, settings, params, query, ok_cb, fail_cb) connect_prefix = 'https://' end local ip_addr = upstream:get_addr():to_string(true) - local database = params.database or 'default' + local database = settings.database or 'default' http_params.url = string.format('%s%s/?database=%s&default_format=JSONEachRow', connect_prefix, ip_addr, escape_spaces(database)) end @@ -278,7 +278,7 @@ exports.select_sync = function (upstream, settings, params, query, ok_cb, fail_c connect_prefix = 'https://' end local ip_addr = upstream:get_addr():to_string(true) - local database = params.database or 'default' + local database = settings.database or 'default' http_params.url = string.format('%s%s/?database=%s&default_format=JSONEachRow', connect_prefix, ip_addr, escape_spaces(database)) end @@ -342,7 +342,7 @@ exports.insert = function (upstream, settings, params, query, rows, connect_prefix = 'https://' end local ip_addr = upstream:get_addr():to_string(true) - local database = params.database or 'default' + local database = settings.database or 'default' http_params.url = string.format('%s%s/?database=%s&query=%s%%20FORMAT%%20TabSeparated', connect_prefix, ip_addr, @@ -394,7 +394,7 @@ exports.generic = function (upstream, settings, params, query, connect_prefix = 'https://' end local ip_addr = upstream:get_addr():to_string(true) - local database = params.database or 'default' + local database = settings.database or 'default' http_params.url = string.format('%s%s/?database=%s&default_format=JSONEachRow', connect_prefix, ip_addr, escape_spaces(database)) end @@ -439,7 +439,7 @@ exports.generic_sync = function (upstream, settings, params, query) connect_prefix = 'https://' end local ip_addr = upstream:get_addr():to_string(true) - local database = params.database or 'default' + local database = settings.database or 'default' http_params.url = string.format('%s%s/?database=%s&default_format=JSONEachRow', connect_prefix, ip_addr, escape_spaces(database)) end -- 2.39.5