675
677
const char* table_name;
676
678
ST_FIELD_INFO *fields_info;
677
679
/* Create information_schema table */
678
Table *(*create_table) (THD *thd, TABLE_LIST *table_list);
680
Table *(*create_table) (THD *thd, TableList *table_list);
679
681
/* Fill table with data */
680
int (*fill_table) (THD *thd, TABLE_LIST *tables, COND *cond);
682
int (*fill_table) (THD *thd, TableList *tables, COND *cond);
681
683
/* Handle fileds for old SHOW */
682
684
int (*old_format) (THD *thd, struct ST_SCHEMA_TABLE *schema_table);
683
int (*process_table) (THD *thd, TABLE_LIST *tables, Table *table,
685
int (*process_table) (THD *thd, TableList *tables, Table *table,
684
686
bool res, LEX_STRING *db_name, LEX_STRING *table_name);
685
687
int idx_field1, idx_field2;
709
Column reference of a NATURAL/USING join. Since column references in
710
joins can be both from views and stored tables, may point to either a
711
Field (for tables), or a Field_translator (for views).
714
class Natural_join_column: public Sql_alloc
717
Field_translator *view_field; /* Column reference of merge view. */
718
Field *table_field; /* Column reference of table or temp view. */
719
TABLE_LIST *table_ref; /* Original base table/view reference. */
721
True if a common join column of two NATURAL/USING join operands. Notice
722
that when we have a hierarchy of nested NATURAL/USING joins, a column can
723
be common at some level of nesting but it may not be common at higher
724
levels of nesting. Thus this flag may change depending on at which level
725
we are looking at some column.
729
Natural_join_column(Field_translator *field_param, TABLE_LIST *tab);
730
Natural_join_column(Field *field_param, TABLE_LIST *tab);
732
Item *create_item(THD *thd);
734
const char *table_name();
735
const char *db_name();
740
711
Table reference in the FROM clause.
742
713
These table references can be of several types that correspond to
743
different SQL elements. Below we list all types of TABLE_LISTs with
744
the necessary conditions to determine when a TABLE_LIST instance
714
different SQL elements. Below we list all types of TableLists with
715
the necessary conditions to determine when a TableList instance
745
716
belongs to a certain type.
747
1) table (TABLE_LIST::view == NULL)
718
1) table (TableList::view == NULL)
749
(TABLE_LIST::derived == NULL)
750
- subquery - TABLE_LIST::table is a temp table
751
(TABLE_LIST::derived != NULL)
720
(TableList::derived == NULL)
721
- subquery - TableList::table is a temp table
722
(TableList::derived != NULL)
752
723
- information schema table
753
(TABLE_LIST::schema_table != NULL)
754
NOTICE: for schema tables TABLE_LIST::field_translation may be != NULL
755
2) view (TABLE_LIST::view != NULL)
756
- merge (TABLE_LIST::effective_algorithm == VIEW_ALGORITHM_MERGE)
757
also (TABLE_LIST::field_translation != NULL)
758
- tmptable (TABLE_LIST::effective_algorithm == VIEW_ALGORITHM_TMPTABLE)
759
also (TABLE_LIST::field_translation == NULL)
760
3) nested table reference (TABLE_LIST::nested_join != NULL)
724
(TableList::schema_table != NULL)
725
NOTICE: for schema tables TableList::field_translation may be != NULL
726
2) view (TableList::view != NULL)
727
- merge (TableList::effective_algorithm == VIEW_ALGORITHM_MERGE)
728
also (TableList::field_translation != NULL)
729
- tmptable (TableList::effective_algorithm == VIEW_ALGORITHM_TMPTABLE)
730
also (TableList::field_translation == NULL)
731
3) nested table reference (TableList::nested_join != NULL)
761
732
- table sequence - e.g. (t1, t2, t3)
762
733
TODO: how to distinguish from a JOIN?
764
735
TODO: how to distinguish from a table sequence?
766
(TABLE_LIST::natural_join != NULL)
737
(TableList::natural_join != NULL)
768
(TABLE_LIST::join_using_fields != NULL)
739
(TableList::join_using_fields != NULL)
867
838
The implementation assumes that all underlying NATURAL/USING table
868
839
references already contain their result columns and are linked into
869
the list TABLE_LIST::next_name_resolution_table.
840
the list TableList::next_name_resolution_table.
872
843
class Field_iterator_table_ref: public Field_iterator
874
TABLE_LIST *table_ref, *first_leaf, *last_leaf;
845
TableList *table_ref, *first_leaf, *last_leaf;
875
846
Field_iterator_table table_field_it;
876
847
Field_iterator_view view_field_it;
877
848
Field_iterator_natural_join natural_join_it;
888
859
const char *db_name();
889
860
Item *create_item(THD *thd) { return field_it->create_item(thd); }
890
861
Field *field() { return field_it->field(); }
891
Natural_join_column *get_or_create_column_ref(TABLE_LIST *parent_table_ref);
862
Natural_join_column *get_or_create_column_ref(TableList *parent_table_ref);
892
863
Natural_join_column *get_natural_column_ref();
896
typedef struct st_nested_join
898
List<TABLE_LIST> join_list; /* list of elements in the nested join */
899
table_map used_tables; /* bitmap of tables in the nested join */
900
table_map not_null_tables; /* tables that rejects nulls */
901
struct st_join_table *first_nested;/* the first nested table in the plan */
903
Used to count tables in the nested join in 2 isolated places:
904
1. In make_outerjoin_info().
905
2. check_interleaving_with_nj/restore_prev_nj_state (these are called
906
by the join optimizer.
907
Before each use the counters are zeroed by reset_nj_counters.
910
nested_join_map nj_map; /* Bit used to identify this nested join*/
912
(Valid only for semi-join nests) Bitmap of tables outside the semi-join
913
that are used within the semi-join's ON condition.
915
table_map sj_depends_on;
916
/* Outer non-trivially correlated tables */
917
table_map sj_corr_tables;
918
List<Item> sj_outer_expr_list;
922
867
typedef struct st_changed_table_list
924
869
struct st_changed_table_list *next;
926
871
uint32_t key_length;
927
} CHANGED_TABLE_LIST;
930
875
typedef struct st_open_table_list{
931
876
struct st_open_table_list *next;
933
878
uint32_t in_use,locked;