mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 16:42:05 +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();
|
|
}
|
|
}
|