2017-04-01 09:19:00 +00:00
|
|
|
#include <Parsers/formatAST.h>
|
2010-06-28 13:44:42 +00:00
|
|
|
|
2017-04-13 13:42:29 +00:00
|
|
|
#include <sstream>
|
2010-06-28 13:44:42 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2017-04-13 13:42:29 +00:00
|
|
|
void formatAST(const IAST & ast, std::ostream & s, size_t indent, bool hilite, bool one_line)
|
|
|
|
{
|
|
|
|
IAST::FormatSettings settings(s, hilite, one_line);
|
|
|
|
ast.format(settings);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-02-26 19:50:04 +00:00
|
|
|
String formatColumnsForCreateQuery(NamesAndTypesList & columns)
|
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
std::string res;
|
|
|
|
res += "(";
|
|
|
|
for (NamesAndTypesList::iterator it = columns.begin(); it != columns.end(); ++it)
|
|
|
|
{
|
|
|
|
if (it != columns.begin())
|
|
|
|
res += ", ";
|
|
|
|
res += backQuoteIfNeed(it->name);
|
|
|
|
res += " ";
|
|
|
|
res += it->type->getName();
|
|
|
|
}
|
|
|
|
res += ")";
|
|
|
|
return res;
|
2014-02-26 19:50:04 +00:00
|
|
|
}
|
|
|
|
|
2010-06-28 13:44:42 +00:00
|
|
|
}
|