Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

52 linhas
1.1 KiB

  1. #pragma once
  2. #include <cppmariadb/config.h>
  3. namespace cppmariadb
  4. {
  5. /**
  6. * @brief Locks the queries executed at a connection.
  7. *
  8. * This will start an transaction if the object is created and
  9. * automatically execute the rollback in the destructor, if the
  10. * transaction ws not commited.
  11. */
  12. struct transaction
  13. {
  14. private:
  15. connection& _connection; //!< Connection this transaction object protects
  16. bool _closed; //!< True if the transaction is closed/finished.
  17. public:
  18. /**
  19. * @brief Constructor.
  20. *
  21. * @param[in] connection Connection to protect.
  22. */
  23. inline transaction(connection& connection);
  24. /**
  25. * @brief Destructor.
  26. */
  27. inline ~transaction();
  28. /**
  29. * @brief Commit the changes made on the connection.
  30. */
  31. inline void commit();
  32. /**
  33. * @brief Rollback the changes made on the connection.
  34. */
  35. inline void rollback();
  36. private:
  37. /**
  38. * @brief Begin the transaction.
  39. */
  40. inline void begin();
  41. };
  42. }