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

#include <table_list.h>

Collaboration diagram for drizzled::TableList:
[legend]

Public Member Functions

const char * getSchemaName () const
void setSchemaName (const char *v)
const char * getTableName () const
void setTableName (const char *v)
bool isCartesian () const
void set_underlying_merge ()
bool setup_underlying (Session *session)
bool placeholder ()
void print (Session *session, String *str)
void set_insert_values ()
TableList * find_underlying_table (Table *table)
TableList * first_leaf_for_name_resolution ()
TableList * last_leaf_for_name_resolution ()
bool is_leaf_for_name_resolution () const
TableList * top_table ()
Item_subselect * containing_subselect ()
bool process_index_hints (Table *table)
void setIsAlias (bool in_is_alias)
void setIsFqtn (bool in_is_fqtn)
void setCreate (bool in_create)
void setInternalTmpTable (bool in_internal_tmp_table)
void setDbType (plugin::StorageEngine *in_db_type)
void setJoinList (List< TableList > *in_join_list)
void setEmbedding (TableList *in_embedding)
void setNestedJoin (NestedJoin *in_nested_join)
void setDepTables (table_map in_dep_tables)
void setOnExprDepTables (table_map in_on_expr_dep_tables)
bool getIsAlias () const
bool getIsFqtn () const
bool isCreate () const
bool getInternalTmpTable () const
plugin::StorageEngine * getDbType () const
TableList * getEmbedding () const
List< TableList > * getJoinList () const
NestedJoin * getNestedJoin () const
table_map getDepTables () const
table_map getOnExprDepTables () const
void unlock_table_name ()
void unlock_table_names (TableList *last_table=NULL)

Public Attributes

TableList * next_local
TableList * next_global
TableList ** prev_global
const char * alias
const char * option
 Used by cache index.
Item * on_expr
 Used with outer join.
Table * table
 opened table
Item * prep_on_expr
COND_EQUAL * cond_equal
 Used with outer join.
TableList * natural_join
bool is_natural_join
bool is_join_columns_complete
bool straight
 optimize with prev table
bool force_index
 prefer index over table scan
bool ignore_leaves
 preload only non-leaf nodes
List< String > * join_using_fields
List< Natural_join_column > * join_columns
TableList * next_name_resolution_table
List< Index_hint > * index_hints
select_union * derived_result
Select_Lex_Unit * derived
 Select_Lex_Unit of derived table *‍/.
Select_Lex * schema_select_lex
Select_Lex * select_lex
TableList * next_leaf
thr_lock_type lock_type
uint32_t outer_join
 Which join type.

Private Attributes

const char * schema
const char * table_name
table_map dep_tables
 tables the table depends on
table_map on_expr_dep_tables
 tables on expression depends on
NestedJoin * nested_join
 if the element is a nested join
TableList * embedding
 nested join containing the table
List< TableList > * join_list
 join list the table belongs to
plugin::StorageEngine * db_type
 table_type for handler
bool internal_tmp_table
bool is_alias
bool is_fqtn
bool create

Friends

std::ostream & operator<< (std::ostream &output, const TableList &list)

Detailed Description

A Table referenced in the FROM clause.

These table references can be of several types that correspond to different SQL elements. Below we list all types of TableLists with the necessary conditions to determine when a TableList instance belongs to a certain type.

1) table (TableList::view == NULL)

Note

for schema tables TableList::field_translation may be != NULL

2) Was VIEW 3) nested table reference (TableList::nested_join != NULL)

  • table sequence - e.g. (t1, t2, t3)
    Todo
    how to distinguish from a JOIN?

Definition at line 58 of file table_list.h.

Constructor & Destructor Documentation

◆ TableList()

drizzled::TableList::TableList ( )
inline

Definition at line 61 of file table_list.h.

Member Function Documentation

◆ containing_subselect()

Item_subselect * drizzled::TableList::containing_subselect ( )

Return subselect that contains the FROM list this table is taken from

Return values
Subselectitem for the subquery that contains the FROM list this table is taken from if there is any
NULLotherwise

Definition at line 140 of file table_list.cc.

◆ find_underlying_table()

TableList * drizzled::TableList::find_underlying_table ( Table * table)

Find underlying base tables (TableList) which represent given table_to_find (Table)

Parameters
[in]tableto find
Return values
NULLif table is not found
Pointerto found table reference

Definition at line 45 of file table_list.cc.

◆ first_leaf_for_name_resolution()

TableList * drizzled::TableList::first_leaf_for_name_resolution ( )

Retrieve the first (left-most) leaf in a nested join tree with respect to name resolution.

Given that 'this' is a nested table reference, recursively walk down the left-most children of 'this' until we reach a leaf table reference with respect to name resolution.

Return values
If'this' is a nested table reference - the left-most child of the tree rooted in 'this', else return 'this'

Definition at line 107 of file table_list.cc.

◆ getDbType()

plugin::StorageEngine * drizzled::TableList::getDbType ( ) const
inline

Definition at line 469 of file table_list.h.

◆ getDepTables()

table_map drizzled::TableList::getDepTables ( ) const
inline

Definition at line 489 of file table_list.h.

◆ getEmbedding()

TableList * drizzled::TableList::getEmbedding ( ) const
inline

Definition at line 474 of file table_list.h.

◆ getInternalTmpTable()

bool drizzled::TableList::getInternalTmpTable ( ) const
inline

Definition at line 464 of file table_list.h.

◆ getIsAlias()

bool drizzled::TableList::getIsAlias ( ) const
inline

Definition at line 449 of file table_list.h.

◆ getIsFqtn()

bool drizzled::TableList::getIsFqtn ( ) const
inline

Definition at line 454 of file table_list.h.

◆ getJoinList()

List< TableList > * drizzled::TableList::getJoinList ( ) const
inline

Definition at line 479 of file table_list.h.

◆ getNestedJoin()

NestedJoin * drizzled::TableList::getNestedJoin ( ) const
inline

Definition at line 484 of file table_list.h.

◆ getOnExprDepTables()

table_map drizzled::TableList::getOnExprDepTables ( ) const
inline

Definition at line 494 of file table_list.h.

◆ getSchemaName()

const char * drizzled::TableList::getSchemaName ( ) const
inline

Definition at line 117 of file table_list.h.

◆ getTableName()

const char * drizzled::TableList::getTableName ( ) const
inline

Definition at line 133 of file table_list.h.

◆ is_leaf_for_name_resolution()

bool drizzled::TableList::is_leaf_for_name_resolution ( ) const

Test if this is a leaf with respect to name resolution.

A table reference is a leaf with respect to name resolution if it is either a leaf node in a nested join tree (table, view, schema table, subquery), or an inner node that represents a NATURAL/USING join, or a nested join with materialized join columns.

Return values
trueif a leaf, false otherwise.

Definition at line 40 of file table_list.cc.

◆ isCartesian()

bool drizzled::TableList::isCartesian ( ) const

Definition at line 54 of file table_list.cc.

◆ isCreate()

bool drizzled::TableList::isCreate ( ) const
inline

Definition at line 459 of file table_list.h.

◆ last_leaf_for_name_resolution()

TableList * drizzled::TableList::last_leaf_for_name_resolution ( )

Retrieve the last (right-most) leaf in a nested join tree with respect to name resolution.

Given that 'this' is a nested table reference, recursively walk down the right-most children of 'this' until we reach a leaf table reference with respect to name resolution.

Return values
If'this' is a nested table reference - the right-most child of the tree rooted in 'this', else 'this'

Definition at line 69 of file table_list.cc.

◆ placeholder()

bool drizzled::TableList::placeholder ( )

If you change placeholder(), please check the condition in check_transactional_lock() too.

Definition at line 59 of file table_list.cc.

◆ print()

void drizzled::TableList::print ( Session * session,
String * str )

Print table as it should be in join list.

Parameters
strstring where table should be printed

Definition at line 254 of file table_list.cc.

◆ process_index_hints()

bool drizzled::TableList::process_index_hints ( Table * table)

Compiles the tagged hints list and fills up st_table::keys_in_use_for_query, st_table::keys_in_use_for_group_by, st_table::keys_in_use_for_order_by, st_table::force_index and st_table::covering_keys.

Parameters
theTable to operate on.

The parser collects the index hints for each table in a "tagged list" (TableList::index_hints). Using the information in this tagged list this function sets the members Table::keys_in_use_for_query, Table::keys_in_use_for_group_by, Table::keys_in_use_for_order_by, Table::force_index and Table::covering_keys.

Current implementation of the runtime does not allow mixing FORCE INDEX and USE INDEX, so this is checked here. Then the FORCE INDEX list (if non-empty) is appended to the USE INDEX list and a flag is set.

Multiple hints of the same kind are processed so that each clause is applied to what is computed in the previous clause.

For example: USE INDEX (i1) USE INDEX (i2) is equivalent to USE INDEX (i1,i2) and means "consider only i1 and i2".

Similarly USE INDEX () USE INDEX (i1) is equivalent to USE INDEX (i1) and means "consider only the index i1"

It is OK to have the same index several times, e.g. "USE INDEX (i1,i1)" is not an error.

Different kind of hints (USE/FORCE/IGNORE) are processed in the following order:

  1. All indexes in USE (or FORCE) INDEX are added to the mask.
  2. All IGNORE INDEX e.g. "USE INDEX i1, IGNORE INDEX i1, USE INDEX i1" will not use i1 at all as if we had "USE INDEX i1, USE INDEX i1, IGNORE INDEX i1". As an optimization if there is a covering index, and we have IGNORE INDEX FOR GROUP/order_st, and this index is used for the JOIN part, then we have to ignore the IGNORE INDEX FROM GROUP/order_st.
Return values
falseno errors found
truefound and reported an error.

Definition at line 145 of file table_list.cc.

◆ set_insert_values()

void drizzled::TableList::set_insert_values ( )

Sets insert_values buffer

Parameters
[in]memorypool for allocating
Return values
false- OK
true- out of memory

Definition at line 32 of file table_list.cc.

◆ setCreate()

void drizzled::TableList::setCreate ( bool in_create)
inline

Definition at line 409 of file table_list.h.

◆ setDbType()

void drizzled::TableList::setDbType ( plugin::StorageEngine * in_db_type)
inline

Definition at line 419 of file table_list.h.

◆ setDepTables()

void drizzled::TableList::setDepTables ( table_map in_dep_tables)
inline

Definition at line 439 of file table_list.h.

◆ setEmbedding()

void drizzled::TableList::setEmbedding ( TableList * in_embedding)
inline

Definition at line 429 of file table_list.h.

◆ setInternalTmpTable()

void drizzled::TableList::setInternalTmpTable ( bool in_internal_tmp_table)
inline

Definition at line 414 of file table_list.h.

◆ setIsAlias()

void drizzled::TableList::setIsAlias ( bool in_is_alias)
inline

Definition at line 399 of file table_list.h.

◆ setIsFqtn()

void drizzled::TableList::setIsFqtn ( bool in_is_fqtn)
inline

Definition at line 404 of file table_list.h.

◆ setJoinList()

void drizzled::TableList::setJoinList ( List< TableList > * in_join_list)
inline

Definition at line 424 of file table_list.h.

◆ setNestedJoin()

void drizzled::TableList::setNestedJoin ( NestedJoin * in_nested_join)
inline

Definition at line 434 of file table_list.h.

◆ setOnExprDepTables()

void drizzled::TableList::setOnExprDepTables ( table_map in_on_expr_dep_tables)
inline

Definition at line 444 of file table_list.h.

◆ setSchemaName()

void drizzled::TableList::setSchemaName ( const char * v)
inline

Definition at line 122 of file table_list.h.

◆ setTableName()

void drizzled::TableList::setTableName ( const char * v)
inline

Definition at line 138 of file table_list.h.

◆ top_table()

TableList * drizzled::TableList::top_table ( )
inline

Definition at line 302 of file table_list.h.

◆ operator<<

std::ostream & operator<< ( std::ostream & output,
const TableList & list )
friend

Definition at line 370 of file table_list.h.

Member Data Documentation

◆ alias

const char* drizzled::TableList::alias

Definition at line 127 of file table_list.h.

◆ cond_equal

COND_EQUAL* drizzled::TableList::cond_equal

Used with outer join.

Definition at line 155 of file table_list.h.

◆ create

bool drizzled::TableList::create
private

This TableList object corresponds to the table to be created so it is possible that it does not exist (used in CREATE TABLE ... SELECT implementation).

Definition at line 525 of file table_list.h.

◆ db_type

plugin::StorageEngine* drizzled::TableList::db_type
private

table_type for handler

Definition at line 508 of file table_list.h.

◆ dep_tables

table_map drizzled::TableList::dep_tables
private

tables the table depends on

Definition at line 503 of file table_list.h.

◆ derived

Select_Lex_Unit* drizzled::TableList::derived

Select_Lex_Unit of derived table *‍/.

Definition at line 205 of file table_list.h.

◆ derived_result

select_union* drizzled::TableList::derived_result

select_result for derived table to pass it from table creation to table filling procedure

Definition at line 204 of file table_list.h.

◆ embedding

TableList* drizzled::TableList::embedding
private

nested join containing the table

Definition at line 506 of file table_list.h.

◆ force_index

bool drizzled::TableList::force_index

prefer index over table scan

Definition at line 174 of file table_list.h.

◆ ignore_leaves

bool drizzled::TableList::ignore_leaves

preload only non-leaf nodes

Definition at line 175 of file table_list.h.

◆ index_hints

List<Index_hint>* drizzled::TableList::index_hints

Index names in a "... JOIN ... USE/IGNORE INDEX ..." clause.

Definition at line 199 of file table_list.h.

◆ internal_tmp_table

bool drizzled::TableList::internal_tmp_table
private

Definition at line 509 of file table_list.h.

◆ is_alias

bool drizzled::TableList::is_alias
private

true if an alias for this table was specified in the SQL.

Definition at line 512 of file table_list.h.

◆ is_fqtn

bool drizzled::TableList::is_fqtn
private

true if the table is referred to in the statement using a fully qualified name (<db_name>.<table_name>).

Definition at line 518 of file table_list.h.

◆ is_join_columns_complete

bool drizzled::TableList::is_join_columns_complete

true if join_columns contains all columns of this table reference.

Definition at line 171 of file table_list.h.

◆ is_natural_join

bool drizzled::TableList::is_natural_join

True if 'this' represents a nested join that is a NATURAL JOIN. For one of the operands of 'this', the member 'natural_join' points to the other operand of 'this'.

Definition at line 168 of file table_list.h.

◆ join_columns

List<Natural_join_column>* drizzled::TableList::join_columns

Explicitly store the result columns of either a NATURAL/USING join or an operand of such a join.

Definition at line 188 of file table_list.h.

◆ join_list

List<TableList>* drizzled::TableList::join_list
private

join list the table belongs to

Definition at line 507 of file table_list.h.

◆ join_using_fields

List<String>* drizzled::TableList::join_using_fields

Field names in a USING clause for JOIN ... USING.

Definition at line 183 of file table_list.h.

◆ lock_type

thr_lock_type drizzled::TableList::lock_type

Definition at line 215 of file table_list.h.

◆ natural_join

TableList* drizzled::TableList::natural_join

During parsing - left operand of NATURAL/USING join where 'this' is the right operand. After parsing (this->natural_join == this) iff 'this' represents a NATURAL or USING join operation. Thus after parsing 'this' is a NATURAL/USING join iff (natural_join != NULL).

Definition at line 162 of file table_list.h.

◆ nested_join

NestedJoin* drizzled::TableList::nested_join
private

if the element is a nested join

Definition at line 505 of file table_list.h.

◆ next_global

TableList* drizzled::TableList::next_global

link in a global list of all queries tables

Definition at line 110 of file table_list.h.

◆ next_leaf

TableList* drizzled::TableList::next_leaf

List of all base tables local to a subquery including all view tables. Unlike 'next_local', this in this list views are not leaves. Created in setup_tables() -> make_leaves_list().

Definition at line 214 of file table_list.h.

◆ next_local

TableList* drizzled::TableList::next_local

List of tables local to a subquery (used by SQL_LIST). Considers views as leaves (unlike 'next_leaf' below). Created at parse time in Select_Lex::add_table_to_list() -> table_list.link_in_list().

Definition at line 107 of file table_list.h.

◆ next_name_resolution_table

TableList* drizzled::TableList::next_name_resolution_table

List of nodes in a nested join tree, that should be considered as leaves with respect to name resolution. The leaves are: views, top-most nodes representing NATURAL/USING joins, subqueries, and base tables. All of these TableList instances contain a materialized list of columns. The list is local to a subquery.

Definition at line 197 of file table_list.h.

◆ on_expr

Item* drizzled::TableList::on_expr

Used with outer join.

Definition at line 144 of file table_list.h.

◆ on_expr_dep_tables

table_map drizzled::TableList::on_expr_dep_tables
private

tables on expression depends on

Definition at line 504 of file table_list.h.

◆ option

const char* drizzled::TableList::option

Used by cache index.

Definition at line 143 of file table_list.h.

◆ outer_join

uint32_t drizzled::TableList::outer_join

Which join type.

Definition at line 216 of file table_list.h.

◆ prep_on_expr

Item* drizzled::TableList::prep_on_expr

The structure of ON expression presented in the member above can be changed during certain optimizations. This member contains a snapshot of AND-OR structure of the ON expression made after permanent transformations of the parse tree, and is used to restore ON clause before every reexecution of a prepared statement or stored procedure.

Definition at line 154 of file table_list.h.

◆ prev_global

TableList** drizzled::TableList::prev_global

Definition at line 111 of file table_list.h.

◆ schema

const char* drizzled::TableList::schema
private

Definition at line 114 of file table_list.h.

◆ schema_select_lex

Select_Lex* drizzled::TableList::schema_select_lex

Definition at line 206 of file table_list.h.

◆ select_lex

Select_Lex* drizzled::TableList::select_lex

link to select_lex where this table was used

Definition at line 208 of file table_list.h.

◆ straight

bool drizzled::TableList::straight

optimize with prev table

Definition at line 173 of file table_list.h.

◆ table

Table* drizzled::TableList::table

opened table

Definition at line 145 of file table_list.h.

◆ table_name

const char* drizzled::TableList::table_name
private

Definition at line 130 of file table_list.h.


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