mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-28 10:31:57 +00:00
18 lines
309 B
C++
18 lines
309 B
C++
#pragma once
|
|
|
|
#include <DB/Parsers/formatAST.h>
|
|
|
|
namespace DB
|
|
{
|
|
template <typename ASTType>
|
|
inline std::string queryToString(const ASTPtr & query)
|
|
{
|
|
const auto & query_ast = typeid_cast<const ASTType &>(*query);
|
|
|
|
std::ostringstream s;
|
|
formatAST(query_ast, s, 0, false, true);
|
|
|
|
return s.str();
|
|
}
|
|
}
|