fork(44) download
  1. // This file was generated by ODB, object-relational mapping (ORM)
  2. // compiler for C++.
  3. //
  4.  
  5. #ifndef USER_ODB_HXX
  6. #define USER_ODB_HXX
  7.  
  8. #include <odb/version.hxx>
  9.  
  10. #if (ODB_VERSION != 20200UL)
  11. #error ODB runtime version mismatch
  12. #endif
  13.  
  14. #include <odb/pre.hxx>
  15.  
  16. #include "user.hxx"
  17.  
  18. #include <memory>
  19. #include <cstddef>
  20.  
  21. #include <odb/core.hxx>
  22. #include <odb/traits.hxx>
  23. #include <odb/callback.hxx>
  24. #include <odb/wrapper-traits.hxx>
  25. #include <odb/pointer-traits.hxx>
  26. #include <odb/container-traits.hxx>
  27. #include <odb/no-op-cache-traits.hxx>
  28. #include <odb/result.hxx>
  29. #include <odb/simple-object-result.hxx>
  30.  
  31. #include <odb/details/unused.hxx>
  32. #include <odb/details/shared-ptr.hxx>
  33.  
  34. namespace odb
  35. {
  36. // user
  37. //
  38. template <>
  39. struct class_traits< ::user >
  40. {
  41. static const class_kind kind = class_object;
  42. };
  43.  
  44. template <>
  45. class access::object_traits< ::user >
  46. {
  47. public:
  48. typedef ::user object_type;
  49. typedef ::user* pointer_type;
  50. typedef odb::pointer_traits<pointer_type> pointer_traits;
  51.  
  52. static const bool polymorphic = false;
  53.  
  54. typedef long unsigned int id_type;
  55.  
  56. static const bool auto_id = true;
  57.  
  58. static const bool abstract = false;
  59.  
  60. static id_type
  61. id (const object_type&);
  62.  
  63. typedef
  64. no_op_pointer_cache_traits<pointer_type>
  65. pointer_cache_traits;
  66.  
  67. typedef
  68. no_op_reference_cache_traits<object_type>
  69. reference_cache_traits;
  70.  
  71. static void
  72. callback (database&, object_type&, callback_event);
  73.  
  74. static void
  75. callback (database&, const object_type&, callback_event);
  76. };
  77. }
  78.  
  79. #include <odb/details/buffer.hxx>
  80.  
  81. #include <odb/mysql/version.hxx>
  82. #include <odb/mysql/forward.hxx>
  83. #include <odb/mysql/binding.hxx>
  84. #include <odb/mysql/mysql-types.hxx>
  85. #include <odb/mysql/query.hxx>
  86.  
  87. namespace odb
  88. {
  89. // user
  90. //
  91. template <typename A>
  92. struct query_columns< ::user, id_mysql, A >
  93. {
  94. // id
  95. //
  96. typedef
  97. mysql::query_column<
  98. mysql::value_traits<
  99. long unsigned int,
  100. mysql::id_ulonglong >::query_type,
  101. mysql::id_ulonglong >
  102. id_type_;
  103.  
  104. static const id_type_ id;
  105.  
  106. // nickname
  107. //
  108. typedef
  109. mysql::query_column<
  110. mysql::value_traits<
  111. ::std::string,
  112. mysql::id_string >::query_type,
  113. mysql::id_string >
  114. nickname_type_;
  115.  
  116. static const nickname_type_ nickname;
  117.  
  118. // password
  119. //
  120. typedef
  121. mysql::query_column<
  122. mysql::value_traits<
  123. ::std::string,
  124. mysql::id_string >::query_type,
  125. mysql::id_string >
  126. password_type_;
  127.  
  128. static const password_type_ password;
  129.  
  130. // register_date
  131. //
  132. typedef
  133. mysql::query_column<
  134. mysql::value_traits<
  135. long long unsigned int,
  136. mysql::id_ulonglong >::query_type,
  137. mysql::id_ulonglong >
  138. register_date_type_;
  139.  
  140. static const register_date_type_ register_date;
  141.  
  142. // kills
  143. //
  144. typedef
  145. mysql::query_column<
  146. mysql::value_traits<
  147. unsigned int,
  148. mysql::id_ulong >::query_type,
  149. mysql::id_ulong >
  150. kills_type_;
  151.  
  152. static const kills_type_ kills;
  153.  
  154. // deaths
  155. //
  156. typedef
  157. mysql::query_column<
  158. mysql::value_traits<
  159. unsigned int,
  160. mysql::id_ulong >::query_type,
  161. mysql::id_ulong >
  162. deaths_type_;
  163.  
  164. static const deaths_type_ deaths;
  165.  
  166. // joins
  167. //
  168. typedef
  169. mysql::query_column<
  170. mysql::value_traits<
  171. unsigned int,
  172. mysql::id_ulong >::query_type,
  173. mysql::id_ulong >
  174. joins_type_;
  175.  
  176. static const joins_type_ joins;
  177.  
  178. // disconnects
  179. //
  180. typedef
  181. mysql::query_column<
  182. mysql::value_traits<
  183. unsigned int,
  184. mysql::id_ulong >::query_type,
  185. mysql::id_ulong >
  186. disconnects_type_;
  187.  
  188. static const disconnects_type_ disconnects;
  189.  
  190. // kicks
  191. //
  192. typedef
  193. mysql::query_column<
  194. mysql::value_traits<
  195. unsigned int,
  196. mysql::id_ulong >::query_type,
  197. mysql::id_ulong >
  198. kicks_type_;
  199.  
  200. static const kicks_type_ kicks;
  201.  
  202. // experience
  203. //
  204. typedef
  205. mysql::query_column<
  206. mysql::value_traits<
  207. long long unsigned int,
  208. mysql::id_ulonglong >::query_type,
  209. mysql::id_ulonglong >
  210. experience_type_;
  211.  
  212. static const experience_type_ experience;
  213.  
  214. // admin
  215. //
  216. typedef
  217. mysql::query_column<
  218. mysql::value_traits<
  219. long long unsigned int,
  220. mysql::id_ulonglong >::query_type,
  221. mysql::id_ulonglong >
  222. admin_type_;
  223.  
  224. static const admin_type_ admin;
  225.  
  226. // banned
  227. //
  228. typedef
  229. mysql::query_column<
  230. mysql::value_traits<
  231. long long unsigned int,
  232. mysql::id_ulonglong >::query_type,
  233. mysql::id_ulonglong >
  234. banned_type_;
  235.  
  236. static const banned_type_ banned;
  237. };
  238.  
  239. template <typename A>
  240. const typename query_columns< ::user, id_mysql, A >::id_type_
  241. query_columns< ::user, id_mysql, A >::
  242. id (A::table_name, "`id`", 0);
  243.  
  244. template <typename A>
  245. const typename query_columns< ::user, id_mysql, A >::nickname_type_
  246. query_columns< ::user, id_mysql, A >::
  247. nickname (A::table_name, "`nickname`", 0);
  248.  
  249. template <typename A>
  250. const typename query_columns< ::user, id_mysql, A >::password_type_
  251. query_columns< ::user, id_mysql, A >::
  252. password (A::table_name, "`password`", 0);
  253.  
  254. template <typename A>
  255. const typename query_columns< ::user, id_mysql, A >::register_date_type_
  256. query_columns< ::user, id_mysql, A >::
  257. register_date (A::table_name, "`register_date`", 0);
  258.  
  259. template <typename A>
  260. const typename query_columns< ::user, id_mysql, A >::kills_type_
  261. query_columns< ::user, id_mysql, A >::
  262. kills (A::table_name, "`kills`", 0);
  263.  
  264. template <typename A>
  265. const typename query_columns< ::user, id_mysql, A >::deaths_type_
  266. query_columns< ::user, id_mysql, A >::
  267. deaths (A::table_name, "`deaths`", 0);
  268.  
  269. template <typename A>
  270. const typename query_columns< ::user, id_mysql, A >::joins_type_
  271. query_columns< ::user, id_mysql, A >::
  272. joins (A::table_name, "`joins`", 0);
  273.  
  274. template <typename A>
  275. const typename query_columns< ::user, id_mysql, A >::disconnects_type_
  276. query_columns< ::user, id_mysql, A >::
  277. disconnects (A::table_name, "`disconnects`", 0);
  278.  
  279. template <typename A>
  280. const typename query_columns< ::user, id_mysql, A >::kicks_type_
  281. query_columns< ::user, id_mysql, A >::
  282. kicks (A::table_name, "`kicks`", 0);
  283.  
  284. template <typename A>
  285. const typename query_columns< ::user, id_mysql, A >::experience_type_
  286. query_columns< ::user, id_mysql, A >::
  287. experience (A::table_name, "`experience`", 0);
  288.  
  289. template <typename A>
  290. const typename query_columns< ::user, id_mysql, A >::admin_type_
  291. query_columns< ::user, id_mysql, A >::
  292. admin (A::table_name, "`admin`", 0);
  293.  
  294. template <typename A>
  295. const typename query_columns< ::user, id_mysql, A >::banned_type_
  296. query_columns< ::user, id_mysql, A >::
  297. banned (A::table_name, "`banned`", 0);
  298.  
  299. template <typename A>
  300. struct pointer_query_columns< ::user, id_mysql, A >:
  301. query_columns< ::user, id_mysql, A >
  302. {
  303. };
  304.  
  305. template <>
  306. class access::object_traits_impl< ::user, id_mysql >:
  307. public access::object_traits< ::user >
  308. {
  309. public:
  310. struct id_image_type
  311. {
  312. unsigned long long id_value;
  313. my_bool id_null;
  314.  
  315. std::size_t version;
  316. };
  317.  
  318. struct image_type
  319. {
  320. // id_
  321. //
  322. unsigned long long id_value;
  323. my_bool id_null;
  324.  
  325. // nickname_
  326. //
  327. details::buffer nickname_value;
  328. unsigned long nickname_size;
  329. my_bool nickname_null;
  330.  
  331. // password_
  332. //
  333. details::buffer password_value;
  334. unsigned long password_size;
  335. my_bool password_null;
  336.  
  337. // register_date_
  338. //
  339. unsigned long long register_date_value;
  340. my_bool register_date_null;
  341.  
  342. // kills_
  343. //
  344. unsigned int kills_value;
  345. my_bool kills_null;
  346.  
  347. // deaths_
  348. //
  349. unsigned int deaths_value;
  350. my_bool deaths_null;
  351.  
  352. // joins_
  353. //
  354. unsigned int joins_value;
  355. my_bool joins_null;
  356.  
  357. // disconnects_
  358. //
  359. unsigned int disconnects_value;
  360. my_bool disconnects_null;
  361.  
  362. // kicks_
  363. //
  364. unsigned int kicks_value;
  365. my_bool kicks_null;
  366.  
  367. // experience_
  368. //
  369. unsigned long long experience_value;
  370. my_bool experience_null;
  371.  
  372. // admin_
  373. //
  374. unsigned long long admin_value;
  375. my_bool admin_null;
  376.  
  377. // banned_
  378. //
  379. unsigned long long banned_value;
  380. my_bool banned_null;
  381.  
  382. std::size_t version;
  383. };
  384.  
  385. // bans_
  386. //
  387. struct bans_traits
  388. {
  389. static const std::size_t id_column_count = 1UL;
  390. static const std::size_t data_column_count = 2UL;
  391.  
  392. static const char insert_statement[];
  393. static const char select_statement[];
  394. static const char delete_statement[];
  395.  
  396. typedef ::user::bans_type container_type;
  397. typedef
  398. odb::access::container_traits<container_type>
  399. container_traits_type;
  400. typedef container_traits_type::index_type index_type;
  401. typedef container_traits_type::value_type value_type;
  402.  
  403. typedef ordered_functions<index_type, value_type> functions_type;
  404. typedef mysql::container_statements< bans_traits > statements_type;
  405.  
  406. struct data_image_type
  407. {
  408. // index
  409. //
  410. unsigned long long index_value;
  411. my_bool index_null;
  412.  
  413. // value
  414. //
  415. composite_value_traits< value_type, id_mysql >::image_type value_value;
  416.  
  417. std::size_t version;
  418. };
  419.  
  420. static void
  421. bind (MYSQL_BIND*,
  422. const MYSQL_BIND* id,
  423. std::size_t id_size,
  424. data_image_type&);
  425.  
  426. static void
  427. grow (data_image_type&, my_bool*);
  428.  
  429. static void
  430. init (data_image_type&, index_type*, const value_type&);
  431.  
  432. static void
  433. init (index_type&, value_type&, const data_image_type&, database*);
  434.  
  435. static void
  436. insert (index_type, const value_type&, void*);
  437.  
  438. static bool
  439. select (index_type&, value_type&, void*);
  440.  
  441. static void
  442. delete_ (void*);
  443.  
  444. static void
  445. persist (const container_type&, statements_type&);
  446.  
  447. static void
  448. load (container_type&, statements_type&);
  449.  
  450. static void
  451. update (const container_type&, statements_type&);
  452.  
  453. static void
  454. erase (statements_type&);
  455. };
  456.  
  457. using object_traits<object_type>::id;
  458.  
  459. static id_type
  460. id (const image_type&);
  461.  
  462. static bool
  463. grow (image_type&, my_bool*);
  464.  
  465. static void
  466. bind (MYSQL_BIND*,
  467. image_type&,
  468. mysql::statement_kind);
  469.  
  470. static void
  471. bind (MYSQL_BIND*, id_image_type&);
  472.  
  473. static bool
  474. init (image_type&, const object_type&, mysql::statement_kind);
  475.  
  476. static void
  477. init (object_type&, const image_type&, database*);
  478.  
  479. static void
  480. init (id_image_type&, const id_type&);
  481.  
  482. typedef mysql::object_statements<object_type> statements_type;
  483.  
  484. typedef mysql::query_base query_base_type;
  485.  
  486. struct container_statement_cache_type;
  487.  
  488. static const std::size_t column_count = 12UL;
  489. static const std::size_t id_column_count = 1UL;
  490. static const std::size_t inverse_column_count = 0UL;
  491. static const std::size_t readonly_column_count = 0UL;
  492. static const std::size_t managed_optimistic_column_count = 0UL;
  493.  
  494. static const char persist_statement[];
  495. static const char find_statement[];
  496. static const char update_statement[];
  497. static const char erase_statement[];
  498. static const char query_statement[];
  499. static const char erase_query_statement[];
  500.  
  501. static const char table_name[];
  502.  
  503. static void
  504. persist (database&, object_type&);
  505.  
  506. static pointer_type
  507. find (database&, const id_type&);
  508.  
  509. static bool
  510. find (database&, const id_type&, object_type&);
  511.  
  512. static bool
  513. reload (database&, object_type&);
  514.  
  515. static void
  516. update (database&, const object_type&);
  517.  
  518. static void
  519. erase (database&, const id_type&);
  520.  
  521. static void
  522. erase (database&, const object_type&);
  523.  
  524. static result<object_type>
  525. query (database&, const query_base_type&);
  526.  
  527. static unsigned long long
  528. erase_query (database&, const query_base_type&);
  529.  
  530. public:
  531. static bool
  532. find_ (statements_type&, const id_type*);
  533.  
  534. static void
  535. load_ (statements_type&, object_type&);
  536. };
  537.  
  538. template <>
  539. class access::object_traits_impl< ::user, id_common >:
  540. public access::object_traits_impl< ::user, id_mysql >
  541. {
  542. };
  543.  
  544. // user
  545. //
  546. }
  547.  
  548. #include "user-odb.ixx"
  549.  
  550. #include <odb/post.hxx>
  551.  
  552. #endif // USER_ODB_HXX
  553.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty