1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems
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.
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.
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
21
#ifndef DRIZZLED_OPEN_TABLES_STATE_H
22
#define DRIZZLED_OPEN_TABLES_STATE_H
26
Class that holds information about tables which were opened and locked
27
by the thread. It is also used to save/restore this information in
28
push_open_tables_state()/pop_open_tables_state().
31
class Open_tables_state
35
List of regular tables in use by this thread. Contains temporary and
36
base tables that were opened with @see open_tables().
40
List of temporary tables used by this thread. Contains user-level
41
temporary tables, created with CREATE TEMPORARY TABLE, and
42
internal temporary tables, created, e.g., to resolve a SELECT,
43
or for an intermediate table used in ALTER.
44
XXX Why are internal temporary tables added to this list?
46
Table *temporary_tables;
48
List of tables that were opened with HANDLER OPEN and are
49
still in use by this thread.
51
Table *handler_tables;
52
Table *derived_tables;
54
During a MySQL session, one can lock tables in two modes: automatic
55
or manual. In automatic mode all necessary tables are locked just before
56
statement execution, and all acquired locks are stored in 'lock'
57
member. Unlocking takes place automatically as well, when the
59
Manual mode comes into play when a user issues a 'LOCK TABLES'
60
statement. In this mode the user can only use the locked tables.
61
Trying to use any other tables will give an error. The locked tables are
62
stored in 'locked_tables' member. Manual locking is described in
63
the 'LOCK_TABLES' chapter of the MySQL manual.
64
See also lock_tables() for details.
68
Tables that were locked with explicit or implicit LOCK TABLES.
69
(Implicit LOCK TABLES happens when we are prelocking tables for
70
execution of statement which uses stored routines. See description
71
Session::prelocked_mode for more info.)
73
DRIZZLE_LOCK *locked_tables;
76
CREATE-SELECT keeps an extra lock for the table being
77
created. This field is used to keep the extra lock available for
78
lower level routines, which would otherwise miss that lock.
80
DRIZZLE_LOCK *extra_lock;
83
uint32_t current_tablenr;
86
BACKUPS_AVAIL = (1U << 0) /* There are backups available */
90
Flags with information about the open tables state.
95
This constructor serves for creation of Open_tables_state instances
96
which are used as backup storage.
98
Open_tables_state() : state_flags(0U) { }
100
Open_tables_state(ulong version_arg);
102
void set_open_tables_state(Open_tables_state *state)
107
void reset_open_tables_state()
109
open_tables= temporary_tables= handler_tables= derived_tables= 0;
110
extra_lock= lock= locked_tables= 0;
115
#endif /* DRIZZLED_OPEN_TABLES_STATE_H */