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 |
||
24 |
||
25 |
/**
|
|
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().
|
|
29 |
*/
|
|
30 |
||
31 |
class Open_tables_state |
|
32 |
{
|
|
33 |
public: |
|
34 |
/**
|
|
35 |
List of regular tables in use by this thread. Contains temporary and
|
|
36 |
base tables that were opened with @see open_tables().
|
|
37 |
*/
|
|
38 |
Table *open_tables; |
|
39 |
/**
|
|
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?
|
|
45 |
*/
|
|
46 |
Table *temporary_tables; |
|
1046.1.6
by Brian Aker
Formatting/style cleanup. |
47 |
|
851
by Brian Aker
Class rewrite of Session (aka get all of the junk out) |
48 |
Table *derived_tables; |
49 |
/*
|
|
50 |
During a MySQL session, one can lock tables in two modes: automatic
|
|
51 |
or manual. In automatic mode all necessary tables are locked just before
|
|
52 |
statement execution, and all acquired locks are stored in 'lock'
|
|
53 |
member. Unlocking takes place automatically as well, when the
|
|
54 |
statement ends.
|
|
55 |
Manual mode comes into play when a user issues a 'LOCK TABLES'
|
|
56 |
statement. In this mode the user can only use the locked tables.
|
|
57 |
Trying to use any other tables will give an error. The locked tables are
|
|
58 |
stored in 'locked_tables' member. Manual locking is described in
|
|
59 |
the 'LOCK_TABLES' chapter of the MySQL manual.
|
|
60 |
See also lock_tables() for details.
|
|
61 |
*/
|
|
62 |
DRIZZLE_LOCK *lock; |
|
63 |
||
64 |
/*
|
|
65 |
CREATE-SELECT keeps an extra lock for the table being
|
|
66 |
created. This field is used to keep the extra lock available for
|
|
67 |
lower level routines, which would otherwise miss that lock.
|
|
68 |
*/
|
|
69 |
DRIZZLE_LOCK *extra_lock; |
|
70 |
||
71 |
ulong version; |
|
72 |
uint32_t current_tablenr; |
|
73 |
||
74 |
/*
|
|
75 |
Flags with information about the open tables state.
|
|
76 |
*/
|
|
1089.1.6
by Brian Aker
Removed dead flag code, style cleanup in FK. Removed dead structs. |
77 |
bool backups_available; |
851
by Brian Aker
Class rewrite of Session (aka get all of the junk out) |
78 |
|
79 |
/*
|
|
80 |
This constructor serves for creation of Open_tables_state instances
|
|
81 |
which are used as backup storage.
|
|
82 |
*/
|
|
1089.1.6
by Brian Aker
Removed dead flag code, style cleanup in FK. Removed dead structs. |
83 |
Open_tables_state() : backups_available(false) { } |
851
by Brian Aker
Class rewrite of Session (aka get all of the junk out) |
84 |
|
85 |
Open_tables_state(ulong version_arg); |
|
86 |
||
87 |
void set_open_tables_state(Open_tables_state *state) |
|
88 |
{
|
|
89 |
*this= *state; |
|
90 |
}
|
|
91 |
||
92 |
void reset_open_tables_state() |
|
93 |
{
|
|
1046.1.6
by Brian Aker
Formatting/style cleanup. |
94 |
open_tables= temporary_tables= derived_tables= NULL; |
1054.1.8
by Brian Aker
Remove lock_tables list from session. |
95 |
extra_lock= lock= NULL; |
1089.1.6
by Brian Aker
Removed dead flag code, style cleanup in FK. Removed dead structs. |
96 |
backups_available= false; |
851
by Brian Aker
Class rewrite of Session (aka get all of the junk out) |
97 |
}
|
98 |
};
|
|
99 |
||
100 |
#endif /* DRIZZLED_OPEN_TABLES_STATE_H */ |