aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Common/NamedCollections/NamedCollectionUtils.h
blob: 6cbe91015508496102402db9d9db129838a89348 (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
#pragma once
#include <Interpreters/Context_fwd.h>

namespace Poco { namespace Util { class AbstractConfiguration; } }

namespace DB
{

class ASTCreateNamedCollectionQuery;
class ASTAlterNamedCollectionQuery;
class ASTDropNamedCollectionQuery;

namespace NamedCollectionUtils
{

enum class SourceId
{
    NONE = 0,
    CONFIG = 1,
    SQL = 2,
};

void loadFromConfig(const Poco::Util::AbstractConfiguration & config);
void reloadFromConfig(const Poco::Util::AbstractConfiguration & config);

/// Load named collections from `context->getPath() / named_collections /`.
void loadFromSQL(ContextPtr context);

/// Remove collection as well as its metadata from `context->getPath() / named_collections /`.
void removeFromSQL(const ASTDropNamedCollectionQuery & query, ContextPtr context);

/// Create a new collection from AST and put it to `context->getPath() / named_collections /`.
void createFromSQL(const ASTCreateNamedCollectionQuery & query, ContextPtr context);

/// Update definition of already existing collection from AST and update result in `context->getPath() / named_collections /`.
void updateFromSQL(const ASTAlterNamedCollectionQuery & query, ContextPtr context);

void loadIfNot();

}

}