2011-09-26 01:50:32 +00:00
|
|
|
#pragma once
|
2010-06-24 19:12:10 +00:00
|
|
|
|
|
|
|
#include <DB/Core/Field.h>
|
2015-10-12 07:05:54 +00:00
|
|
|
#include <DB/Core/FieldVisitors.h>
|
2014-07-03 22:39:13 +00:00
|
|
|
#include <DB/Parsers/ASTWithAlias.h>
|
2010-06-24 19:12:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
/** Литерал (атомарный) - число, строка, NULL
|
|
|
|
*/
|
2014-07-03 22:39:13 +00:00
|
|
|
class ASTLiteral : public ASTWithAlias
|
2010-06-24 19:12:10 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
Field value;
|
|
|
|
|
2014-12-17 15:26:24 +00:00
|
|
|
ASTLiteral() = default;
|
|
|
|
ASTLiteral(const StringRange range_, const Field & value_) : ASTWithAlias(range_), value(value_) {}
|
2011-09-25 03:37:09 +00:00
|
|
|
|
2015-06-29 05:46:55 +00:00
|
|
|
String getColumnName() const override;
|
2011-11-06 04:21:09 +00:00
|
|
|
|
2011-08-09 19:19:00 +00:00
|
|
|
/** Получить текст, который идентифицирует этот элемент. */
|
2017-01-06 17:41:19 +00:00
|
|
|
String getID() const override { return "Literal_" + applyVisitor(FieldVisitorDump(), value); }
|
2011-12-12 06:15:34 +00:00
|
|
|
|
2016-05-28 15:42:22 +00:00
|
|
|
ASTPtr clone() const override { return std::make_shared<ASTLiteral>(*this); }
|
2015-08-05 21:38:31 +00:00
|
|
|
|
|
|
|
protected:
|
2015-08-06 23:46:15 +00:00
|
|
|
void formatImplWithoutAlias(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override
|
2015-08-05 21:38:31 +00:00
|
|
|
{
|
2017-01-06 17:41:19 +00:00
|
|
|
settings.ostr << applyVisitor(FieldVisitorToString(), value);
|
2015-08-05 21:38:31 +00:00
|
|
|
}
|
2010-06-24 19:12:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|