ClickHouse/programs/odbc-bridge/ODBCBlockOutputStream.h

43 lines
979 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-03-22 11:40:29 +00:00
#include <nanodbc/nanodbc.h>
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(
nanodbc::connection & connection_,
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;
nanodbc::connection & 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;
};
}