drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
drizzled::Open_tables_state Class Reference

#include <open_tables_state.h>

Collaboration diagram for drizzled::Open_tables_state:
[legend]

Public Member Functions

Table * getTemporaryTables ()
void mark_temp_tables_as_free_for_reuse ()
void close_temporary_tables ()
void close_temporary_table (Table *)
void nukeTable (Table *)
void close_open_tables ()
bool free_cached_table ()
Table * find_temporary_table (const identifier::Table &identifier)
void dumpTemporaryTableNames (const char *id)
int drop_temporary_table (const identifier::Table &)
bool rm_temporary_table (plugin::StorageEngine &, const identifier::Table &)
bool rm_temporary_table (const identifier::Table &identifier, bool best_effort=false)
Table * getDerivedTables ()
void setDerivedTables (Table *arg)
void clearDerivedTables ()
 Open_tables_state (Session &, uint64_t version_arg)
void doGetTableNames (CachedDirectory &, const identifier::Schema &, std::set< std::string > &)
void doGetTableNames (const identifier::Schema &, std::set< std::string > &)
void doGetTableIdentifiers (CachedDirectory &, const identifier::Schema &, identifier::table::vector &)
void doGetTableIdentifiers (const identifier::Schema &, identifier::table::vector &)
int doGetTableDefinition (const drizzled::identifier::Table &, message::Table &)
bool doDoesTableExist (const drizzled::identifier::Table &)

Public Attributes

Table * open_tables_
Table * temporary_tables
DrizzleLock * lock
DrizzleLock * extra_lock
uint64_t version
uint32_t current_tablenr

Private Attributes

Table * derived_tables
Session & session_

Detailed Description

Class that holds information about tables which were opened and locked by the thread.

Definition at line 34 of file open_tables_state.h.

Constructor & Destructor Documentation

◆ Open_tables_state()

drizzled::Open_tables_state::Open_tables_state ( Session & session,
uint64_t version_arg )

Definition at line 110 of file session.cc.

Member Function Documentation

◆ clearDerivedTables()

void drizzled::Open_tables_state::clearDerivedTables ( )
inline

Definition at line 96 of file open_tables_state.h.

◆ close_open_tables()

void drizzled::Open_tables_state::close_open_tables ( )

Auxiliary function to close all tables in the open_tables list.

Parameters
sessionThread context.
Remarks
It should not ordinarily be called directly.

Definition at line 301 of file sql_base.cc.

◆ close_temporary_table()

void drizzled::Open_tables_state::close_temporary_table ( Table * table)

Definition at line 1609 of file session.cc.

◆ close_temporary_tables()

void drizzled::Open_tables_state::close_temporary_tables ( )

Definition at line 1589 of file session.cc.

◆ doDoesTableExist()

bool drizzled::Open_tables_state::doDoesTableExist ( const drizzled::identifier::Table & identifier)

Definition at line 483 of file sql_base.cc.

◆ doGetTableDefinition()

int drizzled::Open_tables_state::doGetTableDefinition ( const drizzled::identifier::Table & identifier,
message::Table & table_proto )

Definition at line 499 of file sql_base.cc.

◆ doGetTableIdentifiers() [1/2]

void drizzled::Open_tables_state::doGetTableIdentifiers ( CachedDirectory & ,
const identifier::Schema & schema_identifier,
identifier::table::vector & set_of_identifiers )

Definition at line 476 of file sql_base.cc.

◆ doGetTableIdentifiers() [2/2]

void drizzled::Open_tables_state::doGetTableIdentifiers ( const identifier::Schema & schema_identifier,
identifier::table::vector & set_of_identifiers )

Definition at line 461 of file sql_base.cc.

◆ doGetTableNames() [1/2]

void drizzled::Open_tables_state::doGetTableNames ( CachedDirectory & ,
const identifier::Schema & schema_identifier,
std::set< std::string > & set_of_names )

Definition at line 454 of file sql_base.cc.

◆ doGetTableNames() [2/2]

void drizzled::Open_tables_state::doGetTableNames ( const identifier::Schema & schema_identifier,
std::set< std::string > & set_of_names )

Definition at line 442 of file sql_base.cc.

◆ drop_temporary_table()

int drizzled::Open_tables_state::drop_temporary_table ( const identifier::Table & identifier)

Drop a temporary table.

Try to locate the table in the list of session->temporary_tables. If the table is found:

  • if the table is being used by some outer statement, fail.
  • if the table is in session->locked_tables, unlock it and remove it from the list of locked tables. Currently only transactional temporary tables are present in the locked_tables list.
  • Close the temporary table, remove its .FRM
  • remove the table from the list of temporary tables

This function is used to drop user temporary tables, as well as internal tables created in CREATE TEMPORARY TABLE ... SELECT or ALTER Table. Even though part of the work done by this function is redundant when the table is internal, as long as we link both internal and user temporary tables into the same session->temporary_tables list, it's impossible to tell here whether we're dealing with an internal or a user temporary table.

Return values
0the table was found and dropped successfully.
1the table was not found in the list of temporary tables of this thread
-1the table is in use by a outer query

Definition at line 556 of file sql_base.cc.

◆ find_temporary_table()

Table * drizzled::Open_tables_state::find_temporary_table ( const identifier::Table & identifier)

Definition at line 518 of file sql_base.cc.

◆ free_cached_table()

bool drizzled::Open_tables_state::free_cached_table ( )

move one table to free list

Definition at line 262 of file sql_base.cc.

◆ getDerivedTables()

Table * drizzled::Open_tables_state::getDerivedTables ( )
inline

Definition at line 86 of file open_tables_state.h.

◆ getTemporaryTables()

Table * drizzled::Open_tables_state::getTemporaryTables ( )
inline

Definition at line 52 of file open_tables_state.h.

◆ mark_temp_tables_as_free_for_reuse()

void drizzled::Open_tables_state::mark_temp_tables_as_free_for_reuse ( )

Mark all temporary tables which were used by the current statement or substatement as free for reuse, but only if the query_id can be cleared.

Parameters
sessionthread context
Remarks
For temp tables associated with a open SQL HANDLER the query_id is not reset until the HANDLER is closed.

Definition at line 1700 of file session.cc.

◆ nukeTable()

void drizzled::Open_tables_state::nukeTable ( Table * table)

Definition at line 1645 of file session.cc.

◆ rm_temporary_table() [1/2]

bool drizzled::Open_tables_state::rm_temporary_table ( const identifier::Table & identifier,
bool best_effort = false )

Definition at line 1802 of file session.cc.

◆ rm_temporary_table() [2/2]

bool drizzled::Open_tables_state::rm_temporary_table ( plugin::StorageEngine & base,
const identifier::Table & identifier )

Definition at line 1811 of file session.cc.

◆ setDerivedTables()

void drizzled::Open_tables_state::setDerivedTables ( Table * arg)
inline

Definition at line 91 of file open_tables_state.h.

Member Data Documentation

◆ current_tablenr

uint32_t drizzled::Open_tables_state::current_tablenr

Definition at line 124 of file open_tables_state.h.

◆ derived_tables

Table* drizzled::Open_tables_state::derived_tables
private

Definition at line 82 of file open_tables_state.h.

◆ extra_lock

DrizzleLock* drizzled::Open_tables_state::extra_lock

Definition at line 121 of file open_tables_state.h.

◆ lock

DrizzleLock* drizzled::Open_tables_state::lock

Definition at line 114 of file open_tables_state.h.

◆ open_tables_

Table* drizzled::Open_tables_state::open_tables_

List of regular tables in use by this thread. Contains temporary and base tables that were opened with

See also
open_tables().

Definition at line 41 of file open_tables_state.h.

◆ session_

Session& drizzled::Open_tables_state::session_
private

Definition at line 134 of file open_tables_state.h.

◆ temporary_tables

Table* drizzled::Open_tables_state::temporary_tables

List of temporary tables used by this thread. Contains user-level temporary tables, created with CREATE TEMPORARY TABLE, and internal temporary tables, created, e.g., to resolve a SELECT, or for an intermediate table used in ALTER. XXX Why are internal temporary tables added to this list?

Definition at line 50 of file open_tables_state.h.

◆ version

uint64_t drizzled::Open_tables_state::version

Definition at line 123 of file open_tables_state.h.


The documentation for this class was generated from the following files: