2012-08-02 19:03:32 +00:00
|
|
|
#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()
|
|
|
|
{
|
2014-06-26 00:58:14 +00:00
|
|
|
ASTSetQuery & ast = typeid_cast<ASTSetQuery &>(*query_ptr);
|
2012-08-02 19:03:32 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|