ClickHouse/dbms/src/Storages/StorageODBC.h

54 lines
1.2 KiB
C++
Raw Normal View History

#pragma once
2017-12-27 21:45:05 +00:00
#include <ext/shared_ptr_helper.h>
#include <Storages/IStorage.h>
2017-12-26 21:34:06 +00:00
namespace Poco
{
2017-12-26 21:34:06 +00:00
namespace Data
{
2017-12-26 21:34:06 +00:00
class SessionPool;
}
2017-12-26 21:34:06 +00:00
}
2017-12-26 21:34:06 +00:00
namespace DB
{
2017-12-26 21:34:06 +00:00
/** Implements storage in the ODBC database.
* Use ENGINE = odbc(connection_string, table_name)
* Example ENGINE = odbc('dsn=test', table)
* Read only.
*/
2017-12-27 21:45:05 +00:00
class StorageODBC : public ext::shared_ptr_helper<StorageODBC>, public IStorage
2017-12-26 21:34:06 +00:00
{
public:
StorageODBC(
const std::string & name,
const std::string & connection_string,
const std::string & remote_database_name,
const std::string & remote_table_name,
const NamesAndTypesList & columns_);
2017-12-26 21:34:06 +00:00
std::string getName() const override { return "ODBC"; }
std::string getTableName() const override { return name; }
BlockInputStreams read(
const Names & column_names,
const SelectQueryInfo & query_info,
const Context & context,
QueryProcessingStage::Enum & processed_stage,
size_t max_block_size,
unsigned num_streams) override;
private:
2017-12-26 21:34:06 +00:00
std::string name;
std::string remote_database_name;
std::string remote_table_name;
std::shared_ptr<Poco::Data::SessionPool> pool;
};
}