2018-09-25 14:29:44 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Storages/StorageURL.h>
|
|
|
|
#include <ext/shared_ptr_helper.h>
|
|
|
|
#include <Common/XDBCBridgeHelper.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
/** Implements storage in the XDBC database.
|
|
|
|
* Use ENGINE = xdbc(connection_string, table_name)
|
|
|
|
* Example ENGINE = odbc('dsn=test', table)
|
|
|
|
* Read only.
|
|
|
|
*/
|
|
|
|
class StorageXDBC : public IStorageURLBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
BlockInputStreams read(const Names & column_names,
|
|
|
|
const SelectQueryInfo & query_info,
|
|
|
|
const Context & context,
|
|
|
|
QueryProcessingStage::Enum processed_stage,
|
2019-02-18 23:38:44 +00:00
|
|
|
size_t max_block_size,
|
2018-09-25 14:29:44 +00:00
|
|
|
unsigned num_streams) override;
|
|
|
|
|
|
|
|
|
2019-07-09 15:40:21 +00:00
|
|
|
StorageXDBC(const std::string & database_name_,
|
|
|
|
const std::string & table_name_,
|
2018-09-25 14:29:44 +00:00
|
|
|
const std::string & remote_database_name,
|
|
|
|
const std::string & remote_table_name,
|
|
|
|
const ColumnsDescription & columns_,
|
|
|
|
const Context & context_, BridgeHelperPtr bridge_helper_);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
BridgeHelperPtr bridge_helper;
|
|
|
|
std::string remote_database_name;
|
|
|
|
std::string remote_table_name;
|
|
|
|
|
|
|
|
Poco::Logger * log;
|
|
|
|
|
|
|
|
std::string getReadMethod() const override;
|
|
|
|
|
|
|
|
std::vector<std::pair<std::string, std::string>> getReadURIParams(const Names & column_names,
|
|
|
|
const SelectQueryInfo & query_info,
|
|
|
|
const Context & context,
|
|
|
|
QueryProcessingStage::Enum & processed_stage,
|
2019-02-19 00:48:52 +00:00
|
|
|
size_t max_block_size) const override;
|
2018-09-25 14:29:44 +00:00
|
|
|
|
|
|
|
std::function<void(std::ostream &)> getReadPOSTDataCallback(const Names & column_names,
|
|
|
|
const SelectQueryInfo & query_info,
|
|
|
|
const Context & context,
|
|
|
|
QueryProcessingStage::Enum & processed_stage,
|
2019-02-19 00:48:52 +00:00
|
|
|
size_t max_block_size) const override;
|
2018-09-25 14:29:44 +00:00
|
|
|
|
|
|
|
Block getHeaderBlock(const Names & column_names) const override;
|
|
|
|
|
2018-09-28 02:46:33 +00:00
|
|
|
std::string getName() const override;
|
2018-09-25 14:29:44 +00:00
|
|
|
};
|
|
|
|
}
|