2011-08-28 02:22:23 +00:00
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <DB/Storages/IStorage.h>
|
2011-09-04 21:23:19 +00:00
|
|
|
|
#include <DB/DataStreams/IProfilingBlockInputStream.h>
|
2011-08-28 02:22:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
2011-09-04 21:23:19 +00:00
|
|
|
|
class OneValueBlockInputStream : public IProfilingBlockInputStream
|
2011-08-28 02:22:23 +00:00
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
OneValueBlockInputStream();
|
2011-09-04 21:23:19 +00:00
|
|
|
|
Block readImpl();
|
|
|
|
|
String getName() const { return "OneValueBlockInputStream"; }
|
2011-10-24 12:10:59 +00:00
|
|
|
|
BlockInputStreamPtr clone() { return new OneValueBlockInputStream(); }
|
2011-08-28 02:22:23 +00:00
|
|
|
|
private:
|
|
|
|
|
bool has_been_read;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Реализует хранилище для системной таблицы One.
|
|
|
|
|
* Таблица содержит единственный столбец dummy UInt8 и единственную строку со значением 0.
|
|
|
|
|
* Используется, если в запросе не указана таблица.
|
|
|
|
|
* Аналог таблицы DUAL в Oracle и MySQL.
|
|
|
|
|
*/
|
|
|
|
|
class StorageSystemOne : public IStorage
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
StorageSystemOne(const std::string & name_);
|
|
|
|
|
|
|
|
|
|
std::string getName() const { return "SystemOne"; }
|
|
|
|
|
std::string getTableName() const { return "One"; }
|
|
|
|
|
|
2011-11-01 17:12:11 +00:00
|
|
|
|
const NamesAndTypesList & getColumnsList() const { return columns; }
|
2011-08-28 02:22:23 +00:00
|
|
|
|
|
|
|
|
|
BlockInputStreamPtr read(
|
|
|
|
|
const Names & column_names,
|
|
|
|
|
ASTPtr query,
|
|
|
|
|
size_t max_block_size = DEFAULT_BLOCK_SIZE);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
const std::string name;
|
2011-11-01 17:12:11 +00:00
|
|
|
|
NamesAndTypesList columns;
|
2011-08-28 02:22:23 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|