2016-02-13 06:37:19 +00:00
|
|
|
#pragma once
|
|
|
|
|
2016-05-28 15:42:22 +00:00
|
|
|
#include <memory>
|
2016-02-13 06:37:19 +00:00
|
|
|
#include <DB/Core/Field.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class IAST;
|
|
|
|
class Context;
|
2017-02-16 22:05:48 +00:00
|
|
|
class IDataType;
|
2016-02-13 06:37:19 +00:00
|
|
|
|
2017-02-16 22:05:48 +00:00
|
|
|
/** Evaluate constant expression and it type.
|
2016-08-25 17:23:29 +00:00
|
|
|
* Used in rare cases - for elements of set for IN, for data to INSERT.
|
|
|
|
* Quite suboptimal.
|
2016-02-13 06:37:19 +00:00
|
|
|
*/
|
2017-02-16 22:05:48 +00:00
|
|
|
std::pair<Field, std::shared_ptr<IDataType>> evaluateConstantExpression(std::shared_ptr<IAST> & node, const Context & context);
|
2016-02-13 06:37:19 +00:00
|
|
|
|
2016-08-25 17:23:29 +00:00
|
|
|
|
|
|
|
/** Evaluate constant expression
|
|
|
|
* and returns ASTLiteral with its value.
|
|
|
|
*/
|
|
|
|
std::shared_ptr<IAST> evaluateConstantExpressionAsLiteral(std::shared_ptr<IAST> & node, const Context & context);
|
|
|
|
|
|
|
|
|
|
|
|
/** Evaluate constant expression
|
|
|
|
* and returns ASTLiteral with its value.
|
|
|
|
* Also, if AST is identifier, then return string literal with its name.
|
|
|
|
* Useful in places where some name may be specified as identifier, or as result of a constant expression.
|
|
|
|
*/
|
|
|
|
std::shared_ptr<IAST> evaluateConstantExpressionOrIdentidierAsLiteral(std::shared_ptr<IAST> & node, const Context & context);
|
|
|
|
|
2016-02-13 06:37:19 +00:00
|
|
|
}
|