diff --git a/service/pager/query_pager.hh b/service/pager/query_pager.hh index ad7ae455c6..b0de89c2ca 100644 --- a/service/pager/query_pager.hh +++ b/service/pager/query_pager.hh @@ -136,8 +136,9 @@ public: * beginning. If the pager is exhausted, the result is undefined. */ ::shared_ptr state() const; - + private: + template class query_result_visitor; void handle_result(cql3::selection::result_set_builder& builder, diff --git a/service/pager/query_pagers.cc b/service/pager/query_pagers.cc index ef8eb86619..e2529cef45 100644 --- a/service/pager/query_pagers.cc +++ b/service/pager/query_pagers.cc @@ -241,17 +241,15 @@ static bool has_clustering_keys(const schema& s, const query::read_command& cmd) }); } -class query_pager::query_result_visitor : public cql3::selection::result_set_builder::visitor { +template +class query_pager::query_result_visitor : public Base { + using visitor = Base; public: uint32_t total_rows = 0; std::experimental::optional last_pkey; std::experimental::optional last_ckey; - query_result_visitor(cql3::selection::result_set_builder& builder, - const schema& s, - const cql3::selection::selection& selection) - : visitor(builder, s, selection) - { } + using Base::Base; void accept_new_partition(uint32_t) { throw std::logic_error("Should not reach!"); @@ -283,7 +281,7 @@ public: foreign_ptr> results, uint32_t page_size, gc_clock::time_point now) { - query_result_visitor v(builder, *_schema, *_selection); + query_result_visitor v(builder, *_schema, *_selection); query::result_view::consume(*results, _cmd->slice, v); if (_last_pkey) {