mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Make the value of invalidate_query human readable
This commit is contained in:
parent
e418e4da33
commit
5bac476eb1
@ -1,8 +1,10 @@
|
|||||||
#include "readInvalidateQuery.h"
|
#include "readInvalidateQuery.h"
|
||||||
#include <DataStreams/IBlockInputStream.h>
|
#include <DataStreams/IBlockInputStream.h>
|
||||||
|
#include <IO/WriteBufferFromString.h>
|
||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace ErrorCodes
|
namespace ErrorCodes
|
||||||
{
|
{
|
||||||
extern const int TOO_MANY_COLUMNS;
|
extern const int TOO_MANY_COLUMNS;
|
||||||
@ -13,7 +15,6 @@ namespace ErrorCodes
|
|||||||
std::string readInvalidateQuery(IBlockInputStream & block_input_stream)
|
std::string readInvalidateQuery(IBlockInputStream & block_input_stream)
|
||||||
{
|
{
|
||||||
block_input_stream.readPrefix();
|
block_input_stream.readPrefix();
|
||||||
std::string response;
|
|
||||||
|
|
||||||
Block block = block_input_stream.read();
|
Block block = block_input_stream.read();
|
||||||
if (!block)
|
if (!block)
|
||||||
@ -29,8 +30,9 @@ std::string readInvalidateQuery(IBlockInputStream & block_input_stream)
|
|||||||
if (rows > 1)
|
if (rows > 1)
|
||||||
throw Exception("Expected single row in resultset, got at least " + std::to_string(rows), ErrorCodes::TOO_MANY_ROWS);
|
throw Exception("Expected single row in resultset, got at least " + std::to_string(rows), ErrorCodes::TOO_MANY_ROWS);
|
||||||
|
|
||||||
auto column = block.getByPosition(0).column;
|
WriteBufferFromOwnString out;
|
||||||
response = column->getDataAt(0).toString();
|
auto & column_type = block.getByPosition(0);
|
||||||
|
column_type.type->serializeAsText(*column_type.column, 0, out, FormatSettings());
|
||||||
|
|
||||||
while ((block = block_input_stream.read()))
|
while ((block = block_input_stream.read()))
|
||||||
{
|
{
|
||||||
@ -40,7 +42,7 @@ std::string readInvalidateQuery(IBlockInputStream & block_input_stream)
|
|||||||
|
|
||||||
block_input_stream.readSuffix();
|
block_input_stream.readSuffix();
|
||||||
|
|
||||||
return response;
|
return out.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,8 @@ class IBlockInputStream;
|
|||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
// Using in MySQLDictionarySource and XDBCDictionarySource after processing invalidate_query
|
|
||||||
|
/// Using in MySQLDictionarySource and XDBCDictionarySource after processing invalidate_query.
|
||||||
std::string readInvalidateQuery(IBlockInputStream & block_input_stream);
|
std::string readInvalidateQuery(IBlockInputStream & block_input_stream);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user