2016-04-10 04:00:00 +00:00
|
|
|
#pragma once
|
|
|
|
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Core/Block.h>
|
|
|
|
#include <DataStreams/IProfilingBlockInputStream.h>
|
|
|
|
#include <Dictionaries/ExternalResultDescription.h>
|
2016-04-10 04:00:00 +00:00
|
|
|
|
2017-12-01 20:21:35 +00:00
|
|
|
#pragma GCC diagnostic push
|
|
|
|
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
|
|
|
#include <Poco/Data/Session.h>
|
|
|
|
#include <Poco/Data/Statement.h>
|
|
|
|
#include <Poco/Data/RecordSet.h>
|
|
|
|
#pragma GCC diagnostic pop
|
2016-04-10 04:00:00 +00:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
/// Allows processing results of a query to ODBC source as a sequence of Blocks, simplifies chaining
|
|
|
|
class ODBCBlockInputStream final : public IProfilingBlockInputStream
|
|
|
|
{
|
|
|
|
public:
|
2017-04-01 07:20:54 +00:00
|
|
|
ODBCBlockInputStream(
|
|
|
|
Poco::Data::Session && session, const std::string & query_str, const Block & sample_block,
|
2017-07-21 06:35:58 +00:00
|
|
|
const size_t max_block_size);
|
2016-04-10 04:00:00 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
String getName() const override { return "ODBC"; }
|
2016-04-10 04:00:00 +00:00
|
|
|
|
2018-02-18 03:23:48 +00:00
|
|
|
Block getHeader() const override { return description.sample_block; };
|
2018-01-06 18:10:44 +00:00
|
|
|
|
2016-04-10 04:00:00 +00:00
|
|
|
private:
|
2017-04-01 07:20:54 +00:00
|
|
|
Block readImpl() override;
|
2016-04-10 04:00:00 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
Poco::Data::Session session;
|
|
|
|
Poco::Data::Statement statement;
|
|
|
|
Poco::Data::RecordSet result;
|
|
|
|
Poco::Data::RecordSet::Iterator iterator;
|
2016-04-10 04:00:00 +00:00
|
|
|
|
2017-07-21 06:35:58 +00:00
|
|
|
const size_t max_block_size;
|
2017-04-01 07:20:54 +00:00
|
|
|
ExternalResultDescription description;
|
2017-05-15 14:16:10 +00:00
|
|
|
|
|
|
|
Poco::Logger * log;
|
2016-04-10 04:00:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|