#include #include #include #include #include #include #include namespace DB { StorageSystemSettings::StorageSystemSettings(const std::string & name_) : name(name_) , columns{ { "name", std::make_shared() }, { "value", std::make_shared() }, { "changed", std::make_shared() }, { "description", std::make_shared() }, } { } BlockInputStreams StorageSystemSettings::read( const Names & column_names, const SelectQueryInfo &, const Context & context, QueryProcessingStage::Enum & processed_stage, const size_t /*max_block_size*/, const unsigned /*num_streams*/) { check(column_names); processed_stage = QueryProcessingStage::FetchColumns; const Settings & settings = context.getSettingsRef(); ColumnWithTypeAndName col_name{ColumnString::create(), std::make_shared(), "name"}; ColumnWithTypeAndName col_value{ColumnString::create(), std::make_shared(), "value"}; ColumnWithTypeAndName col_changed{ColumnUInt8::create(), std::make_shared(), "changed"}; ColumnWithTypeAndName col_description{ColumnString::create(), std::make_shared(), "description"}; #define ADD_SETTING(TYPE, NAME, DEFAULT, DESCRIPTION) \ col_name.column->insert(String(#NAME)); \ col_value.column->insert(settings.NAME.toString()); \ col_changed.column->insert(UInt64(settings.NAME.changed)); \ col_description.column->insert(String(DESCRIPTION)); APPLY_FOR_SETTINGS(ADD_SETTING) #undef ADD_SETTING #define ADD_LIMIT(TYPE, NAME, DEFAULT, DESCRIPTION) \ col_name.column->insert(String(#NAME)); \ col_value.column->insert(settings.limits.NAME.toString()); \ col_changed.column->insert(UInt64(settings.limits.NAME.changed)); \ col_description.column->insert(String(DESCRIPTION)); APPLY_FOR_LIMITS(ADD_LIMIT) #undef ADD_LIMIT Block block{ col_name, col_value, col_changed, col_description, }; return BlockInputStreams(1, std::make_shared(block)); } }