| 1 | #pragma once |
| 2 | |
| 3 | #include <ext/shared_ptr_helper.h> |
| 4 | #include <Storages/IStorage.h> |
| 5 | |
| 6 | |
| 7 | namespace DB |
| 8 | { |
| 9 | |
| 10 | class Context; |
| 11 | |
| 12 | |
| 13 | /** Implements storage for the system table One. |
| 14 | * The table contains a single column of dummy UInt8 and a single row with a value of 0. |
| 15 | * Used when the table is not specified in the query. |
| 16 | * Analog of the DUAL table in Oracle and MySQL. |
| 17 | */ |
| 18 | class StorageSystemOne : public ext::shared_ptr_helper<StorageSystemOne>, public IStorage |
| 19 | { |
| 20 | friend struct ext::shared_ptr_helper<StorageSystemOne>; |
| 21 | public: |
| 22 | std::string getName() const override { return "SystemOne" ; } |
| 23 | std::string getTableName() const override { return name; } |
| 24 | std::string getDatabaseName() const override { return "system" ; } |
| 25 | |
| 26 | BlockInputStreams read( |
| 27 | const Names & column_names, |
| 28 | const SelectQueryInfo & query_info, |
| 29 | const Context & context, |
| 30 | QueryProcessingStage::Enum processed_stage, |
| 31 | size_t max_block_size, |
| 32 | unsigned num_streams) override; |
| 33 | |
| 34 | private: |
| 35 | const std::string name; |
| 36 | |
| 37 | protected: |
| 38 | StorageSystemOne(const std::string & name_); |
| 39 | }; |
| 40 | |
| 41 | } |
| 42 | |