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> |
|
23 |
||
24 |
namespace drizzled |
|
25 |
{
|
|
26 |
class ResourceContext; |
|
27 |
||
28 |
class TransactionContext |
|
29 |
{
|
|
30 |
public: |
|
31 |
TransactionContext() : |
|
32 |
no_2pc(false), |
|
33 |
resource_contexts(), |
|
1273.1.13
by Jay Pipes
Style cleanup around TransactionContext::modified_non_trans_table and dead code removal |
34 |
modified_non_trans_data(false) |
1273.1.10
by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext |
35 |
{}
|
36 |
||
1273.1.13
by Jay Pipes
Style cleanup around TransactionContext::modified_non_trans_table and dead code removal |
37 |
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 |
38 |
|
39 |
typedef std::vector<ResourceContext *> ResourceContexts; |
|
40 |
||
41 |
void setResourceContexts(ResourceContexts &new_contexts) |
|
42 |
{
|
|
43 |
resource_contexts.assign(new_contexts.begin(), new_contexts.end()); |
|
44 |
}
|
|
45 |
||
46 |
ResourceContexts &getResourceContexts() |
|
47 |
{
|
|
48 |
return resource_contexts; |
|
49 |
}
|
|
50 |
/** Register a resource context in this transaction context */
|
|
51 |
void registerResource(ResourceContext *resource) |
|
52 |
{
|
|
53 |
resource_contexts.push_back(resource); |
|
54 |
}
|
|
55 |
||
1273.1.13
by Jay Pipes
Style cleanup around TransactionContext::modified_non_trans_table and dead code removal |
56 |
/**
|
57 |
* Marks that this transaction has modified state
|
|
58 |
* of some non-transactional data.
|
|
59 |
*/
|
|
60 |
void markModifiedNonTransData() |
|
61 |
{
|
|
62 |
modified_non_trans_data= true; |
|
63 |
}
|
|
64 |
||
65 |
/**
|
|
66 |
* Returns true if the transaction has modified
|
|
67 |
* state of some non-transactional data.
|
|
68 |
*/
|
|
69 |
bool hasModifiedNonTransData() const |
|
70 |
{
|
|
71 |
return modified_non_trans_data; |
|
72 |
}
|
|
73 |
||
1273.1.10
by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext |
74 |
/* true is not all entries in the resource contexts support 2pc */
|
75 |
bool no_2pc; |
|
76 |
private: |
|
1273.1.13
by Jay Pipes
Style cleanup around TransactionContext::modified_non_trans_table and dead code removal |
77 |
/** Resource that registered in this transaction */
|
1273.1.10
by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext |
78 |
ResourceContexts resource_contexts; |
1273.1.13
by Jay Pipes
Style cleanup around TransactionContext::modified_non_trans_table and dead code removal |
79 |
/** Whether this transaction has changed non-transaction data state */
|
80 |
bool modified_non_trans_data; |
|
1273.1.10
by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext |
81 |
};
|
82 |
||
83 |
} /* namespace drizzled */ |
|
84 |