ClickHouse/programs/odbc-bridge/ODBCBlockOutputStream.h

43 lines
999 B
C++
Raw Normal View History

2020-04-28 00:56:44 +00:00
#pragma once
#include <Core/Block.h>
#include <DataStreams/IBlockOutputStream.h>
#include <Core/ExternalResultDescription.h>
2020-05-14 21:51:07 +00:00
#include <Parsers/IdentifierQuotingStyle.h>
#include <Interpreters/Context_fwd.h>
2021-05-07 10:37:11 +00:00
#include "ODBCConnectionFactory.h"
2021-03-22 11:40:29 +00:00
2020-04-28 00:56:44 +00:00
2020-05-05 23:42:44 +00:00
namespace DB
{
2021-03-22 11:40:29 +00:00
2020-05-05 23:42:44 +00:00
class ODBCBlockOutputStream : public IBlockOutputStream
{
2021-03-22 11:40:29 +00:00
2020-04-28 00:56:44 +00:00
public:
2021-03-22 11:40:29 +00:00
ODBCBlockOutputStream(
2021-05-07 11:18:49 +00:00
nanodbc::ConnectionHolderPtr connection_,
2021-03-22 11:40:29 +00:00
const std::string & remote_database_name_,
const std::string & remote_table_name_,
const Block & sample_block_,
ContextPtr local_context_,
2021-03-22 11:40:29 +00:00
IdentifierQuotingStyle quoting);
2020-04-28 00:56:44 +00:00
Block getHeader() const override;
void write(const Block & block) override;
private:
2021-03-22 11:40:29 +00:00
Poco::Logger * log;
2021-05-07 11:18:49 +00:00
nanodbc::ConnectionHolderPtr connection;
2020-04-28 00:56:44 +00:00
std::string db_name;
std::string table_name;
Block sample_block;
ContextPtr local_context;
2020-05-14 21:51:07 +00:00
IdentifierQuotingStyle quoting;
2020-04-28 00:56:44 +00:00
ExternalResultDescription description;
};
}