标签:style blog class code c java
%token SELECT_SYM select: select_init { LEX *lex= Lex; lex->sql_command= SQLCOM_SELECT; }; select_item_list: select_item_list ‘,‘ select_item | select_item | ‘*‘ { THD *thd= YYTHD; Item *item= new (thd->mem_root) Item_field(&thd->lex->current_select->context,NULL, NULL, "*"); if (item == NULL) MYSQL_YYABORT; if (add_item_to_list(thd, item)) MYSQL_YYABORT; (thd->lex->current_select->with_wild)++; }; where_clause: /* empty */ { Select->where= 0; } | WHERE { Select->parsing_place= IN_WHERE; } expr { SELECT_LEX *select= Select; select->where= $3; select->parsing_place= NO_MATTER; if ($3) $3->top_level_item(); };
(gdb) print select_lex->table_list $33 = { <Sql_alloc> = {<No data fields>}, members of SQL_I_List<TABLE_LIST>: elements = 1, first = 0x8ca04818, next = 0x8ca04818
(gdb) print select_lex->where->type() $32 = Item::FUNC_ITEM (gdb) p select_lex->where)->args))->type() $30 = Item::FIELD_ITEM (gdb) p select_lex->where)->args++))->type() $29 = Item::INT_ITEM
结构如下:
where |-->FUNC_ITEM |-->FIELD_ITEM("id") |-->INT_ITEM(1)
3. item_list
(gdb) print *(Item_field*)(select_lex->item_list->first->info) name = 0x8ca04758 "id", (gdb) print *(Item_field*)(select_lex->item_list->first->next->info) name = 0x8cb047f8 "name",
结构如下:
item_list: |-->Item_field("id") |-->Item_field("name")
标签:style blog class code c java
原文地址:http://www.cnblogs.com/xpchild/p/3730079.html