mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-13 01:41:59 +00:00
4e76629aaf
- lots of static_cast - add safe_cast - types adjustments - config - IStorage::read/watch - ... - some TODO's (to convert types in future) P.S. That was quite a journey... v2: fixes after rebase v3: fix conflicts after #42308 merged Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
75 lines
2.1 KiB
C++
75 lines
2.1 KiB
C++
#pragma once
|
|
|
|
#include <Storages/StorageURL.h>
|
|
#include <BridgeHelper/XDBCBridgeHelper.h>
|
|
|
|
namespace Poco
|
|
{
|
|
class Logger;
|
|
}
|
|
|
|
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:
|
|
Pipe read(
|
|
const Names & column_names,
|
|
const StorageSnapshotPtr & storage_snapshot,
|
|
SelectQueryInfo & query_info,
|
|
ContextPtr context,
|
|
QueryProcessingStage::Enum processed_stage,
|
|
size_t max_block_size,
|
|
size_t num_streams) override;
|
|
|
|
StorageXDBC(
|
|
const StorageID & table_id_,
|
|
const std::string & remote_database_name,
|
|
const std::string & remote_table_name,
|
|
ColumnsDescription columns_,
|
|
ConstraintsDescription constraints_,
|
|
const String & comment,
|
|
ContextPtr context_,
|
|
BridgeHelperPtr bridge_helper_);
|
|
|
|
SinkToStoragePtr write(const ASTPtr & query, const StorageMetadataPtr & /*metadata_snapshot*/, ContextPtr context) override;
|
|
|
|
std::string getName() const override;
|
|
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 StorageSnapshotPtr & storage_snapshot,
|
|
const SelectQueryInfo & query_info,
|
|
ContextPtr context,
|
|
QueryProcessingStage::Enum & processed_stage,
|
|
size_t max_block_size) const override;
|
|
|
|
std::function<void(std::ostream &)> getReadPOSTDataCallback(
|
|
const Names & column_names,
|
|
const ColumnsDescription & columns_description,
|
|
const SelectQueryInfo & query_info,
|
|
ContextPtr context,
|
|
QueryProcessingStage::Enum & processed_stage,
|
|
size_t max_block_size) const override;
|
|
|
|
Block getHeaderBlock(const Names & column_names, const StorageSnapshotPtr & storage_snapshot) const override;
|
|
|
|
bool supportsSubsetOfColumns() const override;
|
|
};
|
|
|
|
}
|