aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Common/SettingSource.h
blob: 38e1bcae2955698507648a8aaca7e55ddc20c7f8 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#pragma once

#include <string_view>

namespace DB
{
    enum SettingSource
    {
        /// Query or session change:
        /// SET <setting> = <value>
        /// SELECT ... SETTINGS [<setting> = <value]
        QUERY,

        /// Profile creation or altering:
        /// CREATE SETTINGS PROFILE ... SETTINGS [<setting> = <value]
        /// ALTER SETTINGS PROFILE ... SETTINGS [<setting> = <value]
        PROFILE,

        /// Role creation or altering:
        /// CREATE ROLE ... SETTINGS [<setting> = <value>]
        /// ALTER ROLE ... SETTINGS [<setting> = <value]
        ROLE,

        /// User creation or altering:
        /// CREATE USER ... SETTINGS [<setting> = <value>]
        /// ALTER USER ... SETTINGS [<setting> = <value]
        USER,

        COUNT,
    };

    constexpr std::string_view toString(SettingSource source)
    {
        switch (source)
        {
            case SettingSource::QUERY: return "query";
            case SettingSource::PROFILE: return "profile";
            case SettingSource::USER: return "user";
            case SettingSource::ROLE: return "role";
            default: return "unknown";
        }
    }
}