2019-05-18 21:07:23 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Core/Names.h>
|
|
|
|
#include <Parsers/IAST_fwd.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class ASTQueryParameter;
|
|
|
|
|
2019-06-15 17:52:53 +00:00
|
|
|
/// Visit substitutions in a query, replace ASTQueryParameter with ASTLiteral.
|
2019-05-18 21:07:23 +00:00
|
|
|
class ReplaceQueryParameterVisitor
|
|
|
|
{
|
|
|
|
public:
|
2019-05-25 13:43:52 +00:00
|
|
|
ReplaceQueryParameterVisitor(const NameToNameMap & parameters)
|
2019-06-15 17:52:53 +00:00
|
|
|
: query_parameters(parameters)
|
2019-05-18 21:07:23 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
void visit(ASTPtr & ast);
|
|
|
|
|
|
|
|
private:
|
2019-06-15 17:52:53 +00:00
|
|
|
const NameToNameMap & query_parameters;
|
2019-06-14 16:18:59 +00:00
|
|
|
const String & getParamValue(const String & name);
|
|
|
|
void visitQueryParameter(ASTPtr & ast);
|
2019-05-18 21:07:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|