ClickHouse/dbms/include/DB/Parsers/formatAST.h

25 lines
832 B
C
Raw Normal View History

2011-09-04 05:14:52 +00:00
#pragma once
2010-06-28 13:44:42 +00:00
#include <ostream>
2015-03-02 01:10:58 +00:00
#include <DB/Core/NamesAndTypes.h>
2010-06-28 13:44:42 +00:00
#include <DB/Parsers/IAST.h>
namespace DB
{
/** Берёт синтаксическое дерево и превращает его обратно в текст.
2012-05-30 01:38:02 +00:00
* В случае запроса INSERT, данные будут отсутствовать.
2010-06-28 13:44:42 +00:00
*/
void formatAST(const IAST & ast, std::ostream & s, size_t indent = 0, bool hilite = true, bool one_line = false, bool need_parens = false);
2010-06-28 13:44:42 +00:00
String formatColumnsForCreateQuery(NamesAndTypesList & columns);
2014-03-03 20:22:39 +00:00
String backQuoteIfNeed(const String & x);
2014-10-01 16:38:04 +00:00
inline std::ostream & operator<<(std::ostream & os, const IAST & ast) { return formatAST(ast, os, 0, false, true), os; }
inline std::ostream & operator<<(std::ostream & os, const ASTPtr & ast) { return formatAST(*ast, os, 0, false, true), os; }
2010-06-28 13:44:42 +00:00
}