31#ifndef MYSQLX_DETAIL_CRUD_H 
   32#define MYSQLX_DETAIL_CRUD_H 
   41#include "../executable.h" 
   50struct PUBLIC_API Bind_detail
 
   54  using Impl = common::Bind_if;
 
   55  using Args_prc = Args_processor<Bind_detail, Impl*>;
 
   57  static void process_one(Impl *impl, 
const Value &val)
 
   59    impl->add_param((
const common::Value&)val);
 
   62  template <
typename... T>
 
   63  static void add_params(Impl *impl, T&&... vals)
 
   65    Args_prc::process_args(impl, std::forward<T>(vals)...);
 
   72struct PUBLIC_API Sort_detail
 
   76  using Impl = common::Sort_if;
 
   77  using Args_prc = Args_processor<Sort_detail, Impl*>;
 
   79  static void process_one(Impl *impl, 
const string &ord_spec)
 
   81    impl->add_sort(ord_spec);
 
   84  template <
typename... T>
 
   85  static void add_sort(Impl *impl, T... args)
 
   87    Args_prc::process_args(impl, args...);
 
   94struct PUBLIC_API Group_by_detail
 
   98  using Impl = common::Group_by_if;
 
   99  using Args_prc = Args_processor<Group_by_detail, Impl*>;
 
  101  static void process_one(Impl *impl, 
const string &spec)
 
  103    impl->add_group_by(spec);
 
  106  template <
typename... T>
 
  107  static void do_group_by(Impl *impl, T... args)
 
  109    Args_prc::process_args(impl, args...);
 
  116struct PUBLIC_API Proj_detail
 
  120  using Impl = common::Proj_if;
 
  121  using Args_prc = Args_processor<Proj_detail, Impl*>;
 
  123  static void process_one(Impl *impl, 
const string &spec)
 
  125    impl->add_proj(spec);
 
  128  template <
typename... T>
 
  129  static void add_proj(Impl *impl, T... proj_spec)
 
  131    Args_prc::process_args(impl, proj_spec...);
 
  138struct PUBLIC_API Collection_add_detail
 
  142  using Impl = common::Collection_add_if;
 
  143  using Args_prc = Args_processor<Collection_add_detail, Impl*>;
 
  145  static void process_one(Impl *impl, 
const string &json)
 
  147    impl->add_json(json);
 
  150  static void process_one(Impl *impl, 
const DbDoc &doc)
 
  155    std::ostringstream buf;
 
  161  template <
typename... T>
 
  162  static void do_add(Impl *impl, T... args)
 
  164    Args_prc::process_args(impl, args...);
 
  171struct PUBLIC_API Collection_find_detail
 
  175  using Impl = common::Proj_if;
 
  176  using Args_prc = Args_processor<Collection_find_detail, Impl*>;
 
  178  static void process_one(Impl *impl, 
const string &proj)
 
  180    impl->add_proj(proj);
 
  184  static void do_fields(Impl *impl, 
const Expression &proj)
 
  186    impl->set_proj(proj.get<
string>());
 
  196    typename T, 
typename... R,
 
  197    typename std::enable_if<!std::is_same<T, Expression>::value>::type* = 
nullptr 
  199    static void do_fields(Impl *impl, T first, R... rest)
 
  201    Args_prc::process_args(impl, first, rest...);
 
  208struct PUBLIC_API Table_insert_detail
 
  212  using Row_impl = internal::Row_detail::Impl;
 
  213  using Impl = common::Table_insert_if<Row_impl>;
 
  222    static void process_one(Impl *impl, 
const string &col)
 
  224      impl->add_column(col);
 
  230    using Impl = std::pair<Row, unsigned>;
 
  232    static void process_one(Impl *impl, 
const mysqlx::Value &val)
 
  234      impl->first.set((impl->second)++, val);
 
  240    static void process_one(Impl *impl, 
const Row &row)
 
  242      impl->add_row(*row.m_impl);
 
  246  template <
typename... T>
 
  247  static void add_columns(Impl *impl, T... args)
 
  249    Args_processor<Add_column, Impl*>::process_args(impl, args...);
 
  252  template <
typename... T>
 
  253  static void add_rows(Impl *impl, T... args)
 
  255    Args_processor<Add_row, Impl*>::process_args(impl, args...);
 
  258  template <
typename... T>
 
  259  static void add_values(Impl *impl, T... args)
 
  261    Add_value::Impl row{ {}, 0 };
 
  262    Args_processor<Add_value>::process_args(&row, args...);
 
  263    Add_row::process_one(impl, row.first);
 
  266  friend Args_processor<Add_column, Impl*>;
 
  267  friend Args_processor<Add_row, Impl*>;
 
  268  friend Args_processor<Add_value, Impl*>;
 
  273using Table_select_detail = Proj_detail;
 
Value object can store value of scalar type, string, array or document.
Definition: document.h:230
A wrapper around std::wstring that can perform conversions from/to different character encodings used...
Definition: common.h:114