2017-06-22 15:44:19 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <mutex>
|
2017-06-23 15:55:45 +00:00
|
|
|
#include <unordered_set>
|
|
|
|
#include <Databases/DatabasesCommon.h>
|
2017-06-22 15:44:19 +00:00
|
|
|
#include <Databases/IDatabase.h>
|
2019-05-17 14:34:25 +00:00
|
|
|
#include <Storages/IStorage_fwd.h>
|
2017-06-22 15:44:19 +00:00
|
|
|
|
|
|
|
|
2017-06-23 15:55:45 +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
|
|
|
|
*/
|
2020-03-19 23:48:53 +00:00
|
|
|
class DatabaseDictionary final : public IDatabase
|
2017-06-22 15:44:19 +00:00
|
|
|
{
|
2017-06-23 15:55:45 +00:00
|
|
|
public:
|
2019-11-06 16:05:04 +00:00
|
|
|
DatabaseDictionary(const String & name_);
|
2018-05-10 15:56:38 +00:00
|
|
|
|
2017-06-22 18:00:29 +00:00
|
|
|
String getEngineName() const override
|
|
|
|
{
|
2017-06-22 15:44:19 +00:00
|
|
|
return "Dictionary";
|
|
|
|
}
|
|
|
|
|
2017-09-11 12:39:01 +00:00
|
|
|
bool isTableExist(
|
|
|
|
const Context & context,
|
|
|
|
const String & table_name) const override;
|
2017-06-22 15:44:19 +00:00
|
|
|
|
2017-09-11 12:39:01 +00:00
|
|
|
StoragePtr tryGetTable(
|
|
|
|
const Context & context,
|
2018-01-30 17:47:04 +00:00
|
|
|
const String & table_name) const override;
|
2017-06-22 15:44:19 +00:00
|
|
|
|
2020-03-18 03:27:32 +00:00
|
|
|
DatabaseTablesIteratorPtr getTablesIterator(const Context & context, const FilterByNameFunction & filter_by_table_name) override;
|
2019-10-10 17:33:01 +00:00
|
|
|
|
2017-09-11 12:39:01 +00:00
|
|
|
bool empty(const Context & context) const override;
|
2017-06-22 15:44:19 +00:00
|
|
|
|
2020-01-14 11:11:01 +00:00
|
|
|
ASTPtr getCreateDatabaseQuery(const Context & context) const override;
|
2018-03-13 13:28:32 +00:00
|
|
|
|
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;
|
|
|
|
|
2019-06-02 12:11:01 +00:00
|
|
|
Tables listTables(const Context & context, const FilterByNameFunction & filter_by_name);
|
2017-06-22 15:44:19 +00:00
|
|
|
};
|
2017-09-11 12:39:01 +00:00
|
|
|
|
2017-06-22 15:44:19 +00:00
|
|
|
}
|