31#ifndef MYSQLX_DETAIL_RESULT_H
32#define MYSQLX_DETAIL_RESULT_H
42#include "../document.h"
44#include "../collations.h"
72class PUBLIC_API Result_detail
76 Result_detail(
const Result_detail&) =
delete;
77 Result_detail& operator=(
const Result_detail&) =
delete;
81 using Impl = common::Result_impl;
85 Result_detail(common::Result_init&);
89 Result_detail(Result_detail &&other)
91 operator=(std::move(other));
94 Result_detail& operator=(Result_detail&&);
96 Result_detail() =
default;
97 virtual ~Result_detail();
101 const Impl& get_impl()
const
103 return const_cast<Result_detail*
>(
this)->get_impl();
106 void check_result()
const;
108 uint64_t get_affected_rows()
const;
109 uint64_t get_auto_increment()
const;
111 using DocIdList = internal::List_initializer<const std::vector<std::string>&>;
113 DocIdList get_generated_ids()
const;
117 bool has_data()
const;
124 Impl *m_impl =
nullptr;
125 bool m_owns_impl =
false;
133 using Value = Warning;
135 Result_detail &m_res;
137 Warning_src(Result_detail &res)
143 return m_res.get_warning_count();
146 Warning operator[](
size_t pos)
148 return m_res.get_warning(pos);
154 using WarningList = internal::List_initializer<Array_source<Warning_src>>;
158 unsigned get_warning_count()
const;
159 Warning get_warning(
size_t pos);
161 WarningList get_warnings()
169 friend Session_detail;
170 friend List_initializer<Result_detail>;
187class PUBLIC_API Column_detail
188 :
virtual common::Printable
192 using Impl = common::Column_info;
194 const Impl *m_impl =
nullptr;
196 Column_detail(
const Impl *impl)
200 const Impl& get_impl()
const
206 string get_name()
const;
207 string get_label()
const;
208 string get_schema_name()
const;
209 string get_table_name()
const;
210 string get_table_label()
const;
214 unsigned get_type()
const;
216 CharacterSet get_charset()
const;
217 const CollationInfo& get_collation()
const;
219 unsigned long get_length()
const;
220 unsigned short get_decimals()
const;
222 bool is_signed()
const;
223 bool is_padded()
const;
225 void print(std::ostream&)
const override;
229 Column_detail() =
default;
230 Column_detail(
const Column_detail&) =
default;
231 Column_detail(Column_detail&&) =
default;
233 Column_detail& operator=(
const Column_detail&) =
default;
238 friend Result_detail;
241 struct INTERNAL Access;
256 Column_storage(
const typename COL::Impl *impl)
262 Column_storage() =
default;
263 Column_storage(
const Column_storage&) =
default;
264 Column_storage& operator=(
const Column_storage&) =
default;
268template <
class COLS>
class Row_result_detail;
285 :
public std::deque<Column_storage<COL>>
287 Columns_detail(
const Columns_detail&) =
delete;
291 Columns_detail() =
default;
292 Columns_detail(Columns_detail&&) =
default;
293 Columns_detail& operator=(Columns_detail&&) =
default;
295 void init(
const internal::Result_detail::Impl&);
298 friend internal::Row_result_detail<Columns>;
314class Row_result_detail
315 :
public Result_detail
319 using iterator = Iterator<Row_result_detail, Row>;
320 using RowList = List_initializer<Row_result_detail&>;
321 using Columns = COLS;
325 return iterator(*
this);
341 void iterator_start() {}
343 bool iterator_next();
353 Row_result_detail() =
default;
354 Row_result_detail(common::Result_init&);
356 Row_result_detail(Row_result_detail&&) =
default;
357 Row_result_detail& operator=(Row_result_detail&&) =
default;
368 row_count_t row_count();
372 if (!iterator_next())
374 return iterator_get();
385 col_count_t col_count()
const;
386 const Column& get_column(col_count_t)
const;
387 const Columns& get_columns()
const;
391 bool rc = Result_detail::next_result();
393 m_cols.init(get_impl());
406class PUBLIC_API Doc_result_detail
407 :
public Result_detail
411 using iterator = Iterator<Doc_result_detail, DbDoc>;
412 using DocList = List_initializer<Doc_result_detail&>;
416 return iterator(*
this);
430 void iterator_start() {}
432 bool iterator_next();
441 Doc_result_detail() =
default;
443 Doc_result_detail(common::Result_init &init)
444 : Result_detail(init)
449 if (!iterator_next())
451 return iterator_get();