The Battle for Wesnoth  1.15.3+dev
save_point.hpp
Go to the documentation of this file.
1 //
2 // M A R I A D B + +
3 //
4 // Copyright Sylvain Rochette Langlois 2013,
5 // The ViaDuck Project 2016 - 2018.
6 // Distributed under the Boost Software License, Version 1.0.
7 // (See accompanying file LICENSE or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
9 
10 #ifndef _MARIADB_SAVE_POINT_HPP_
11 #define _MARIADB_SAVE_POINT_HPP_
12 
13 #include <mariadb++/types.hpp>
14 
15 namespace mariadb {
16 class connection;
17 class transaction;
18 
19 /**
20  * Class used to represent a MariaDB savepoint having automatic rollback functionality
21  */
22 class save_point {
23  friend class connection;
24  friend class transaction;
25 
26  public:
27  /**
28  * Destructor initiates automatic rollback if changes were not committed
29  */
30  virtual ~save_point();
31 
32  /**
33  * Commits the changes and releases savepoint
34  */
35  void commit();
36 
37  private:
38  /**
39  * Create save_point with given transaction
40  */
41  save_point(transaction* trans);
42 
43  private:
44  // internal transaction pointer
46  // distinct name of the current save_pointS
48 };
49 
50 typedef std::shared_ptr<save_point> save_point_ref;
51 }
52 
53 #endif
Class representing a SQL transaction having automatic rollback functionality.
Definition: transaction.hpp:25
transaction * m_transaction
Definition: save_point.hpp:45
Class used to represent a MariaDB savepoint having automatic rollback functionality.
Definition: save_point.hpp:22
std::string m_name
Definition: save_point.hpp:47
Wraps a Database connection.
Definition: connection.hpp:27
std::shared_ptr< save_point > save_point_ref
Definition: save_point.hpp:50
void commit()
Commits the changes and releases savepoint.
Definition: save_point.cpp:45
virtual ~save_point()
Destructor initiates automatic rollback if changes were not committed.
Definition: save_point.cpp:35
save_point(transaction *trans)
Create save_point with given transaction.
Definition: save_point.cpp:27