aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Storages/System/StorageSystemCollations.cpp
blob: c9343ccd1466bad51eed3e8f04cae69b8c6d2fdb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <Columns/Collator.h>
#include <Storages/System/StorageSystemCollations.h>
#include <DataTypes/DataTypeNullable.h>

namespace DB
{

NamesAndTypesList StorageSystemCollations::getNamesAndTypes()
{
    return {
        {"name", std::make_shared<DataTypeString>()},
        {"language", std::make_shared<DataTypeNullable>(std::make_shared<DataTypeString>())},
    };
}

void StorageSystemCollations::fillData(MutableColumns & res_columns, ContextPtr, const SelectQueryInfo &) const
{
    for (const auto & [locale, lang]: AvailableCollationLocales::instance().getAvailableCollations())
    {
        res_columns[0]->insert(locale);
        res_columns[1]->insert(lang ? *lang : Field());
    }
}

}