~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session/transactions.h

  • Committer: Monty Taylor
  • Date: 2011-03-10 18:09:05 UTC
  • mfrom: (2225.2.2 refactor)
  • mto: This revision was merged to the branch mainline in revision 2228.
  • Revision ID: mordred@inaugust.com-20110310180905-ttx05t7q7ff6nl7c
Merge Olad: Refactoring

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
 
3
 *
 
4
 *  Copyright (C) 2011 Brian Aker
 
5
 *
 
6
 *  This program is free software; you can redistribute it and/or modify
 
7
 *  it under the terms of the GNU General Public License as published by
 
8
 *  the Free Software Foundation; either version 2 of the License, or
 
9
 *  (at your option) any later version.
 
10
 *
 
11
 *  This program is distributed in the hope that it will be useful,
 
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 *  GNU General Public License for more details.
 
15
 *
 
16
 *  You should have received a copy of the GNU General Public License
 
17
 *  along with this program; if not, write to the Free Software
 
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
19
 */
 
20
 
 
21
#ifndef DRIZZLED_SESSION_TRANSACTIONS_H
 
22
#define DRIZZLED_SESSION_TRANSACTIONS_H
 
23
 
 
24
#include <deque>
 
25
#include <drizzled/xid.h>
 
26
 
 
27
namespace drizzled {
 
28
 
 
29
class Session;
 
30
 
 
31
namespace session {
 
32
 
 
33
/**
 
34
 * Structure used to manage "statement transactions" and
 
35
 * "normal transactions". In autocommit mode, the normal transaction is
 
36
 * equivalent to the statement transaction.
 
37
 *
 
38
 * Storage engines will be registered here when they participate in
 
39
 * a transaction. No engine is registered more than once.
 
40
 */
 
41
class Transactions 
 
42
{
 
43
public:
 
44
  std::deque<NamedSavepoint> savepoints;
 
45
 
 
46
  /**
 
47
   * The normal transaction (since BEGIN WORK).
 
48
   *
 
49
   * Contains a list of all engines that have participated in any of the
 
50
   * statement transactions started within the context of the normal
 
51
   * transaction.
 
52
   *
 
53
   * @note In autocommit mode, this is empty.
 
54
   */
 
55
  TransactionContext all;
 
56
 
 
57
  /**
 
58
   * The statment transaction.
 
59
   *
 
60
   * Contains a list of all engines participating in the given statement.
 
61
   *
 
62
   * @note In autocommit mode, this will be used to commit/rollback the
 
63
   * normal transaction.
 
64
   */
 
65
  TransactionContext stmt;
 
66
 
 
67
  XID_STATE xid_state;
 
68
 
 
69
  void cleanup()
 
70
  {
 
71
    savepoints.clear();
 
72
  }
 
73
};
 
74
 
 
75
} /* namespace session */
 
76
} /* namespace drizzled */
 
77
 
 
78
#endif /* DRIZZLED_SESSION_TRANSACTIONS_H */