2018-07-20 13:17:16 +00:00
|
|
|
#include <Columns/Collator.h>
|
|
|
|
#include <Storages/System/StorageSystemCollations.h>
|
2019-12-06 22:22:12 +00:00
|
|
|
#include <DataTypes/DataTypeNullable.h>
|
2018-07-20 13:17:16 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
2018-07-24 14:28:56 +00:00
|
|
|
|
|
|
|
NamesAndTypesList StorageSystemCollations::getNamesAndTypes()
|
|
|
|
{
|
|
|
|
return {
|
|
|
|
{"name", std::make_shared<DataTypeString>()},
|
2019-12-06 22:22:12 +00:00
|
|
|
{"language", std::make_shared<DataTypeNullable>(std::make_shared<DataTypeString>())},
|
2018-07-24 14:28:56 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-04-10 23:33:54 +00:00
|
|
|
void StorageSystemCollations::fillData(MutableColumns & res_columns, ContextPtr, const SelectQueryInfo &) const
|
2018-07-20 13:17:16 +00:00
|
|
|
{
|
2019-12-05 15:31:45 +00:00
|
|
|
for (const auto & [locale, lang]: AvailableCollationLocales::instance().getAvailableCollations())
|
|
|
|
{
|
|
|
|
res_columns[0]->insert(locale);
|
2019-12-06 22:22:12 +00:00
|
|
|
res_columns[1]->insert(lang ? *lang : Field());
|
2019-12-05 15:31:45 +00:00
|
|
|
}
|
2018-07-20 13:17:16 +00:00
|
|
|
}
|
2018-07-24 14:28:56 +00:00
|
|
|
|
2018-07-20 13:17:16 +00:00
|
|
|
}
|