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 |
*
|
|
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.
|
851
by Brian Aker
Class rewrite of Session (aka get all of the junk out) |
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 |
||
2234
by Brian Aker
Mass removal of ifdef/endif in favor of pragma once. |
20 |
#pragma once
|
851
by Brian Aker
Class rewrite of Session (aka get all of the junk out) |
21 |
|
2263.3.5
by Olaf van der Spek
Refactor Open_tables_state |
22 |
#include <drizzled/common_fwd.h> |
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
23 |
#include <drizzled/lock.h> |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
24 |
|
2239.1.3
by Olaf van der Spek
Refactor includes |
25 |
namespace drizzled { |
26 |
||
2263.3.5
by Olaf van der Spek
Refactor Open_tables_state |
27 |
extern uint64_t g_refresh_version; |
28 |
||
851
by Brian Aker
Class rewrite of Session (aka get all of the junk out) |
29 |
/**
|
30 |
Class that holds information about tables which were opened and locked
|
|
2263.3.4
by Olaf van der Spek
Prefix global refresh_version |
31 |
by the thread.
|
851
by Brian Aker
Class rewrite of Session (aka get all of the junk out) |
32 |
*/
|
33 |
||
34 |
class Open_tables_state |
|
35 |
{
|
|
36 |
public: |
|
37 |
/**
|
|
38 |
List of regular tables in use by this thread. Contains temporary and
|
|
39 |
base tables that were opened with @see open_tables().
|
|
40 |
*/
|
|
2263.3.1
by Olaf van der Spek
Rename Open_tables_state::open_tables |
41 |
Table *open_tables_; |
1877.2.16
by Brian Aker
Fix dangling headers. |
42 |
|
851
by Brian Aker
Class rewrite of Session (aka get all of the junk out) |
43 |
/**
|
44 |
List of temporary tables used by this thread. Contains user-level
|
|
45 |
temporary tables, created with CREATE TEMPORARY TABLE, and
|
|
46 |
internal temporary tables, created, e.g., to resolve a SELECT,
|
|
47 |
or for an intermediate table used in ALTER.
|
|
48 |
XXX Why are internal temporary tables added to this list?
|
|
49 |
*/
|
|
50 |
Table *temporary_tables; |
|
2041.3.2
by Brian Aker
Improve on drop schema temp tables. |
51 |
|
1923.1.2
by Brian Aker
Encapsulate temporary tables. |
52 |
Table *getTemporaryTables() |
53 |
{
|
|
54 |
return temporary_tables; |
|
55 |
}
|
|
1046.1.6
by Brian Aker
Formatting/style cleanup. |
56 |
|
1922.1.1
by Brian Aker
Move temp tables down to open_table class. (first pass) |
57 |
/**
|
58 |
Mark all temporary tables which were used by the current statement or
|
|
59 |
substatement as free for reuse, but only if the query_id can be cleared.
|
|
60 |
||
61 |
@param session thread context
|
|
62 |
||
63 |
@remark For temp tables associated with a open SQL HANDLER the query_id
|
|
64 |
is not reset until the HANDLER is closed.
|
|
65 |
*/
|
|
66 |
void mark_temp_tables_as_free_for_reuse(); |
|
2263.3.7
by Olaf van der Spek
Keep functions in Open_tables_state |
67 |
void close_temporary_tables(); |
68 |
void close_temporary_table(Table*); |
|
69 |
void nukeTable(Table*); |
|
2280.1.10
by Olaf van der Spek
Remove unused param |
70 |
void close_open_tables(); |
2280.1.8
by Olaf van der Spek
Refactor |
71 |
bool free_cached_table(); |
1922.1.1
by Brian Aker
Move temp tables down to open_table class. (first pass) |
72 |
|
73 |
/* Work with temporary tables */
|
|
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
74 |
Table *find_temporary_table(const identifier::Table &identifier); |
1922.1.1
by Brian Aker
Move temp tables down to open_table class. (first pass) |
75 |
|
76 |
void dumpTemporaryTableNames(const char *id); |
|
2263.3.7
by Olaf van der Spek
Keep functions in Open_tables_state |
77 |
int drop_temporary_table(const identifier::Table&); |
78 |
bool rm_temporary_table(plugin::StorageEngine&, const identifier::Table&); |
|
79 |
bool rm_temporary_table(const identifier::Table &identifier, bool best_effort= false); |
|
1922.1.1
by Brian Aker
Move temp tables down to open_table class. (first pass) |
80 |
|
1923.1.3
by Brian Aker
Encapsulate derived tables |
81 |
private: |
851
by Brian Aker
Class rewrite of Session (aka get all of the junk out) |
82 |
Table *derived_tables; |
1923.1.3
by Brian Aker
Encapsulate derived tables |
83 |
public: |
84 |
||
85 |
||
86 |
Table *getDerivedTables() |
|
87 |
{
|
|
88 |
return derived_tables; |
|
89 |
}
|
|
90 |
||
91 |
void setDerivedTables(Table *arg) |
|
92 |
{
|
|
93 |
derived_tables= arg; |
|
94 |
}
|
|
95 |
||
96 |
void clearDerivedTables() |
|
97 |
{
|
|
2263.3.4
by Olaf van der Spek
Prefix global refresh_version |
98 |
derived_tables= NULL; // They should all be invalid by this point |
1923.1.3
by Brian Aker
Encapsulate derived tables |
99 |
}
|
100 |
||
851
by Brian Aker
Class rewrite of Session (aka get all of the junk out) |
101 |
/*
|
102 |
During a MySQL session, one can lock tables in two modes: automatic
|
|
103 |
or manual. In automatic mode all necessary tables are locked just before
|
|
104 |
statement execution, and all acquired locks are stored in 'lock'
|
|
105 |
member. Unlocking takes place automatically as well, when the
|
|
106 |
statement ends.
|
|
107 |
Manual mode comes into play when a user issues a 'LOCK TABLES'
|
|
108 |
statement. In this mode the user can only use the locked tables.
|
|
109 |
Trying to use any other tables will give an error. The locked tables are
|
|
110 |
stored in 'locked_tables' member. Manual locking is described in
|
|
111 |
the 'LOCK_TABLES' chapter of the MySQL manual.
|
|
112 |
See also lock_tables() for details.
|
|
113 |
*/
|
|
1711.6.1
by Brian Aker
Style on structure cleanup |
114 |
DrizzleLock *lock; |
851
by Brian Aker
Class rewrite of Session (aka get all of the junk out) |
115 |
|
116 |
/*
|
|
117 |
CREATE-SELECT keeps an extra lock for the table being
|
|
118 |
created. This field is used to keep the extra lock available for
|
|
119 |
lower level routines, which would otherwise miss that lock.
|
|
120 |
*/
|
|
1711.6.1
by Brian Aker
Style on structure cleanup |
121 |
DrizzleLock *extra_lock; |
851
by Brian Aker
Class rewrite of Session (aka get all of the junk out) |
122 |
|
1223.2.1
by Trond Norbye
Bug #485658: Compile failure on 32 bit system due to mixing ulong, uint64_t and uint32_t |
123 |
uint64_t version; |
851
by Brian Aker
Class rewrite of Session (aka get all of the junk out) |
124 |
uint32_t current_tablenr; |
125 |
||
2263.3.9
by Olaf van der Spek
Open Tables |
126 |
Open_tables_state(Session&, uint64_t version_arg); |
2263.3.1
by Olaf van der Spek
Rename Open_tables_state::open_tables |
127 |
void doGetTableNames(CachedDirectory&, const identifier::Schema&, std::set<std::string>&); |
128 |
void doGetTableNames(const identifier::Schema&, std::set<std::string>&); |
|
129 |
void doGetTableIdentifiers(CachedDirectory&, const identifier::Schema&, identifier::table::vector&); |
|
130 |
void doGetTableIdentifiers(const identifier::Schema&, identifier::table::vector&); |
|
131 |
int doGetTableDefinition(const drizzled::identifier::Table&, message::Table&); |
|
132 |
bool doDoesTableExist(const drizzled::identifier::Table&); |
|
2263.3.9
by Olaf van der Spek
Open Tables |
133 |
private: |
134 |
Session& session_; |
|
851
by Brian Aker
Class rewrite of Session (aka get all of the junk out) |
135 |
};
|
136 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
137 |
} /* namespace drizzled */ |
138 |