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
|
|
|
|
*/
|
2015-08-06 03:26:27 +00:00
|
|
|
|
inline void formatAST(const IAST & ast, std::ostream & s, size_t indent = 0, bool hilite = true, bool one_line = false)
|
|
|
|
|
{
|
|
|
|
|
IAST::FormatSettings settings(s, hilite, one_line);
|
|
|
|
|
ast.format(settings);
|
|
|
|
|
}
|
2010-06-28 13:44:42 +00:00
|
|
|
|
|
2014-02-26 19:50:04 +00:00
|
|
|
|
|
|
|
|
|
String formatColumnsForCreateQuery(NamesAndTypesList & columns);
|
|
|
|
|
|
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
|
|
|
|
}
|