1273.1.4
by Jay Pipes
This patch significantly reworks the way that |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
4 |
* Copyright (C) 2008 Sun Microsystems
|
|
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 |
||
20 |
/**
|
|
21 |
* @file Simple named savepoint class.
|
|
22 |
*/
|
|
23 |
||
1273.1.6
by Jay Pipes
Correct cpplint issue with header guard on drizzled/named_savepoint.h |
24 |
#ifndef DRIZZLED_NAMED_SAVEPOINT_H
|
25 |
#define DRIZZLED_NAMED_SAVEPOINT_H
|
|
1273.1.4
by Jay Pipes
This patch significantly reworks the way that |
26 |
|
1273.1.10
by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext |
27 |
#include "drizzled/transaction_context.h" /* for TransactionContext::ResourceContexts */ |
1273.1.4
by Jay Pipes
This patch significantly reworks the way that |
28 |
|
29 |
namespace drizzled |
|
30 |
{
|
|
31 |
||
1746.7.7
by Joseph Daly
fix compiler error on some platforms |
32 |
namespace message |
33 |
{
|
|
1746.7.8
by Joseph Daly
fix spacing |
34 |
class Transaction; |
1746.7.7
by Joseph Daly
fix compiler error on some platforms |
35 |
}
|
36 |
||
1273.1.4
by Jay Pipes
This patch significantly reworks the way that |
37 |
/**
|
38 |
* This is a class which stores information about
|
|
39 |
* a named savepoint in a transaction
|
|
40 |
*/
|
|
41 |
class NamedSavepoint |
|
42 |
{
|
|
43 |
public: |
|
44 |
/**
|
|
45 |
* Constructor
|
|
46 |
*/
|
|
47 |
NamedSavepoint(const char *in_name, size_t in_name_length) : |
|
1273.1.10
by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext |
48 |
name(in_name, in_name_length), |
1746.7.5
by Joseph Daly
fix to get tests working with release savepoint |
49 |
resource_contexts(), |
1762.2.1
by Joseph Daly
fix up bugs 638518, and memory leak problems |
50 |
transaction_message(NULL) |
51 |
{}
|
|
52 |
||
53 |
~NamedSavepoint(); |
|
54 |
||
55 |
NamedSavepoint(const NamedSavepoint &other); |
|
1273.1.10
by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext |
56 |
|
57 |
void setResourceContexts(TransactionContext::ResourceContexts &new_contexts) |
|
58 |
{
|
|
59 |
resource_contexts.assign(new_contexts.begin(), new_contexts.end()); |
|
60 |
}
|
|
61 |
const TransactionContext::ResourceContexts &getResourceContexts() const |
|
62 |
{
|
|
63 |
return resource_contexts; |
|
64 |
}
|
|
65 |
TransactionContext::ResourceContexts &getResourceContexts() |
|
66 |
{
|
|
67 |
return resource_contexts; |
|
68 |
}
|
|
1273.1.4
by Jay Pipes
This patch significantly reworks the way that |
69 |
const std::string &getName() const |
70 |
{
|
|
71 |
return name; |
|
72 |
}
|
|
73 |
const std::string &getName() |
|
74 |
{
|
|
75 |
return name; |
|
76 |
}
|
|
1762.2.1
by Joseph Daly
fix up bugs 638518, and memory leak problems |
77 |
message::Transaction *getTransactionMessage() const |
78 |
{
|
|
79 |
return transaction_message; |
|
80 |
}
|
|
81 |
void setTransactionMessage(message::Transaction *in_transaction_message) |
|
82 |
{
|
|
83 |
transaction_message= in_transaction_message; |
|
1273.1.10
by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext |
84 |
}
|
85 |
NamedSavepoint &operator=(const NamedSavepoint &other) |
|
86 |
{
|
|
87 |
if (this == &other) |
|
88 |
return *this; |
|
89 |
||
90 |
name.assign(other.getName()); |
|
91 |
const TransactionContext::ResourceContexts &other_resource_contexts= other.getResourceContexts(); |
|
92 |
resource_contexts.assign(other_resource_contexts.begin(), |
|
93 |
other_resource_contexts.end()); |
|
94 |
return *this; |
|
1273.1.4
by Jay Pipes
This patch significantly reworks the way that |
95 |
}
|
96 |
private: |
|
97 |
std::string name; |
|
1273.1.10
by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext |
98 |
TransactionContext::ResourceContexts resource_contexts; |
1762.2.1
by Joseph Daly
fix up bugs 638518, and memory leak problems |
99 |
message::Transaction *transaction_message; |
1273.1.4
by Jay Pipes
This patch significantly reworks the way that |
100 |
NamedSavepoint(); |
101 |
};
|
|
102 |
||
103 |
} /* namespace drizzled */ |
|
104 |
||
1273.1.6
by Jay Pipes
Correct cpplint issue with header guard on drizzled/named_savepoint.h |
105 |
#endif /* DRIZZLED_NAMED_SAVEPOINT_H */ |