~drizzle-trunk/drizzle/development

1273.1.10 by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
1999.6.1 by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file
4
 *  Copyright (C) 2008 Sun Microsystems, Inc.
1273.1.10 by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext
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; version 2 of the License.
9
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  GNU General Public License for more details.
14
 *
15
 *  You should have received a copy of the GNU General Public License
16
 *  along with this program; if not, write to the Free Software
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 */
19
2234 by Brian Aker
Mass removal of ifdef/endif in favor of pragma once.
20
#pragma once
1273.1.10 by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext
21
22
#include <vector>
2252.1.16 by Olaf van der Spek
Common fwd
23
#include <drizzled/common_fwd.h>
1273.1.10 by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext
24
2252.1.16 by Olaf van der Spek
Common fwd
25
namespace drizzled {
1273.1.10 by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext
26
27
class TransactionContext
28
{
29
public:
30
  TransactionContext() :
31
    no_2pc(false),
32
    resource_contexts(),
1273.1.13 by Jay Pipes
Style cleanup around TransactionContext::modified_non_trans_table and dead code removal
33
    modified_non_trans_data(false)
1273.1.10 by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext
34
  {}
35
1273.1.13 by Jay Pipes
Style cleanup around TransactionContext::modified_non_trans_table and dead code removal
36
  void reset() { no_2pc= false; modified_non_trans_data= false; resource_contexts.clear();}
1273.1.10 by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext
37
38
  typedef std::vector<ResourceContext *> ResourceContexts;
39
40
  void setResourceContexts(ResourceContexts &new_contexts)
41
  {
42
    resource_contexts.assign(new_contexts.begin(), new_contexts.end());
43
  }
44
45
  ResourceContexts &getResourceContexts()
46
  {
47
    return resource_contexts;
48
  }
49
  /** Register a resource context in this transaction context */
50
  void registerResource(ResourceContext *resource)
51
  {
52
    resource_contexts.push_back(resource);
53
  }
54
1273.1.13 by Jay Pipes
Style cleanup around TransactionContext::modified_non_trans_table and dead code removal
55
  /**
56
   * Marks that this transaction has modified state
57
   * of some non-transactional data.
58
   */
59
  void markModifiedNonTransData()
60
  {
61
    modified_non_trans_data= true;
62
  }
63
64
  /**
65
   * Returns true if the transaction has modified
66
   * state of some non-transactional data.
67
   */
68
  bool hasModifiedNonTransData() const
69
  {
70
    return modified_non_trans_data;
71
  }
72
1273.1.10 by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext
73
  /* true is not all entries in the resource contexts support 2pc */
74
  bool no_2pc;
75
private:
1273.1.13 by Jay Pipes
Style cleanup around TransactionContext::modified_non_trans_table and dead code removal
76
  /** Resource that registered in this transaction */
1273.1.10 by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext
77
  ResourceContexts resource_contexts;
1273.1.13 by Jay Pipes
Style cleanup around TransactionContext::modified_non_trans_table and dead code removal
78
  /** Whether this transaction has changed non-transaction data state */
79
  bool modified_non_trans_data;
1273.1.10 by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext
80
};
81
82
} /* namespace drizzled */
83