2013-10-30 13:52:02 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <DB/Parsers/ASTSelectQuery.h>
|
2013-11-15 09:43:50 +00:00
|
|
|
#include <DB/Storages/IStorage.h>
|
2013-10-30 13:52:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class StorageView : public IStorage {
|
|
|
|
|
|
|
|
public:
|
2013-11-08 17:43:03 +00:00
|
|
|
static StoragePtr create(const String & table_name_, const String & database_name_,
|
|
|
|
Context & context_, ASTPtr & query_, NamesAndTypesListPtr columns_);
|
|
|
|
|
|
|
|
virtual std::string getName() const { return "View"; }
|
|
|
|
virtual std::string getTableName() const { return table_name; }
|
2013-11-13 14:39:48 +00:00
|
|
|
const NamesAndTypesList & getColumnsList() const { return *columns; }
|
|
|
|
DB::ASTPtr getInnerQuery() const { return inner_query.clone(); };
|
2013-11-08 17:43:03 +00:00
|
|
|
|
|
|
|
virtual BlockInputStreams read(
|
|
|
|
const Names & column_names,
|
|
|
|
ASTPtr query,
|
|
|
|
const Settings & settings,
|
|
|
|
QueryProcessingStage::Enum & processed_stage,
|
|
|
|
size_t max_block_size = DEFAULT_BLOCK_SIZE,
|
|
|
|
unsigned threads = 1);
|
|
|
|
|
|
|
|
virtual void dropImpl();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
String select_database_name;
|
|
|
|
String select_table_name;
|
|
|
|
String table_name;
|
|
|
|
String database_name;
|
2013-10-30 13:52:02 +00:00
|
|
|
ASTSelectQuery inner_query;
|
2013-11-08 17:43:03 +00:00
|
|
|
Context & context;
|
2013-10-30 13:52:02 +00:00
|
|
|
NamesAndTypesListPtr columns;
|
|
|
|
|
2013-11-08 17:43:03 +00:00
|
|
|
StorageView(const String & table_name_, const String & database_name_,
|
|
|
|
Context & context_, ASTPtr & query_, NamesAndTypesListPtr columns_);
|
2013-10-30 13:52:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|