struct TABLE
struct TABLE { TABLE() {} /* Remove gcc warning */ TABLE_SHARE *s; handler *file; TABLE *next, *prev; private: /** Links for the lists of used/unused TABLE objects for this share. Declared as private to avoid direct manipulation with those objects. One should use methods of I_P_List template instead. */ TABLE *share_next, **share_prev; friend struct TABLE_share; public: THD *in_use; /* Which thread uses this */ Field **field; /* Pointer to fields */ uchar *record[]; /* Pointer to records */ uchar *write_row_record; /* Used as optimisation in THD::write_row */ uchar *insert_values; /* used by INSERT ... UPDATE */ /* Map of keys that can be used to retrieve all data from this table needed by the query without reading the row. */ key_map covering_keys; key_map quick_keys, merge_keys; /* A set of keys that can be used in the query that references this table. All indexes disabled on the table's TABLE_SHARE (see TABLE::s) will be subtracted from this set upon instantiation. Thus for any TABLE t it holds that t.keys_in_use_for_query is a subset of t.s.keys_in_use. Generally we must not introduce any new keys here (see setup_tables). The set is implemented as a bitmap. */ key_map keys_in_use_for_query; /* Map of keys that can be used to calculate GROUP BY without sorting */ key_map keys_in_use_for_group_by; /* Map of keys that can be used to calculate ORDER BY without sorting */ key_map keys_in_use_for_order_by; KEY *key_info; /* data of keys in database */ Field *next_number_field; /* Set if next_number is activated */ Field *found_next_number_field; /* Set on open */ Field_timestamp *timestamp_field; /* Table's triggers, 0 if there are no of them */ Table_triggers_list *triggers; TABLE_LIST *pos_in_table_list;/* Element referring to this table */ /* Position in thd->locked_table_list under LOCK TABLES */ TABLE_LIST *pos_in_locked_tables; ORDER *group; const char *alias; /* alias or table name */ uchar *null_flags; my_bitmap_map *bitmap_init_value; MY_BITMAP def_read_set, def_write_set, tmp_set; /* containers */ MY_BITMAP *read_set, *write_set; /* Active column sets */ /* The ID of the query that opened and is using this table. Has different meanings depending on the table type. Temporary tables: table->query_id is set to thd->query_id for the duration of a statement and is reset to 0 once it is closed by the same statement. A non-zero table->query_id means that a statement is using the table even if it's not the current statement (table is in use by some outer statement). Non-temporary tables: Under pre-locked or LOCK TABLES mode: query_id is set to thd->query_id for the duration of a statement and is reset to 0 once it is closed by the same statement. A non-zero query_id is used to control which tables in the list of pre-opened and locked tables are actually being used. */ query_id_t query_id; /* For each key that has quick_keys.is_set(key) == TRUE: estimate of #records and max #key parts that range access would use. */ ha_rows quick_rows[MAX_KEY]; /* Bitmaps of key parts that =const for the entire join. */ key_part_map const_key_parts[MAX_KEY]; uint quick_key_parts[MAX_KEY]; uint quick_n_ranges[MAX_KEY]; /* Estimate of number of records that satisfy SARGable part of the table condition, or table->file->records if no SARGable condition could be constructed. This value is used by join optimizer as an estimate of number of records that will pass the table condition (condition that depends on fields of this table and constants) */ ha_rows quick_condition_rows; /* If this table has TIMESTAMP field with auto-set property (pointed by timestamp_field member) then this variable indicates during which operations (insert only/on update/in both cases) we should set this field to current timestamp. If there are no such field in this table or we should not automatically set its value during execution of current statement then the variable contains TIMESTAMP_NO_AUTO_SET (i.e. 0). Value of this variable is set for each statement in open_table() and if needed cleared later in statement processing code (see mysql_update() as example). */ timestamp_auto_set_type timestamp_field_type; table_map map; /* ID bit of table (1,2,4,8,16...) */ uint lock_position; /* Position in MYSQL_LOCK.table */ uint lock_data_start; /* Start pos. in MYSQL_LOCK.locks */ uint lock_count; /* Number of locks */ uint tablenr,used_fields; uint temp_pool_slot; /* Used by intern temp tables */ uint status; /* What's in record[0] */ uint db_stat; /* mode of file as in handler.h */ /* number of select if it is derived table */ uint derived_select_number; int current_lock; /* Type of lock on table */ my_bool copy_blobs; /* copy_blobs when storing */ /* 0 or JOIN_TYPE_{LEFT|RIGHT}. Currently this is only compared to 0. If maybe_null !=0, this table is inner w.r.t. some outer join operation, and null_row may be true. */ uint maybe_null; /* If true, the current table row is considered to have all columns set to NULL, including columns declared as "not null" (see maybe_null). */ my_bool null_row; /* TODO: Each of the following flags take up 8 bits. They can just as easily be put into one single unsigned long and instead of taking up 18 bytes, it would take up 4. */ my_bool force_index; /** Flag set when the statement contains FORCE INDEX FOR ORDER BY See TABLE_LIST::process_index_hints(). */ my_bool force_index_order; /** Flag set when the statement contains FORCE INDEX FOR GROUP BY See TABLE_LIST::process_index_hints(). */ my_bool force_index_group; my_bool distinct,const_table,no_rows; /** If set, the optimizer has found that row retrieval should access index tree only. */ my_bool key_read; my_bool no_keyread; my_bool locked_by_logger; my_bool no_replicate; my_bool locked_by_name; my_bool fulltext_searched; my_bool no_cache; /* To signal that the table is associated with a HANDLER statement */ my_bool open_by_handler; /* To indicate that a non-null value of the auto_increment field was provided by the user or retrieved from the current record. Used only in the MODE_NO_AUTO_VALUE_ON_ZERO mode. */ my_bool auto_increment_field_not_null; my_bool insert_or_update; /* Can be used by the handler */ my_bool alias_name_used; /* true if table_name is alias */ my_bool get_fields_in_item_tree; /* Signal to fix_field */ my_bool m_needs_reopen; REGINFO reginfo; /* field connections */ MEM_ROOT mem_root; GRANT_INFO grant; FILESORT_INFO sort; #ifdef WITH_PARTITION_STORAGE_ENGINE partition_info *part_info; /* Partition related information */ bool no_partitions_used; /* If true, all partitions have been pruned away */ #endif MDL_ticket *mdl_ticket; void init(THD *thd, TABLE_LIST *tl); bool fill_item_list(List<Item> *item_list) const; void reset_item_list(List<Item> *item_list) const; void clear_column_bitmaps(void); void prepare_for_position(void); void mark_columns_used_by_index_no_reset(uint index, MY_BITMAP *map); void mark_columns_used_by_index(uint index); void add_read_columns_used_by_index(uint index); void restore_column_maps_after_mark_index(); void mark_auto_increment_column(void); void mark_columns_needed_for_update(void); void mark_columns_needed_for_delete(void); void mark_columns_needed_for_insert(void); inline void column_bitmaps_set(MY_BITMAP *read_set_arg, MY_BITMAP *write_set_arg) { read_set= read_set_arg; write_set= write_set_arg; if (file) file->column_bitmaps_signal(); } inline void column_bitmaps_set_no_signal(MY_BITMAP *read_set_arg, MY_BITMAP *write_set_arg) { read_set= read_set_arg; write_set= write_set_arg; } inline void use_all_columns() { column_bitmaps_set(&s->all_set, &s->all_set); } inline void default_column_bitmaps() { read_set= &def_read_set; write_set= &def_write_set; } /** Should this instance of the table be reopened? */ inline bool needs_reopen() { return !db_stat || m_needs_reopen; } inline void set_keyread(bool flag) { DBUG_ASSERT(file); if (flag && !key_read) { key_read= ; file->extra(HA_EXTRA_KEYREAD); } else if (!flag && key_read) { key_read= ; file->extra(HA_EXTRA_NO_KEYREAD); } } bool update_const_key_parts(COND *conds); };
struct TABLE的更多相关文章
- PAT 1026. Table Tennis
A table tennis club has N tables available to the public. The tables are numbered from 1 to N. For ...
- 1026. Table Tennis (30)
题目如下: A table tennis club has N tables available to the public. The tables are numbered from 1 to N. ...
- PAT甲级1026 Table Tennis【模拟好题】
题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805472333250560 题意: 有k张乒乓球桌,有的是vip桌 ...
- PAT 1026 Table Tennis[比较难]
1026 Table Tennis (30)(30 分) A table tennis club has N tables available to the public. The tables ar ...
- 队列模拟题——pat1026. Table Tennis
题意自己理解了,主要是两个队列维护,一个VIP队列,一个普通队列 搜集了一些坑(有些坑转自别的网站用于广大同学的测试之用) 普通人也有VIP的权益!!! 屌丝逆袭有木有!!! 920:52:00 10 ...
- 1026 Table Tennis (30)(30 分)
A table tennis club has N tables available to the public. The tables are numbered from 1 to N. For a ...
- (C)struct结构体指针
结构体指针 指针结构与指针的关系亦有两重:其一是在定义结构时,将指针作为结构中的一个成员:其二是指向结构的指针(称为结构指针). 前者同一般的结构成员一样可直接进行访问,后者是本节讨论的重点. 结构指 ...
- LUA的table实现
数据结构 下面的结构体是lua中所定义的table typedef struct Table { CommonHeader; lu_byte flags; /* 1<<p means ta ...
- 1026 Table Tennis (30分)
A table tennis club has N tables available to the public. The tables are numbered from 1 to N. For a ...
随机推荐
- 为什么V8引擎这么快?(转载)
转载请注明出处:http://blog.csdn.net/horkychen Google研发的V8 JavaScript引擎性能优异.我们请熟悉内部程序实现的作者依源代码来看看V8是如何加速的. 作 ...
- LintCode-Kth Prime Number.
Design an algorithm to find the kth number such that the only prime factors are 3, 5, and 7. The eli ...
- DB天气app冲刺二阶段第六天
今天干了一件让我有点小激动的事情 就是我感觉我貌似找到了为什么我的项目会闪退了有的时候..但是还不确定.等会会再试试看看到底对不对.好吧其实今天就干了这些事整整一下午调试,找bug,决定从头开始一点一 ...
- php Linux安装
参考地址:http://www.cnblogs.com/lianyue/p/3936728.html
- js--eval函数
前言: js的eval函数很牛叉,用了几次--不过都没有记录.试想:如果没有EXT.JQery,怎样将json字符串转换为对象呢? 示例: 定义2个字符串变量s1.s2.其中s1表示一个对象:s2表示 ...
- 【HDOJ】【1693】Eat The Trees
插头DP 插头dp模板题…… 这题比CDQ论文上的例题还要简单……因为不用区分左右插头(这题可以多回路,并不是一条哈密尔顿路) 硬枚举当前位置的状态就好了>_< 题解:http://blo ...
- WPF Loader
xaml <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xml ...
- Root resource classes
Overview A root resource class is the entry point into a JAX-RS implemented RESTful Web service. It ...
- poj 3150 Cellular Automaton
首先来看一下Sample里的第一组数据.1 2 2 1 2经过一次变换之后就成了5 5 5 5 4它的原理就是a0 a1 a2 a3 a4->(a4+a0+a1) (a0+a1+a2) (a1+ ...
- hdu 1063 Exponentiation
求实数的幂,这个用C++写的话有点长,但是用Java写就非常方便了…… ); System.out.println(an); } }}