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.
 
 
 

28 lines
727 B

  1. #pragma once
  2. #include "driver_impl.h"
  3. #include "../driver.h"
  4. namespace cpphibernate {
  5. namespace mariadb {
  6. /* driver_impl_t */
  7. template<typename T_schema>
  8. driver_impl_t::driver_impl_t(driver_t& p_owner, T_schema&& p_schema)
  9. : owner (p_owner)
  10. , schema(make_schema(std::forward<T_schema>(p_schema)))
  11. { }
  12. void driver_impl_t::init(bool recreate) const
  13. {
  14. auto * connection = owner.connection();
  15. if (!connection)
  16. throw exception("Cpphibernate mariadb driver is not connected to any database!");
  17. ::cppmariadb::transaction_lock trans(*connection);
  18. schema->init(init_context(*schema, *connection, recreate));
  19. trans.commit();
  20. }
  21. } }