~drizzle-trunk/drizzle/development

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
 *
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.4 by Jay Pipes
This patch significantly reworks the way that
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
2234 by Brian Aker
Mass removal of ifdef/endif in favor of pragma once.
24
#pragma once
1273.1.4 by Jay Pipes
This patch significantly reworks the way that
25
2252.1.16 by Olaf van der Spek
Common fwd
26
#include <drizzled/transaction_context.h>
2241.3.4 by Olaf van der Spek
Refactor Session::transaction
27
#include <string>
1273.1.4 by Jay Pipes
This patch significantly reworks the way that
28
2241.3.3 by Olaf van der Spek
Refactor Session::transaction (partial)
29
namespace drizzled {
1273.1.4 by Jay Pipes
This patch significantly reworks the way that
30
31
/**
32
 * This is a class which stores information about
33
 * a named savepoint in a transaction
34
 */
35
class NamedSavepoint
36
{
37
public:
38
  /**
39
   * Constructor
40
   */
41
  NamedSavepoint(const char *in_name, size_t in_name_length) :
1273.1.10 by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext
42
    name(in_name, in_name_length),
1746.7.5 by Joseph Daly
fix to get tests working with release savepoint
43
    resource_contexts(),
1762.2.1 by Joseph Daly
fix up bugs 638518, and memory leak problems
44
    transaction_message(NULL)
45
  {}
46
47
  ~NamedSavepoint();
48
49
  NamedSavepoint(const NamedSavepoint &other);
1273.1.10 by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext
50
51
  void setResourceContexts(TransactionContext::ResourceContexts &new_contexts)
52
  {
2318.7.23 by Olaf van der Spek
Use operator=
53
    resource_contexts= new_contexts;
1273.1.10 by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext
54
  }
55
  const TransactionContext::ResourceContexts &getResourceContexts() const
56
  {
57
    return resource_contexts;
58
  }
59
  TransactionContext::ResourceContexts &getResourceContexts()
60
  {
61
    return resource_contexts;
62
  }
1273.1.4 by Jay Pipes
This patch significantly reworks the way that
63
  const std::string &getName() const
64
  {
65
    return name;
66
  }
1762.2.1 by Joseph Daly
fix up bugs 638518, and memory leak problems
67
  message::Transaction *getTransactionMessage() const
68
  {
69
    return transaction_message;
70
  }
71
  void setTransactionMessage(message::Transaction *in_transaction_message)
72
  {
73
    transaction_message= in_transaction_message;
1273.1.10 by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext
74
  }
75
  NamedSavepoint &operator=(const NamedSavepoint &other)
76
  {
77
    if (this == &other)
78
      return *this;
79
2318.7.23 by Olaf van der Spek
Use operator=
80
    name= other.getName();
81
    resource_contexts= other.getResourceContexts();
1273.1.10 by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext
82
    return *this;
1273.1.4 by Jay Pipes
This patch significantly reworks the way that
83
  }
84
private:
85
  std::string name;
1273.1.10 by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext
86
  TransactionContext::ResourceContexts resource_contexts;
1762.2.1 by Joseph Daly
fix up bugs 638518, and memory leak problems
87
  message::Transaction *transaction_message;
1273.1.4 by Jay Pipes
This patch significantly reworks the way that
88
};
89
90
} /* namespace drizzled */
91