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