mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-16 19:32:07 +00:00
74 lines
1.9 KiB
C++
74 lines
1.9 KiB
C++
#pragma once
|
|
|
|
#include <Databases/DatabaseMemory.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
/** Default engine of databases.
|
|
* It stores tables list in filesystem using list of .sql files,
|
|
* that contain declaration of table represented by SQL ATTACH TABLE query.
|
|
*/
|
|
class DatabaseOrdinary : public DatabaseMemory
|
|
{
|
|
protected:
|
|
const String metadata_path;
|
|
const String data_path;
|
|
|
|
public:
|
|
DatabaseOrdinary(const String & name_, const String & metadata_path_, const Context & context);
|
|
|
|
String getEngineName() const override { return "Ordinary"; }
|
|
|
|
void loadTables(
|
|
Context & context,
|
|
ThreadPool * thread_pool,
|
|
bool has_force_restore_data_flag) override;
|
|
|
|
void createTable(
|
|
const Context & context,
|
|
const String & table_name,
|
|
const StoragePtr & table,
|
|
const ASTPtr & query) override;
|
|
|
|
void removeTable(
|
|
const Context & context,
|
|
const String & table_name) override;
|
|
|
|
void renameTable(
|
|
const Context & context,
|
|
const String & table_name,
|
|
IDatabase & to_database,
|
|
const String & to_table_name) override;
|
|
|
|
void alterTable(
|
|
const Context & context,
|
|
const String & name,
|
|
const NamesAndTypesList & columns,
|
|
const NamesAndTypesList & materialized_columns,
|
|
const NamesAndTypesList & alias_columns,
|
|
const ColumnDefaults & column_defaults,
|
|
const ASTModifier & engine_modifier) override;
|
|
|
|
time_t getTableMetadataModificationTime(
|
|
const Context & context,
|
|
const String & table_name) override;
|
|
|
|
ASTPtr getCreateQuery(
|
|
const Context & context,
|
|
const String & table_name) const override;
|
|
|
|
String getDataPath() const override;
|
|
String getMetadataPath() const override;
|
|
String getTableMetadataPath(const String & table_name) const override;
|
|
|
|
void shutdown() override;
|
|
void drop() override;
|
|
|
|
private:
|
|
void startupTables(ThreadPool * thread_pool);
|
|
};
|
|
|
|
}
|