> > I think we should be able to do this without any big changes in
> > the mysql_select() interface.
> As I can see in sql_parse.cc, mysql_select() calls 4 times with next
> 1) thd (always);
> 2) tables (or tables->next in CREATE/INSERT queries);
> 3) select_lex->item_list (fields list);
> 4) select_lex->where (where clause);
> 5) select_lex->ftfunc_list (full-text search functions);
> 6) (ORDER *)select_lex->order_list.first (or UNLL in multi_delete;
> expressions in order clause);
> 7) (ORDER *)select_lex->group_list.first (or NULL in multi_delete;
> expressions in group clause);
> 8) select_lex->having (or NULL in multi_delete; having clause);
> 9) (ORDER *)lex->proc_list.first (or NULL in multi_delete; procedure
> 2Sinisa: may be this needs to be moved from lex to select_lex?);
> 10) select_lex->options | thd->options (| SELECT_NO_JOIN_CACHE in
> 11) result.
> As you can see 7/8 out of 11 arguments uses select_lex. May be to pass
> select_lex structure to mysql_select instead of those many arguments (this
> also will help Sinisa to handle select_lex->next inside mysql_select() for
Also, we must create a copy of select_lex->tables somewhere out of
select_lex structure to make possible to open all tables one time with
open_and_lock_tables() function before calling mysql_select().