~drizzle-trunk/drizzle/development

575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
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
#ifndef DRIZZLED_HA_TRX_INFO_H
21
#define DRIZZLED_HA_TRX_INFO_H
22
584.1.13 by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes.
23
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
24
namespace drizzled
25
{
26
584.1.13 by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes.
27
class Session_TRANS;
1130.1.4 by Monty Taylor
Moved StorageEngine into plugin namespace.
28
namespace plugin
29
{
960.2.24 by Monty Taylor
Changed handlerton to StorageEngine.
30
class StorageEngine;
1130.1.4 by Monty Taylor
Moved StorageEngine into plugin namespace.
31
}
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
32
584.1.13 by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes.
33
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
34
/**
35
  Either statement transaction or normal transaction - related
36
  thread-specific storage engine data.
37
38
  If a storage engine participates in a statement/transaction,
39
  an instance of this class is present in
40
  session->transaction.{stmt|all}.ha_list. The addition to
41
  {stmt|all}.ha_list is made by trans_register_ha().
42
43
  When it's time to commit or rollback, each element of ha_list
44
  is used to access storage engine's prepare()/commit()/rollback()
45
  methods, and also to evaluate if a full two phase commit is
46
  necessary.
47
48
  @sa General description of transaction handling in handler.cc.
49
*/
50
51
class Ha_trx_info
52
{
53
public:
54
  /** Register this storage engine in the given transaction context. */
1130.1.4 by Monty Taylor
Moved StorageEngine into plugin namespace.
55
  void register_ha(Session_TRANS *trans,
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
56
                   plugin::StorageEngine *engine_arg);
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
57
58
  /** Clear, prepare for reuse. */
584.1.13 by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes.
59
  void reset();
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
60
  Ha_trx_info() { reset(); }
61
584.1.13 by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes.
62
  void set_trx_read_write();
63
  bool is_trx_read_write() const;
64
  bool is_started() const;
65
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
66
  /** Mark this transaction read-write if the argument is read-write. */
584.1.13 by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes.
67
  void coalesce_trx_with(const Ha_trx_info *stmt_trx);
68
  Ha_trx_info *next() const;
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
69
  plugin::StorageEngine *engine() const;
584.1.13 by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes.
70
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
71
private:
72
  enum { TRX_READ_ONLY= 0, TRX_READ_WRITE= 1 };
73
  /** Auxiliary, used for ha_list management */
74
  Ha_trx_info *m_next;
75
  /**
76
    Although a given Ha_trx_info instance is currently always used
960.2.37 by Monty Taylor
More naming fixes.
77
    for the same storage engine, 'engine' is not-NULL only when the
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
78
    corresponding storage is a part of a transaction.
79
  */
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
80
  plugin::StorageEngine *m_engine;
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
81
  /**
82
    Transaction flags related to this engine.
83
    Not-null only if this instance is a part of transaction.
84
    May assume a combination of enum values above.
85
  */
86
  unsigned char       m_flags;
87
};
88
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
89
} /* namespace drizzled */
90
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
91
#endif /* DRIZZLED_HA_TRX_INFO_H */