You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

73 lines
2.2 KiB

  1. #pragma once
  2. #include "../classes/schema/schema.h"
  3. namespace cpphibernate {
  4. namespace mariadb {
  5. struct driver_t;
  6. /**
  7. * @brief Actual implementation of the mariadb driver.
  8. *
  9. * This class is used/owner by the mariadb driver class (as a member).
  10. * The public interface of this class will not be part of the cpphibernate context.
  11. */
  12. struct driver_impl_t
  13. {
  14. driver_t& owner;
  15. schema_ptr_u schema;
  16. /**
  17. * @brief Constructor.
  18. * @param[in] p_owner Object the driver implementation is owned by.
  19. * @param[in] p_schema Cpphibernate schema to use with the driver.
  20. */
  21. template<typename T_schema>
  22. inline driver_impl_t(driver_t& p_owner, T_schema&& p_schema);
  23. /**
  24. * @brief Initialize the schema in the database.
  25. *
  26. * @param[in] recreate Recreate the whole schema (this will drop all existing data).
  27. */
  28. inline void init(bool recreate) const;
  29. /**
  30. * @brief Create a new dataset in the database.
  31. * This will update the primary key field of the passed dataset.
  32. *
  33. * @param[in] dataset Dataset to create in the database.
  34. */
  35. template<typename T_dataset>
  36. inline void create(T_dataset& dataset) const;
  37. /**
  38. * @brief Read datasets from the database.
  39. *
  40. * @param[in] dataset Dataset to read from the database.
  41. * @param[in] modifiers Modifiers to apply to the select query.
  42. */
  43. template<typename T_dataset, typename T_modifiers>
  44. inline void read(T_dataset& dataset, const T_modifiers& modifiers) const;
  45. /**
  46. * @brief Update an exsisting dataset in the database.
  47. *
  48. * @param[in] dataset Dataset to update in the database.
  49. */
  50. template<typename T_dataset>
  51. inline void update(T_dataset& dataset) const;
  52. /**
  53. * @brief Destroy an exsisting dataset in the database.
  54. *
  55. * @param[in] dataset Dataset to destroy in the database.
  56. */
  57. template<typename T_dataset>
  58. inline void destroy(T_dataset& dataset) const;
  59. };
  60. } }