clickhouse-client: add echoOn/echoOff hints

This commit is contained in:
Azat Khuzhin 2021-06-01 08:54:28 +03:00
parent 1c595c127f
commit 69cf881947
4 changed files with 16 additions and 5 deletions

View File

@ -1110,8 +1110,7 @@ private:
// Echo all queries if asked; makes for a more readable reference
// file.
if (test_hint.echoQueries())
echo_queries_ = true;
echo_queries_ = test_hint.echoQueries().value_or(echo_queries_);
try
{

View File

@ -59,13 +59,13 @@ public:
int serverError() const { return server_error; }
int clientError() const { return client_error; }
bool echoQueries() const { return echo; }
std::optional<bool> echoQueries() const { return echo; }
private:
const String & query;
int server_error = 0;
int client_error = 0;
bool echo = false;
std::optional<bool> echo;
void parse(const String & hint, bool is_leading_hint)
{
@ -88,7 +88,11 @@ private:
}
if (item == "echo")
echo = true;
echo.emplace(true);
if (item == "echoOn")
echo.emplace(true);
if (item == "echoOff")
echo.emplace(false);
}
}

View File

@ -2,3 +2,7 @@
-- { echo }
select 1;
1
2
-- { echoOn }
select 2;
2

View File

@ -1,3 +1,7 @@
select 1;
-- { echo }
select 1;
-- { echoOff }
select 2;
-- { echoOn }
select 2;