ClickHouse/dbms/Databases/DatabaseDictionary.h

61 lines
1.3 KiB
C++
Raw Normal View History

2017-06-22 15:44:19 +00:00
#pragma once
#include <mutex>
#include <unordered_set>
#include <Databases/DatabasesCommon.h>
2017-06-22 15:44:19 +00:00
#include <Databases/IDatabase.h>
#include <Storages/IStorage_fwd.h>
2017-06-22 15:44:19 +00:00
namespace Poco
{
2017-06-22 18:00:29 +00:00
class Logger;
2017-06-22 15:44:19 +00:00
}
namespace DB
{
/* Database to store StorageDictionary tables
* automatically creates tables for all dictionaries
*/
class DatabaseDictionary final : public IDatabase
2017-06-22 15:44:19 +00:00
{
public:
2020-04-01 22:41:29 +00:00
DatabaseDictionary(const String & name_, const Context & global_context);
2017-06-22 18:00:29 +00:00
String getEngineName() const override
{
2017-06-22 15:44:19 +00:00
return "Dictionary";
}
bool isTableExist(
const Context & context,
const String & table_name) const override;
2017-06-22 15:44:19 +00:00
StoragePtr tryGetTable(
const Context & context,
const String & table_name) const override;
2017-06-22 15:44:19 +00:00
2020-04-01 22:41:29 +00:00
DatabaseTablesIteratorPtr getTablesIterator(const FilterByNameFunction & filter_by_table_name) override;
2019-10-10 17:33:01 +00:00
bool empty(const Context & context) const override;
2017-06-22 15:44:19 +00:00
ASTPtr getCreateDatabaseQuery(const Context & context) const override;
2017-06-22 15:44:19 +00:00
void shutdown() override;
2018-03-23 19:56:24 +00:00
2019-11-01 12:47:55 +00:00
protected:
ASTPtr getCreateTableQueryImpl(const Context & context, const String & table_name, bool throw_on_error) const override;
2018-03-23 19:56:24 +00:00
private:
mutable std::mutex mutex;
Poco::Logger * log;
2020-04-01 22:41:29 +00:00
const Context & global_context;
2018-03-23 19:56:24 +00:00
2020-04-01 22:41:29 +00:00
Tables listTables(const FilterByNameFunction & filter_by_name);
2017-06-22 15:44:19 +00:00
};
2017-06-22 15:44:19 +00:00
}