2018-07-24 14:42:52 +00:00
|
|
|
#include <Common/Macros.h>
|
2018-03-12 18:38:00 +00:00
|
|
|
#include <Interpreters/Context.h>
|
2018-07-24 14:28:56 +00:00
|
|
|
#include <Storages/System/StorageSystemMacros.h>
|
2018-03-12 18:38:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2018-07-24 14:28:56 +00:00
|
|
|
NamesAndTypesList StorageSystemMacros::getNamesAndTypes()
|
2018-03-12 18:38:00 +00:00
|
|
|
{
|
2018-07-24 14:28:56 +00:00
|
|
|
return {
|
|
|
|
{"macro", std::make_shared<DataTypeString>()},
|
|
|
|
{"substitution", std::make_shared<DataTypeString>()},
|
|
|
|
};
|
2018-03-12 18:38:00 +00:00
|
|
|
}
|
|
|
|
|
2018-07-24 14:28:56 +00:00
|
|
|
void StorageSystemMacros::fillData(MutableColumns & res_columns, const Context & context, const SelectQueryInfo &) const
|
2018-03-12 18:38:00 +00:00
|
|
|
{
|
|
|
|
auto macros = context.getMacros();
|
|
|
|
|
|
|
|
for (const auto & macro : macros->getMacroMap())
|
|
|
|
{
|
|
|
|
res_columns[0]->insert(macro.first);
|
|
|
|
res_columns[1]->insert(macro.second);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|