~drizzle-trunk/drizzle/development

851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
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
#ifndef DRIZZLED_OPEN_TABLES_STATE_H
22
#define DRIZZLED_OPEN_TABLES_STATE_H
23
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
24
#include "drizzled/lock.h"
25
26
namespace drizzled
27
{
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
28
29
/**
30
  Class that holds information about tables which were opened and locked
31
  by the thread. It is also used to save/restore this information in
32
  push_open_tables_state()/pop_open_tables_state().
33
*/
34
35
class Open_tables_state
36
{
37
public:
38
  /**
39
    List of regular tables in use by this thread. Contains temporary and
40
    base tables that were opened with @see open_tables().
41
  */
42
  Table *open_tables;
1877.2.16 by Brian Aker
Fix dangling headers.
43
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
44
  /**
45
    List of temporary tables used by this thread. Contains user-level
46
    temporary tables, created with CREATE TEMPORARY TABLE, and
47
    internal temporary tables, created, e.g., to resolve a SELECT,
48
    or for an intermediate table used in ALTER.
49
    XXX Why are internal temporary tables added to this list?
50
  */
51
  Table *temporary_tables;
1046.1.6 by Brian Aker
Formatting/style cleanup.
52
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
53
  Table *derived_tables;
54
  /*
55
    During a MySQL session, one can lock tables in two modes: automatic
56
    or manual. In automatic mode all necessary tables are locked just before
57
    statement execution, and all acquired locks are stored in 'lock'
58
    member. Unlocking takes place automatically as well, when the
59
    statement ends.
60
    Manual mode comes into play when a user issues a 'LOCK TABLES'
61
    statement. In this mode the user can only use the locked tables.
62
    Trying to use any other tables will give an error. The locked tables are
63
    stored in 'locked_tables' member.  Manual locking is described in
64
    the 'LOCK_TABLES' chapter of the MySQL manual.
65
    See also lock_tables() for details.
66
  */
1711.6.1 by Brian Aker
Style on structure cleanup
67
  DrizzleLock *lock;
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
68
69
  /*
70
    CREATE-SELECT keeps an extra lock for the table being
71
    created. This field is used to keep the extra lock available for
72
    lower level routines, which would otherwise miss that lock.
73
   */
1711.6.1 by Brian Aker
Style on structure cleanup
74
  DrizzleLock *extra_lock;
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
75
1223.2.1 by Trond Norbye
Bug #485658: Compile failure on 32 bit system due to mixing ulong, uint64_t and uint32_t
76
  uint64_t version;
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
77
  uint32_t current_tablenr;
78
79
  /*
80
    This constructor serves for creation of Open_tables_state instances
81
    which are used as backup storage.
82
  */
1889.1.4 by Brian Aker
C++ warning fixes.
83
  Open_tables_state() :
84
    open_tables(0),
85
    temporary_tables(0),
86
    derived_tables(0),
87
    lock(0),
88
    extra_lock(0),
89
    version(0),
90
    current_tablenr(0)
91
  { }
1240.9.4 by Monty Taylor
destructor for base class "Open_tables_state" (declared at line 31 of "../drizzled/open_tables_state.h") is not virtual
92
  virtual ~Open_tables_state() {}
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
93
1223.2.1 by Trond Norbye
Bug #485658: Compile failure on 32 bit system due to mixing ulong, uint64_t and uint32_t
94
  Open_tables_state(uint64_t version_arg);
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
95
};
96
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
97
} /* namespace drizzled */
98
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
99
#endif /* DRIZZLED_OPEN_TABLES_STATE_H */