18 #include "hazelcast/util/export.h"
19 #include "hazelcast/client/sql/sql_result.h"
20 #include "hazelcast/client/sql/sql_statement.h"
21 #include "hazelcast/client/sql/hazelcast_sql_exception.h"
23 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
25 #pragma warning(disable : 4251)
31 class hazelcast_client_instance_impl;
33 class hazelcast_client;
109 template<
typename... Params>
110 boost::future<std::shared_ptr<sql_result>>
execute(
const std::string& query,
111 const Params&... params)
114 int _[] = { 0, (s.add_parameter(params), 0)... };
127 boost::future<std::shared_ptr<sql_result>> execute(
131 friend client::impl::hazelcast_client_instance_impl;
134 client::spi::ClientContext& client_context_;
136 struct sql_execute_response_parameters
138 int64_t update_count;
139 std::shared_ptr<sql_row_metadata> row_metadata;
140 std::shared_ptr<sql_page> first_page;
141 boost::optional<impl::sql_error> error;
142 bool is_infinite_rows =
false;
143 bool is_infinite_rows_exist =
false;
146 struct sql_fetch_response_parameters
148 boost::optional<std::shared_ptr<sql_page>> page;
149 boost::optional<impl::sql_error> error;
152 explicit sql_service(client::spi::ClientContext& context);
154 std::shared_ptr<connection::Connection> query_connection();
156 void rethrow(
const std::exception& exc_ptr);
157 void rethrow(
const std::exception& cause_ptr,
158 const std::shared_ptr<connection::Connection>& connection);
160 boost::uuids::uuid client_id();
162 std::shared_ptr<sql_result> handle_execute_response(
163 protocol::ClientMessage& msg,
164 std::shared_ptr<connection::Connection> connection,
166 int32_t cursor_buffer_size);
168 static sql_execute_response_parameters decode_execute_response(
169 protocol::ClientMessage& msg);
171 impl::query_id create_query_id(
172 const std::shared_ptr<connection::Connection>& query_conn);
174 boost::future<std::shared_ptr<sql_page>> fetch_page(
175 const impl::query_id& q_id,
176 int32_t cursor_buffer_size,
177 const std::shared_ptr<connection::Connection>& connection);
179 static sql_fetch_response_parameters decode_fetch_response(
180 protocol::ClientMessage message);
182 static void handle_fetch_response_error(
183 boost::optional<impl::sql_error> error);
191 boost::future<void> close(
192 const std::shared_ptr<connection::Connection>& connection,
198 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
A service to execute SQL statements.
boost::future< std::shared_ptr< sql_result > > execute(const std::string &query, const Params &... params)
Convenient method to execute a distributed query with the given parameter values.
Definition of an SQL statement.