mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-16 20:53:27 +00:00
36 lines
763 B
C++
36 lines
763 B
C++
#pragma once
|
|
|
|
#include <DB/Parsers/ASTSetQuery.h>
|
|
#include <DB/Interpreters/Context.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
|
|
/** Установить один или несколько параметров, для сессии или глобально.
|
|
*/
|
|
class InterpreterSetQuery
|
|
{
|
|
public:
|
|
InterpreterSetQuery(ASTPtr query_ptr_, Context & context_)
|
|
: query_ptr(query_ptr_), context(context_) {}
|
|
|
|
void execute()
|
|
{
|
|
ASTSetQuery & ast = typeid_cast<ASTSetQuery &>(*query_ptr);
|
|
|
|
Context & target = ast.global ? context.getGlobalContext() : context.getSessionContext();
|
|
|
|
for (ASTSetQuery::Changes::const_iterator it = ast.changes.begin(); it != ast.changes.end(); ++it)
|
|
target.setSetting(it->name, it->value);
|
|
}
|
|
|
|
private:
|
|
ASTPtr query_ptr;
|
|
Context & context;
|
|
};
|
|
|
|
|
|
}
|