MySQL-Source-Select
参考文献
词法分析&
语法分析过程
初始化字段
-
对于
select
子句中的每个字段,都会创建一个Item_field
类(或子类)的实例。1
2
3
4
5
6
7
8
9
10
11
12
13// sql/item.h
class Item_field : public Item_ident {
typedef Item_ident super;
private:
Field *result_field{nullptr};
Field *last_org_destination_field{nullptr};
Field *last_destination_field{nullptr};
uint32_t last_org_destination_field_memcpyable = ~0U;
uint32_t last_destination_field_memcpyable = ~0U;
const Item_field *m_base_item_field{nullptr};
bool m_protected_by_any_value{false};
Item_equal *m_multi_equality{nullptr}; -
select
子句中,字段可能有2种类型,一种是星号*
,一种是普通字段,星号会用Item_asterisk
类实例化,而Item_asterisk
类是Item_field
类的子类。普通字段就直接用Item_field
类实例化。1
2
3
4// sql/item.h
class Item_asterisk : public Item_field {
typedef Item_field super;
}; -
词法分析
&
语法分析阶段,各字段只是完成了Item_field
类的实例化,但是还没有对应到表中真实的字段。
初始化表
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 HoleLin's Blog!