Apache Ignite C++ Client
Loading...
Searching...
No Matches
result_set.h
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#pragma once
19
20#include "ignite/client/sql/result_set_metadata.h"
21#include "ignite/client/table/ignite_tuple.h"
22#include "ignite/common/detail/config.h"
23#include "ignite/common/ignite_result.h"
24
25#include <functional>
26#include <memory>
27
28namespace ignite {
29
30namespace detail {
31class result_set_impl;
32}
33
37class result_set {
38public:
39 // Default
40 result_set() = default;
41
47 explicit result_set(std::shared_ptr<detail::result_set_impl> impl)
48 : m_impl(std::move(impl)) {}
49
55 [[nodiscard]] IGNITE_API const result_set_metadata &metadata() const;
56
62 [[nodiscard]] IGNITE_API bool has_rowset() const;
63
70 [[nodiscard]] IGNITE_API std::int64_t affected_rows() const;
71
78 [[nodiscard]] IGNITE_API bool was_applied() const;
79
86 IGNITE_API bool close_async(std::function<void(ignite_result<void>)> callback);
87
93 IGNITE_API bool close();
94
102 [[nodiscard]] IGNITE_API std::vector<ignite_tuple> current_page() &&;
103
109 [[nodiscard]] IGNITE_API const std::vector<ignite_tuple> &current_page() const &;
110
116 [[nodiscard]] IGNITE_API bool has_more_pages();
117
124 IGNITE_API void fetch_next_page_async(std::function<void(ignite_result<void>)> callback);
125
130 IGNITE_API void fetch_next_page() {
131 return sync<void>([this](auto callback) mutable { fetch_next_page_async(std::move(callback)); });
132 }
133
134private:
136 std::shared_ptr<detail::result_set_impl> m_impl;
137};
138
139} // namespace ignite
Definition ignite_result.h:34
Definition result_set_metadata.h:31
IGNITE_API bool has_rowset() const
Definition result_set.cpp:27
IGNITE_API bool close()
Definition result_set.cpp:43
IGNITE_API void fetch_next_page()
Definition result_set.h:130
IGNITE_API std::vector< ignite_tuple > current_page() &&
Definition result_set.cpp:47
result_set(std::shared_ptr< detail::result_set_impl > impl)
Definition result_set.h:47
IGNITE_API void fetch_next_page_async(std::function< void(ignite_result< void >)> callback)
Definition result_set.cpp:59
IGNITE_API const result_set_metadata & metadata() const
Definition result_set.cpp:23
IGNITE_API std::int64_t affected_rows() const
Definition result_set.cpp:31
IGNITE_API bool was_applied() const
Definition result_set.cpp:35
IGNITE_API bool has_more_pages()
Definition result_set.cpp:55
IGNITE_API bool close_async(std::function< void(ignite_result< void >)> callback)
Definition result_set.cpp:39