Drizzled Public API Documentation

open_tables_state.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, Inc.
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 #pragma once
21 
22 #include <drizzled/common_fwd.h>
23 #include <drizzled/lock.h>
24 
25 namespace drizzled {
26 
27 extern uint64_t g_refresh_version;
28 
35 {
36 public:
42 
51 
52  Table *getTemporaryTables()
53  {
54  return temporary_tables;
55  }
56 
67  void close_temporary_tables();
68  void close_temporary_table(Table*);
69  void nukeTable(Table*);
70  void close_open_tables();
71  bool free_cached_table();
72 
73  /* Work with temporary tables */
74  Table *find_temporary_table(const identifier::Table &identifier);
75 
76  void dumpTemporaryTableNames(const char *id);
78  bool rm_temporary_table(plugin::StorageEngine&, const identifier::Table&);
79  bool rm_temporary_table(const identifier::Table &identifier, bool best_effort= false);
80 
81 private:
82  Table *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  {
98  derived_tables= NULL; // They should all be invalid by this point
99  }
100 
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  */
114  DrizzleLock *lock;
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  */
121  DrizzleLock *extra_lock;
122 
123  uint64_t version;
124  uint32_t current_tablenr;
125 
126  Open_tables_state(Session&, uint64_t version_arg);
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&);
133 private:
134  Session& session_;
135 };
136 
137 } /* namespace drizzled */
138 
TODO: Rename this file - func.h is stupid.
int drop_temporary_table(const identifier::Table &)
Definition: sql_base.cc:564
void mark_temp_tables_as_free_for_reuse()
Definition: session.cc:1693