ClickHouse/src/Storages/StorageXDBC.h

68 lines
2.0 KiB
C++
Raw Normal View History

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-08-03 13:54:14 +00:00
Pipe read(
const Names & column_names,
const StorageMetadataPtr & /*metadata_snapshot*/,
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
StorageXDBC(
const StorageID & table_id_,
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
BlockOutputStreamPtr write(const ASTPtr & query, const StorageMetadataPtr & /*metadata_snapshot*/, const Context & context) override;
2020-04-28 00:56:44 +00:00
std::string getName() const override;
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
std::vector<std::pair<std::string, std::string>> getReadURIParams(
const Names & column_names,
const StorageMetadataPtr & metadata_snapshot,
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
std::function<void(std::ostream &)> getReadPOSTDataCallback(
const Names & column_names,
const StorageMetadataPtr & metadata_snapshot,
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
Block getHeaderBlock(const Names & column_names, const StorageMetadataPtr & metadata_snapshot) const override;
2019-08-24 21:20:20 +00:00
};
2018-09-25 14:29:44 +00:00
}