This commit is contained in:
kssenii 2021-08-11 12:05:38 +00:00
parent 2d4030f98b
commit eaea0a3e40
2 changed files with 1 additions and 14 deletions

View File

@ -73,7 +73,7 @@ void PostgreSQLSource<T>::init(const Block & sample_block)
template<typename T>
void PostgreSQLSource<T>::onStart()
{
if (connection_holder)
if (!tx)
tx = std::make_shared<T>(connection_holder->get());
stream = std::make_unique<pqxx::stream_from>(*tx, pqxx::from_query, std::string_view(query_str));

View File

@ -76,19 +76,6 @@ public:
const Block & sample_block_,
const UInt64 max_block_size_)
: PostgreSQLSource<T>(tx_, query_str_, sample_block_, max_block_size_, false) {}
Chunk generate() override
{
if (!is_initialized)
{
Base::stream = std::make_unique<pqxx::stream_from>(*Base::tx, pqxx::from_query, std::string_view(Base::query_str));
is_initialized = true;
}
return Base::generate();
}
bool is_initialized = false;
};
}