ClickHouse/src/Databases/DatabaseDictionary.h

57 lines
1.3 KiB
C++
Raw Normal View History

2017-06-22 15:44:19 +00:00
#pragma once
#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
#include <mutex>
#include <unordered_set>
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, WithContext
2017-06-22 15:44:19 +00:00
{
public:
DatabaseDictionary(const String & name_, ContextPtr 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 String & table_name, ContextPtr context) const override;
2017-06-22 15:44:19 +00:00
StoragePtr tryGetTable(const String & table_name, ContextPtr context) const override;
2017-06-22 15:44:19 +00:00
DatabaseTablesIteratorPtr getTablesIterator(ContextPtr context, const FilterByNameFunction & filter_by_table_name) override;
2019-10-10 17:33:01 +00:00
bool empty() const override;
2017-06-22 15:44:19 +00:00
ASTPtr getCreateDatabaseQuery() const override;
bool shouldBeEmptyOnDetach() const override { return false; }
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 String & table_name, ContextPtr context, bool throw_on_error) const override;
2019-11-01 12:47:55 +00:00
2018-03-23 19:56:24 +00:00
private:
Poco::Logger * log;
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
}