THD::lex now points to THD::main_lex like in 5.0

All tests pass (client_test included)
This commit is contained in:
konstantin@oak.local 2003-12-19 20:52:13 +03:00
parent c49773237d
commit d37da004f6
33 changed files with 233 additions and 231 deletions

View File

@ -746,7 +746,7 @@ bool Protocol::convert_str(const char *from, uint length)
bool setup_params_data(st_prep_stmt *stmt) bool setup_params_data(st_prep_stmt *stmt)
{ {
THD *thd= stmt->thd; THD *thd= stmt->thd;
List<Item> &params= thd->lex.param_list; List<Item> &params= thd->lex->param_list;
List_iterator<Item> param_iterator(params); List_iterator<Item> param_iterator(params);
Item_param *param; Item_param *param;
ulong param_no= 0; ulong param_no= 0;
@ -779,7 +779,7 @@ bool setup_params_data(st_prep_stmt *stmt)
bool setup_params_data_withlog(st_prep_stmt *stmt) bool setup_params_data_withlog(st_prep_stmt *stmt)
{ {
THD *thd= stmt->thd; THD *thd= stmt->thd;
List<Item> &params= thd->lex.param_list; List<Item> &params= thd->lex->param_list;
List_iterator<Item> param_iterator(params); List_iterator<Item> param_iterator(params);
Item_param *param; Item_param *param;
MYSQL_BIND *client_param= thd->client_params; MYSQL_BIND *client_param= thd->client_params;

View File

@ -1128,7 +1128,7 @@ get_addon_fields(THD *thd, Field **ptabfield, uint sortlength, uint *plength)
The fact is the filter 'field->query_id != thd->query_id' The fact is the filter 'field->query_id != thd->query_id'
doesn't work for alter table doesn't work for alter table
*/ */
if (thd->lex.sql_command != SQLCOM_SELECT) if (thd->lex->sql_command != SQLCOM_SELECT)
return 0; return 0;
for (pfield= ptabfield; (field= *pfield) ; pfield++) for (pfield= ptabfield; (field= *pfield) ; pfield++)
{ {

View File

@ -2253,8 +2253,8 @@ ha_innobase::write_row(
skip_auto_inc_decr = FALSE; skip_auto_inc_decr = FALSE;
if (error == DB_DUPLICATE_KEY if (error == DB_DUPLICATE_KEY
&& (user_thd->lex.sql_command == SQLCOM_REPLACE && (user_thd->lex->sql_command == SQLCOM_REPLACE
|| user_thd->lex.sql_command || user_thd->lex->sql_command
== SQLCOM_REPLACE_SELECT)) { == SQLCOM_REPLACE_SELECT)) {
skip_auto_inc_decr= TRUE; skip_auto_inc_decr= TRUE;

View File

@ -390,7 +390,7 @@ int ha_myisam::analyze(THD *thd, HA_CHECK_OPT* check_opt)
int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt) int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt)
{ {
HA_CHECK_OPT tmp_check_opt; HA_CHECK_OPT tmp_check_opt;
char* backup_dir = thd->lex.backup_dir; char* backup_dir= thd->lex->backup_dir;
char src_path[FN_REFLEN], dst_path[FN_REFLEN]; char src_path[FN_REFLEN], dst_path[FN_REFLEN];
char* table_name = table->real_name; char* table_name = table->real_name;
int error; int error;
@ -430,7 +430,7 @@ int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt)
int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt) int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt)
{ {
char* backup_dir = thd->lex.backup_dir; char* backup_dir= thd->lex->backup_dir;
char src_path[FN_REFLEN], dst_path[FN_REFLEN]; char src_path[FN_REFLEN], dst_path[FN_REFLEN];
char* table_name = table->real_name; char* table_name = table->real_name;
int error; int error;

View File

@ -53,16 +53,16 @@ Item::Item():
thd->free_list= this; thd->free_list= this;
/* /*
Item constructor can be called during execution other then SQL_COM Item constructor can be called during execution other then SQL_COM
command => we should check thd->lex.current_select on zero (thd->lex command => we should check thd->lex->current_select on zero (thd->lex
can be uninitialised) can be uninitialised)
*/ */
if (thd->lex.current_select) if (thd->lex->current_select)
{ {
SELECT_LEX_NODE::enum_parsing_place place= SELECT_LEX_NODE::enum_parsing_place place=
thd->lex.current_select->parsing_place; thd->lex->current_select->parsing_place;
if (place == SELECT_LEX_NODE::SELECT_LIST || if (place == SELECT_LEX_NODE::SELECT_LIST ||
place == SELECT_LEX_NODE::IN_HAVING) place == SELECT_LEX_NODE::IN_HAVING)
thd->lex.current_select->select_n_having_items++; thd->lex->current_select->select_n_having_items++;
} }
} }
@ -802,7 +802,7 @@ static void mark_as_dependent(THD *thd, SELECT_LEX *last, SELECT_LEX *current,
// store pointer on SELECT_LEX from wich item is dependent // store pointer on SELECT_LEX from wich item is dependent
item->depended_from= last; item->depended_from= last;
current->mark_as_dependent(last); current->mark_as_dependent(last);
if (thd->lex.describe & DESCRIBE_EXTENDED) if (thd->lex->describe & DESCRIBE_EXTENDED)
{ {
char warn_buff[MYSQL_ERRMSG_SIZE]; char warn_buff[MYSQL_ERRMSG_SIZE];
sprintf(warn_buff, ER(ER_WARN_FIELD_RESOLVED), sprintf(warn_buff, ER(ER_WARN_FIELD_RESOLVED),
@ -843,7 +843,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
Item **refer= (Item **)not_found_item; Item **refer= (Item **)not_found_item;
uint counter; uint counter;
// Prevent using outer fields in subselects, that is not supported now // Prevent using outer fields in subselects, that is not supported now
SELECT_LEX *cursel=(SELECT_LEX *) thd->lex.current_select; SELECT_LEX *cursel= (SELECT_LEX *) thd->lex->current_select;
if (cursel->master_unit()->first_select()->linkage != DERIVED_TABLE_TYPE) if (cursel->master_unit()->first_select()->linkage != DERIVED_TABLE_TYPE)
{ {
SELECT_LEX_UNIT *prev_unit= cursel->master_unit(); SELECT_LEX_UNIT *prev_unit= cursel->master_unit();
@ -1439,7 +1439,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
{ {
TABLE_LIST *where= 0, *table_list; TABLE_LIST *where= 0, *table_list;
bool upward_lookup= 0; bool upward_lookup= 0;
SELECT_LEX_UNIT *prev_unit= thd->lex.current_select->master_unit(); SELECT_LEX_UNIT *prev_unit= thd->lex->current_select->master_unit();
SELECT_LEX *sl= prev_unit->outer_select(); SELECT_LEX *sl= prev_unit->outer_select();
/* /*
Finding only in current select will be performed for selects that have Finding only in current select will be performed for selects that have
@ -1447,10 +1447,10 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
fields for now) fields for now)
*/ */
if ((ref= find_item_in_list(this, if ((ref= find_item_in_list(this,
*(thd->lex.current_select->get_item_list()), *(thd->lex->current_select->get_item_list()),
&counter, &counter,
((sl && ((sl &&
thd->lex.current_select->master_unit()-> thd->lex->current_select->master_unit()->
first_select()->linkage != first_select()->linkage !=
DERIVED_TABLE_TYPE) ? DERIVED_TABLE_TYPE) ?
REPORT_EXCEPT_NOT_FOUND : REPORT_EXCEPT_NOT_FOUND :
@ -1526,7 +1526,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
{ {
// Call to report error // Call to report error
find_item_in_list(this, find_item_in_list(this,
*(thd->lex.current_select->get_item_list()), *(thd->lex->current_select->get_item_list()),
&counter, &counter,
REPORT_ALL_ERRORS); REPORT_ALL_ERRORS);
} }
@ -1539,7 +1539,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
Item_field* fld; Item_field* fld;
if (!((*reference)= fld= new Item_field(tmp))) if (!((*reference)= fld= new Item_field(tmp)))
return 1; return 1;
mark_as_dependent(thd, last, thd->lex.current_select, fld); mark_as_dependent(thd, last, thd->lex->current_select, fld);
return 0; return 0;
} }
else else
@ -1550,7 +1550,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
"forward reference in item list"); "forward reference in item list");
return -1; return -1;
} }
mark_as_dependent(thd, last, thd->lex.current_select, mark_as_dependent(thd, last, thd->lex->current_select,
this); this);
ref= last->ref_pointer_array + counter; ref= last->ref_pointer_array + counter;
} }
@ -1565,7 +1565,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
"forward reference in item list"); "forward reference in item list");
return -1; return -1;
} }
ref= thd->lex.current_select->ref_pointer_array + counter; ref= thd->lex->current_select->ref_pointer_array + counter;
} }
} }
@ -1578,8 +1578,8 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
*/ */
if (((*ref)->with_sum_func && name && if (((*ref)->with_sum_func && name &&
(depended_from || (depended_from ||
!(thd->lex.current_select->linkage != GLOBAL_OPTIONS_TYPE && !(thd->lex->current_select->linkage != GLOBAL_OPTIONS_TYPE &&
thd->lex.current_select->having_fix_field))) || thd->lex->current_select->having_fix_field))) ||
!(*ref)->fixed) !(*ref)->fixed)
{ {
my_error(ER_ILLEGAL_REFERENCE, MYF(0), name, my_error(ER_ILLEGAL_REFERENCE, MYF(0), name,

View File

@ -1723,7 +1723,7 @@ Item_cond::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
if (item->maybe_null) if (item->maybe_null)
maybe_null=1; maybe_null=1;
} }
thd->lex.current_select->cond_count+=list.elements; thd->lex->current_select->cond_count+= list.elements;
fix_length_and_dec(); fix_length_and_dec();
fixed= 1; fixed= 1;
return 0; return 0;

View File

@ -76,7 +76,7 @@ Item *create_func_ceiling(Item* a)
Item *create_func_connection_id(void) Item *create_func_connection_id(void)
{ {
THD *thd=current_thd; THD *thd=current_thd;
thd->lex.safe_to_cache_query=0; thd->lex->safe_to_cache_query= 0;
return new Item_int(NullS,(longlong) return new Item_int(NullS,(longlong)
((thd->slave_thread) ? ((thd->slave_thread) ?
thd->variables.pseudo_thread_id : thd->variables.pseudo_thread_id :
@ -148,7 +148,7 @@ Item *create_func_floor(Item* a)
Item *create_func_found_rows(void) Item *create_func_found_rows(void)
{ {
THD *thd=current_thd; THD *thd=current_thd;
thd->lex.safe_to_cache_query=0; thd->lex->safe_to_cache_query= 0;
return new Item_int(NullS,(longlong) thd->found_rows(),21); return new Item_int(NullS,(longlong) thd->found_rows(),21);
} }
@ -159,7 +159,7 @@ Item *create_func_from_days(Item* a)
Item *create_func_get_lock(Item* a, Item *b) Item *create_func_get_lock(Item* a, Item *b)
{ {
current_thd->lex.uncacheable(UNCACHEABLE_SIDEEFFECT); current_thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
return new Item_func_get_lock(a, b); return new Item_func_get_lock(a, b);
} }
@ -324,7 +324,7 @@ Item *create_func_radians(Item *a)
Item *create_func_release_lock(Item* a) Item *create_func_release_lock(Item* a)
{ {
current_thd->lex.uncacheable(UNCACHEABLE_SIDEEFFECT); current_thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
return new Item_func_release_lock(a); return new Item_func_release_lock(a);
} }
@ -445,7 +445,7 @@ Item *create_func_year(Item* a)
Item *create_load_file(Item* a) Item *create_load_file(Item* a)
{ {
current_thd->lex.uncacheable(UNCACHEABLE_SIDEEFFECT); current_thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
return new Item_load_file(a); return new Item_load_file(a);
} }
@ -472,13 +472,13 @@ Item *create_func_cast(Item *a, Cast_target cast_type, int len,
Item *create_func_is_free_lock(Item* a) Item *create_func_is_free_lock(Item* a)
{ {
current_thd->lex.uncacheable(UNCACHEABLE_SIDEEFFECT); current_thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
return new Item_func_is_free_lock(a); return new Item_func_is_free_lock(a);
} }
Item *create_func_is_used_lock(Item* a) Item *create_func_is_used_lock(Item* a)
{ {
current_thd->lex.uncacheable(UNCACHEABLE_SIDEEFFECT); current_thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
return new Item_func_is_used_lock(a); return new Item_func_is_used_lock(a);
} }

View File

@ -2481,7 +2481,7 @@ void Item_func_get_user_var::fix_length_and_dec()
if (!(var_entry= get_variable(&thd->user_vars, name, 0))) if (!(var_entry= get_variable(&thd->user_vars, name, 0)))
null_value= 1; null_value= 1;
if (!(opt_bin_log && is_update_query(thd->lex.sql_command))) if (!(opt_bin_log && is_update_query(thd->lex->sql_command)))
return; return;
if (!var_entry) if (!var_entry)
@ -2950,7 +2950,7 @@ Item *get_system_var(THD *thd, enum_var_type var_type, LEX_STRING name,
} }
if (!(item=var->item(thd, var_type, component_name))) if (!(item=var->item(thd, var_type, component_name)))
return 0; // Impossible return 0; // Impossible
thd->lex.uncacheable(UNCACHEABLE_SIDEEFFECT); thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
buff[0]='@'; buff[0]='@';
buff[1]='@'; buff[1]='@';
pos=buff+2; pos=buff+2;
@ -2990,7 +2990,7 @@ Item *get_system_var(THD *thd, enum_var_type var_type, const char *var_name,
DBUG_ASSERT(var != 0); DBUG_ASSERT(var != 0);
if (!(item=var->item(thd, var_type, &null_lex_string))) if (!(item=var->item(thd, var_type, &null_lex_string)))
return 0; // Impossible return 0; // Impossible
thd->lex.uncacheable(UNCACHEABLE_SIDEEFFECT); thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
item->set_name(item_name, 0, system_charset_info); // Will use original name item->set_name(item_name, 0, system_charset_info); // Will use original name
return item; return item;
} }

View File

@ -253,7 +253,7 @@ Item_singlerow_subselect::select_transformer(JOIN *join)
{ {
have_to_be_excluded= 1; have_to_be_excluded= 1;
if (join->thd->lex.describe) if (join->thd->lex->describe)
{ {
char warn_buff[MYSQL_ERRMSG_SIZE]; char warn_buff[MYSQL_ERRMSG_SIZE];
sprintf(warn_buff, ER(ER_SELECT_REDUCED), select_lex->select_number); sprintf(warn_buff, ER(ER_SELECT_REDUCED), select_lex->select_number);
@ -608,14 +608,14 @@ Item_in_subselect::single_value_transformer(JOIN *join,
subs= new Item_maxmin_subselect(this, select_lex, func->l_op()); subs= new Item_maxmin_subselect(this, select_lex, func->l_op());
} }
// left expression belong to outer select // left expression belong to outer select
SELECT_LEX *current= thd_tmp->lex.current_select, *up; SELECT_LEX *current= thd_tmp->lex->current_select, *up;
thd_tmp->lex.current_select= up= current->return_after_parsing(); thd_tmp->lex->current_select= up= current->return_after_parsing();
if (left_expr->fix_fields(thd_tmp, up->get_table_list(), &left_expr)) if (left_expr->fix_fields(thd_tmp, up->get_table_list(), &left_expr))
{ {
thd_tmp->lex.current_select= current; thd_tmp->lex->current_select= current;
DBUG_RETURN(RES_ERROR); DBUG_RETURN(RES_ERROR);
} }
thd_tmp->lex.current_select= current; thd_tmp->lex->current_select= current;
substitution= func->create(left_expr, subs); substitution= func->create(left_expr, subs);
DBUG_RETURN(RES_OK); DBUG_RETURN(RES_OK);
} }
@ -626,16 +626,16 @@ Item_in_subselect::single_value_transformer(JOIN *join,
SELECT_LEX_UNIT *unit= select_lex->master_unit(); SELECT_LEX_UNIT *unit= select_lex->master_unit();
substitution= optimizer= new Item_in_optimizer(left_expr, this); substitution= optimizer= new Item_in_optimizer(left_expr, this);
SELECT_LEX *current= thd_tmp->lex.current_select, *up; SELECT_LEX *current= thd_tmp->lex->current_select, *up;
thd_tmp->lex.current_select= up= current->return_after_parsing(); thd_tmp->lex->current_select= up= current->return_after_parsing();
//optimizer never use Item **ref => we can pass 0 as parameter //optimizer never use Item **ref => we can pass 0 as parameter
if (!optimizer || optimizer->fix_left(thd_tmp, up->get_table_list(), 0)) if (!optimizer || optimizer->fix_left(thd_tmp, up->get_table_list(), 0))
{ {
thd_tmp->lex.current_select= current; thd_tmp->lex->current_select= current;
DBUG_RETURN(RES_ERROR); DBUG_RETURN(RES_ERROR);
} }
thd_tmp->lex.current_select= current; thd_tmp->lex->current_select= current;
/* /*
As far as Item_ref_in_optimizer do not substitude itself on fix_fields As far as Item_ref_in_optimizer do not substitude itself on fix_fields
@ -726,7 +726,7 @@ Item_in_subselect::single_value_transformer(JOIN *join,
// fix_field of item will be done in time of substituting // fix_field of item will be done in time of substituting
substitution= item; substitution= item;
have_to_be_excluded= 1; have_to_be_excluded= 1;
if (thd_tmp->lex.describe) if (thd_tmp->lex->describe)
{ {
char warn_buff[MYSQL_ERRMSG_SIZE]; char warn_buff[MYSQL_ERRMSG_SIZE];
sprintf(warn_buff, ER(ER_SELECT_REDUCED), select_lex->select_number); sprintf(warn_buff, ER(ER_SELECT_REDUCED), select_lex->select_number);
@ -763,15 +763,15 @@ Item_in_subselect::row_value_transformer(JOIN *join)
SELECT_LEX_UNIT *unit= select_lex->master_unit(); SELECT_LEX_UNIT *unit= select_lex->master_unit();
substitution= optimizer= new Item_in_optimizer(left_expr, this); substitution= optimizer= new Item_in_optimizer(left_expr, this);
SELECT_LEX *current= thd_tmp->lex.current_select, *up; SELECT_LEX *current= thd_tmp->lex->current_select, *up;
thd_tmp->lex.current_select= up= current->return_after_parsing(); thd_tmp->lex->current_select= up= current->return_after_parsing();
//optimizer never use Item **ref => we can pass 0 as parameter //optimizer never use Item **ref => we can pass 0 as parameter
if (!optimizer || optimizer->fix_left(thd_tmp, up->get_table_list(), 0)) if (!optimizer || optimizer->fix_left(thd_tmp, up->get_table_list(), 0))
{ {
thd_tmp->lex.current_select= current; thd_tmp->lex->current_select= current;
DBUG_RETURN(RES_ERROR); DBUG_RETURN(RES_ERROR);
} }
thd_tmp->lex.current_select= current; thd_tmp->lex->current_select= current;
unit->uncacheable|= UNCACHEABLE_DEPENDENT; unit->uncacheable|= UNCACHEABLE_DEPENDENT;
} }
@ -913,8 +913,8 @@ int subselect_single_select_engine::prepare()
return 1; return 1;
} }
prepared= 1; prepared= 1;
SELECT_LEX *save_select= thd->lex.current_select; SELECT_LEX *save_select= thd->lex->current_select;
thd->lex.current_select= select_lex; thd->lex->current_select= select_lex;
if (join->prepare(&select_lex->ref_pointer_array, if (join->prepare(&select_lex->ref_pointer_array,
(TABLE_LIST*) select_lex->table_list.first, (TABLE_LIST*) select_lex->table_list.first,
select_lex->with_wild, select_lex->with_wild,
@ -927,7 +927,7 @@ int subselect_single_select_engine::prepare()
(ORDER*) 0, select_lex, (ORDER*) 0, select_lex,
select_lex->master_unit())) select_lex->master_unit()))
return 1; return 1;
thd->lex.current_select= save_select; thd->lex->current_select= save_select;
return 0; return 0;
} }
@ -1000,8 +1000,8 @@ int subselect_single_select_engine::exec()
{ {
DBUG_ENTER("subselect_single_select_engine::exec"); DBUG_ENTER("subselect_single_select_engine::exec");
char const *save_where= join->thd->where; char const *save_where= join->thd->where;
SELECT_LEX *save_select= join->thd->lex.current_select; SELECT_LEX *save_select= join->thd->lex->current_select;
join->thd->lex.current_select= select_lex; join->thd->lex->current_select= select_lex;
if (!optimized) if (!optimized)
{ {
optimized=1; optimized=1;
@ -1009,7 +1009,7 @@ int subselect_single_select_engine::exec()
{ {
join->thd->where= save_where; join->thd->where= save_where;
executed= 1; executed= 1;
join->thd->lex.current_select= save_select; join->thd->lex->current_select= save_select;
DBUG_RETURN(join->error?join->error:1); DBUG_RETURN(join->error?join->error:1);
} }
if (item->engine_changed) if (item->engine_changed)
@ -1022,7 +1022,7 @@ int subselect_single_select_engine::exec()
if (join->reinit()) if (join->reinit())
{ {
join->thd->where= save_where; join->thd->where= save_where;
join->thd->lex.current_select= save_select; join->thd->lex->current_select= save_select;
DBUG_RETURN(1); DBUG_RETURN(1);
} }
item->reset(); item->reset();
@ -1033,11 +1033,11 @@ int subselect_single_select_engine::exec()
join->exec(); join->exec();
executed= 1; executed= 1;
join->thd->where= save_where; join->thd->where= save_where;
join->thd->lex.current_select= save_select; join->thd->lex->current_select= save_select;
DBUG_RETURN(join->error||thd->is_fatal_error); DBUG_RETURN(join->error||thd->is_fatal_error);
} }
join->thd->where= save_where; join->thd->where= save_where;
join->thd->lex.current_select= save_select; join->thd->lex->current_select= save_select;
DBUG_RETURN(0); DBUG_RETURN(0);
} }

View File

@ -57,7 +57,7 @@ Item_sum::Item_sum(THD *thd, Item_sum &item):
void Item_sum::mark_as_sum_func() void Item_sum::mark_as_sum_func()
{ {
current_thd->lex.current_select->with_sum_func= 1; current_thd->lex->current_select->with_sum_func= 1;
with_sum_func= 1; with_sum_func= 1;
} }
@ -1120,7 +1120,7 @@ void Item_sum_count_distinct::make_unique()
bool Item_sum_count_distinct::setup(THD *thd) bool Item_sum_count_distinct::setup(THD *thd)
{ {
List<Item> list; List<Item> list;
SELECT_LEX *select_lex= thd->lex.current_select; SELECT_LEX *select_lex= thd->lex->current_select;
if (select_lex->linkage == GLOBAL_OPTIONS_TYPE) if (select_lex->linkage == GLOBAL_OPTIONS_TYPE)
return 1; return 1;
@ -1802,7 +1802,7 @@ bool Item_func_group_concat::setup(THD *thd)
{ {
DBUG_ENTER("Item_func_group_concat::setup"); DBUG_ENTER("Item_func_group_concat::setup");
List<Item> list; List<Item> list;
SELECT_LEX *select_lex= thd->lex.current_select; SELECT_LEX *select_lex= thd->lex->current_select;
if (select_lex->linkage == GLOBAL_OPTIONS_TYPE) if (select_lex->linkage == GLOBAL_OPTIONS_TYPE)
DBUG_RETURN(1); DBUG_RETURN(1);

View File

@ -1036,22 +1036,22 @@ SQL_CRYPT *get_crypt_for_frm(void);
inline bool add_item_to_list(THD *thd, Item *item) inline bool add_item_to_list(THD *thd, Item *item)
{ {
return thd->lex.current_select->add_item_to_list(thd, item); return thd->lex->current_select->add_item_to_list(thd, item);
} }
inline bool add_value_to_list(THD *thd, Item *value) inline bool add_value_to_list(THD *thd, Item *value)
{ {
return thd->lex.value_list.push_back(value); return thd->lex->value_list.push_back(value);
} }
inline bool add_order_to_list(THD *thd, Item *item, bool asc) inline bool add_order_to_list(THD *thd, Item *item, bool asc)
{ {
return thd->lex.current_select->add_order_to_list(thd, item, asc); return thd->lex->current_select->add_order_to_list(thd, item, asc);
} }
inline bool add_group_to_list(THD *thd, Item *item, bool asc) inline bool add_group_to_list(THD *thd, Item *item, bool asc)
{ {
return thd->lex.current_select->add_group_to_list(thd, item, asc); return thd->lex->current_select->add_group_to_list(thd, item, asc);
} }
inline void mark_as_null_row(TABLE *table) inline void mark_as_null_row(TABLE *table)

View File

@ -1275,12 +1275,12 @@ static void server_init(void)
void yyerror(const char *s) void yyerror(const char *s)
{ {
THD *thd=current_thd; THD *thd=current_thd;
char *yytext=(char*) thd->lex.tok_start; char *yytext= (char*) thd->lex->tok_start;
/* "parse error" changed into "syntax error" between bison 1.75 and 1.875 */ /* "parse error" changed into "syntax error" between bison 1.75 and 1.875 */
if (strcmp(s,"parse error") == 0 || strcmp(s,"syntax error") == 0) if (strcmp(s,"parse error") == 0 || strcmp(s,"syntax error") == 0)
s=ER(ER_SYNTAX_ERROR); s=ER(ER_SYNTAX_ERROR);
net_printf(thd,ER_PARSE_ERROR, s, yytext ? (char*) yytext : "", net_printf(thd,ER_PARSE_ERROR, s, yytext ? (char*) yytext : "",
thd->lex.yylineno); thd->lex->yylineno);
} }
@ -1878,11 +1878,11 @@ extern "C" int my_message_sql(uint error, const char *str,
if ((thd= current_thd)) if ((thd= current_thd))
{ {
/* /*
thd->lex.current_select == 0 if lex structure is not inited thd->lex->current_select == 0 if lex structure is not inited
(not query command (COM_QUERY)) (not query command (COM_QUERY))
*/ */
if (thd->lex.current_select && if (thd->lex->current_select &&
thd->lex.current_select->no_error && !thd->is_fatal_error) thd->lex->current_select->no_error && !thd->is_fatal_error)
{ {
DBUG_PRINT("error", ("above error converted to warning")); DBUG_PRINT("error", ("above error converted to warning"));
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, error, str); push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, error, str);

View File

@ -122,7 +122,7 @@ void send_error(THD *thd, uint sql_errno, const char *err)
thd->net.report_error= 0; thd->net.report_error= 0;
/* Abort multi-result sets */ /* Abort multi-result sets */
thd->lex.found_colon= 0; thd->lex->found_colon= 0;
thd->server_status= ~SERVER_MORE_RESULTS_EXISTS; thd->server_status= ~SERVER_MORE_RESULTS_EXISTS;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }

View File

@ -441,7 +441,7 @@ int show_new_master(THD* thd)
DBUG_ENTER("show_new_master"); DBUG_ENTER("show_new_master");
List<Item> field_list; List<Item> field_list;
char errmsg[SLAVE_ERRMSG_SIZE]; char errmsg[SLAVE_ERRMSG_SIZE];
LEX_MASTER_INFO* lex_mi = &thd->lex.mi; LEX_MASTER_INFO* lex_mi= &thd->lex->mi;
errmsg[0]=0; // Safety errmsg[0]=0; // Safety
if (translate_master(thd, lex_mi, errmsg)) if (translate_master(thd, lex_mi, errmsg))

View File

@ -2739,7 +2739,7 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
thd->server_id = ev->server_id; // use the original server id for logging thd->server_id = ev->server_id; // use the original server id for logging
thd->set_time(); // time the query thd->set_time(); // time the query
thd->lex.current_select= 0; thd->lex->current_select= 0;
if (!ev->when) if (!ev->when)
ev->when = time(NULL); ev->when = time(NULL);
ev->thd = thd; ev->thd = thd;

View File

@ -1476,7 +1476,7 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
if (table->fields >= 31) /* From 4.0.0 we have more fields */ if (table->fields >= 31) /* From 4.0.0 we have more fields */
{ {
/* We write down SSL related ACL stuff */ /* We write down SSL related ACL stuff */
switch (thd->lex.ssl_type) { switch (thd->lex->ssl_type) {
case SSL_TYPE_ANY: case SSL_TYPE_ANY:
table->field[24]->store("ANY",3, &my_charset_latin1); table->field[24]->store("ANY",3, &my_charset_latin1);
table->field[25]->store("", 0, &my_charset_latin1); table->field[25]->store("", 0, &my_charset_latin1);
@ -1494,15 +1494,15 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
table->field[25]->store("", 0, &my_charset_latin1); table->field[25]->store("", 0, &my_charset_latin1);
table->field[26]->store("", 0, &my_charset_latin1); table->field[26]->store("", 0, &my_charset_latin1);
table->field[27]->store("", 0, &my_charset_latin1); table->field[27]->store("", 0, &my_charset_latin1);
if (thd->lex.ssl_cipher) if (thd->lex->ssl_cipher)
table->field[25]->store(thd->lex.ssl_cipher, table->field[25]->store(thd->lex->ssl_cipher,
strlen(thd->lex.ssl_cipher), &my_charset_latin1); strlen(thd->lex->ssl_cipher), &my_charset_latin1);
if (thd->lex.x509_issuer) if (thd->lex->x509_issuer)
table->field[26]->store(thd->lex.x509_issuer, table->field[26]->store(thd->lex->x509_issuer,
strlen(thd->lex.x509_issuer), &my_charset_latin1); strlen(thd->lex->x509_issuer), &my_charset_latin1);
if (thd->lex.x509_subject) if (thd->lex->x509_subject)
table->field[27]->store(thd->lex.x509_subject, table->field[27]->store(thd->lex->x509_subject,
strlen(thd->lex.x509_subject), &my_charset_latin1); strlen(thd->lex->x509_subject), &my_charset_latin1);
break; break;
case SSL_TYPE_NOT_SPECIFIED: case SSL_TYPE_NOT_SPECIFIED:
break; break;
@ -1514,7 +1514,7 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
break; break;
} }
USER_RESOURCES mqh = thd->lex.mqh; USER_RESOURCES mqh= thd->lex->mqh;
if (mqh.bits & 1) if (mqh.bits & 1)
table->field[28]->store((longlong) mqh.questions); table->field[28]->store((longlong) mqh.questions);
if (mqh.bits & 2) if (mqh.bits & 2)
@ -1555,19 +1555,19 @@ end:
acl_cache->clear(1); // Clear privilege cache acl_cache->clear(1); // Clear privilege cache
if (old_row_exists) if (old_row_exists)
acl_update_user(combo.user.str, combo.host.str, password, password_len, acl_update_user(combo.user.str, combo.host.str, password, password_len,
thd->lex.ssl_type, thd->lex->ssl_type,
thd->lex.ssl_cipher, thd->lex->ssl_cipher,
thd->lex.x509_issuer, thd->lex->x509_issuer,
thd->lex.x509_subject, thd->lex->x509_subject,
&thd->lex.mqh, &thd->lex->mqh,
rights); rights);
else else
acl_insert_user(combo.user.str, combo.host.str, password, password_len, acl_insert_user(combo.user.str, combo.host.str, password, password_len,
thd->lex.ssl_type, thd->lex->ssl_type,
thd->lex.ssl_cipher, thd->lex->ssl_cipher,
thd->lex.x509_issuer, thd->lex->x509_issuer,
thd->lex.x509_subject, thd->lex->x509_subject,
&thd->lex.mqh, &thd->lex->mqh,
rights); rights);
} }
table->file->index_end(); table->file->index_end();

View File

@ -2198,7 +2198,7 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
DBUG_ENTER("setup_conds"); DBUG_ENTER("setup_conds");
thd->set_query_id=1; thd->set_query_id=1;
thd->lex.current_select->cond_count= 0; thd->lex->current_select->cond_count= 0;
if (*conds) if (*conds)
{ {
thd->where="where clause"; thd->where="where clause";
@ -2217,7 +2217,7 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
if (table->on_expr->fix_fields(thd, tables, &table->on_expr) || if (table->on_expr->fix_fields(thd, tables, &table->on_expr) ||
table->on_expr->check_cols(1)) table->on_expr->check_cols(1))
DBUG_RETURN(1); DBUG_RETURN(1);
thd->lex.current_select->cond_count++; thd->lex->current_select->cond_count++;
/* /*
If it's a normal join or a LEFT JOIN which can be optimized away If it's a normal join or a LEFT JOIN which can be optimized away
@ -2269,7 +2269,7 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
} }
} }
cond_and->used_tables_cache= t1->map | t2->map; cond_and->used_tables_cache= t1->map | t2->map;
thd->lex.current_select->cond_count+=cond_and->list.elements; thd->lex->current_select->cond_count+= cond_and->list.elements;
if (!table->outer_join) // Not left join if (!table->outer_join) // Not left join
{ {
if (!(*conds=and_conds(*conds, cond_and))) if (!(*conds=and_conds(*conds, cond_and)))

View File

@ -289,7 +289,7 @@ TODO list:
if (thd->temp_tables || global_merge_table_count) if (thd->temp_tables || global_merge_table_count)
- Another option would be to set thd->lex.safe_to_cache_query to 0 - Another option would be to set thd->lex->safe_to_cache_query to 0
in 'get_lock_data' if any of the tables was a tmp table or a in 'get_lock_data' if any of the tables was a tmp table or a
MRG_ISAM table. MRG_ISAM table.
(This could be done with almost no speed penalty) (This could be done with almost no speed penalty)
@ -761,7 +761,7 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
uint8 tables_type= 0; uint8 tables_type= 0;
if ((local_tables= is_cacheable(thd, thd->query_length, if ((local_tables= is_cacheable(thd, thd->query_length,
thd->query, &thd->lex, tables_used, thd->query, thd->lex, tables_used,
&tables_type))) &tables_type)))
{ {
NET *net= &thd->net; NET *net= &thd->net;
@ -913,7 +913,7 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
/* Check that we haven't forgot to reset the query cache variables */ /* Check that we haven't forgot to reset the query cache variables */
DBUG_ASSERT(thd->net.query_cache_query == 0); DBUG_ASSERT(thd->net.query_cache_query == 0);
if (!thd->lex.safe_to_cache_query) if (!thd->lex->safe_to_cache_query)
{ {
DBUG_PRINT("qcache", ("SELECT is non-cacheable")); DBUG_PRINT("qcache", ("SELECT is non-cacheable"));
goto err; goto err;
@ -1018,7 +1018,7 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
table_list.db, table_list.alias)); table_list.db, table_list.alias));
refused++; // This is actually a hit refused++; // This is actually a hit
STRUCT_UNLOCK(&structure_guard_mutex); STRUCT_UNLOCK(&structure_guard_mutex);
thd->lex.safe_to_cache_query=0; // Don't try to cache this thd->lex->safe_to_cache_query=0; // Don't try to cache this
BLOCK_UNLOCK_RD(query_block); BLOCK_UNLOCK_RD(query_block);
DBUG_RETURN(-1); // Privilege error DBUG_RETURN(-1); // Privilege error
} }
@ -1027,7 +1027,7 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
DBUG_PRINT("qcache", ("Need to check column privileges for %s.%s", DBUG_PRINT("qcache", ("Need to check column privileges for %s.%s",
table_list.db, table_list.alias)); table_list.db, table_list.alias));
BLOCK_UNLOCK_RD(query_block); BLOCK_UNLOCK_RD(query_block);
thd->lex.safe_to_cache_query= 0; // Don't try to cache this thd->lex->safe_to_cache_query= 0; // Don't try to cache this
goto err_unlock; // Parse query goto err_unlock; // Parse query
} }
#endif /*!NO_EMBEDDED_ACCESS_CHECKS*/ #endif /*!NO_EMBEDDED_ACCESS_CHECKS*/
@ -1038,7 +1038,7 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
DBUG_PRINT("qcache", ("Handler does not allow caching for %s.%s", DBUG_PRINT("qcache", ("Handler does not allow caching for %s.%s",
table_list.db, table_list.alias)); table_list.db, table_list.alias));
BLOCK_UNLOCK_RD(query_block); BLOCK_UNLOCK_RD(query_block);
thd->lex.safe_to_cache_query= 0; // Don't try to cache this thd->lex->safe_to_cache_query= 0; // Don't try to cache this
goto err_unlock; // Parse query goto err_unlock; // Parse query
} }
else else
@ -2615,7 +2615,7 @@ my_bool Query_cache::ask_handler_allowance(THD *thd,
{ {
DBUG_PRINT("qcache", ("Handler does not allow caching for %s.%s", DBUG_PRINT("qcache", ("Handler does not allow caching for %s.%s",
tables_used->db, tables_used->alias)); tables_used->db, tables_used->alias));
thd->lex.safe_to_cache_query= 0; // Don't try to cache this thd->lex->safe_to_cache_query= 0; // Don't try to cache this
DBUG_RETURN(1); DBUG_RETURN(1);
} }
} }

View File

@ -89,6 +89,7 @@ THD::THD():user_time(0), is_fatal_error(0),
global_read_lock(0), bootstrap(0) global_read_lock(0), bootstrap(0)
{ {
host=user=priv_user=db=query=ip=0; host=user=priv_user=db=query=ip=0;
lex= &main_lex;
host_or_ip= "connecting host"; host_or_ip= "connecting host";
locked=killed=some_tables_deleted=no_errors=password= 0; locked=killed=some_tables_deleted=no_errors=password= 0;
query_start_used= 0; query_start_used= 0;
@ -103,7 +104,7 @@ THD::THD():user_time(0), is_fatal_error(0),
used_tables=0; used_tables=0;
cuted_fields= sent_row_count= current_stmt_id= 0L; cuted_fields= sent_row_count= current_stmt_id= 0L;
// Must be reset to handle error with THD's created for init of mysqld // Must be reset to handle error with THD's created for init of mysqld
lex.current_select= 0; lex->current_select= 0;
start_time=(time_t) 0; start_time=(time_t) 0;
current_linfo = 0; current_linfo = 0;
slave_thread = 0; slave_thread = 0;
@ -1186,7 +1187,7 @@ int select_dumpvar::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
{ {
ls= gl++; ls= gl++;
Item_func_set_user_var *xx = new Item_func_set_user_var(*ls,item); Item_func_set_user_var *xx = new Item_func_set_user_var(*ls,item);
xx->fix_fields(thd,(TABLE_LIST*) thd->lex.select_lex.table_list.first,&item); xx->fix_fields(thd,(TABLE_LIST*) thd->lex->select_lex.table_list.first,&item);
xx->fix_length_and_dec(); xx->fix_length_and_dec();
vars.push_back(xx); vars.push_back(xx);
} }

View File

@ -446,7 +446,8 @@ public:
ulong extra_length; ulong extra_length;
#endif #endif
NET net; // client connection descriptor NET net; // client connection descriptor
LEX lex; // parse tree descriptor LEX main_lex;
LEX *lex; // parse tree descriptor
MEM_ROOT mem_root; // 1 command-life memory pool MEM_ROOT mem_root; // 1 command-life memory pool
MEM_ROOT con_root; // connection-life memory MEM_ROOT con_root; // connection-life memory
MEM_ROOT warn_root; // For warnings and errors MEM_ROOT warn_root; // For warnings and errors

View File

@ -38,18 +38,18 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
bool transactional_table, log_delayed, safe_update, const_cond; bool transactional_table, log_delayed, safe_update, const_cond;
ha_rows deleted; ha_rows deleted;
TABLE_LIST *delete_table_list= (TABLE_LIST*) TABLE_LIST *delete_table_list= (TABLE_LIST*)
thd->lex.select_lex.table_list.first; thd->lex->select_lex.table_list.first;
DBUG_ENTER("mysql_delete"); DBUG_ENTER("mysql_delete");
if ((open_and_lock_tables(thd, table_list))) if ((open_and_lock_tables(thd, table_list)))
DBUG_RETURN(-1); DBUG_RETURN(-1);
fix_tables_pointers(thd->lex.all_selects_list); fix_tables_pointers(thd->lex->all_selects_list);
table= table_list->table; table= table_list->table;
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK); table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
thd->proc_info="init"; thd->proc_info="init";
table->map=1; table->map=1;
if (setup_conds(thd, delete_table_list, &conds) || if (setup_conds(thd, delete_table_list, &conds) ||
setup_ftfuncs(&thd->lex.select_lex)) setup_ftfuncs(&thd->lex->select_lex))
DBUG_RETURN(-1); DBUG_RETURN(-1);
if (find_real_table_in_list(table_list->next, if (find_real_table_in_list(table_list->next,
table_list->db, table_list->real_name)) table_list->db, table_list->real_name))
@ -66,8 +66,8 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
DBUG_RETURN(1); DBUG_RETURN(1);
} }
if (thd->lex.duplicates == DUP_IGNORE) if (thd->lex->duplicates == DUP_IGNORE)
thd->lex.select_lex.no_error= 1; thd->lex->select_lex.no_error= 1;
/* Test if the user wants to delete all rows */ /* Test if the user wants to delete all rows */
if (!using_limit && const_cond && (!conds || conds->val_int()) && if (!using_limit && const_cond && (!conds || conds->val_int()) &&
@ -96,7 +96,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
if ((select && select->check_quick(thd, safe_update, limit)) || !limit) if ((select && select->check_quick(thd, safe_update, limit)) || !limit)
{ {
delete select; delete select;
free_underlaid_joins(thd, &thd->lex.select_lex); free_underlaid_joins(thd, &thd->lex->select_lex);
send_ok(thd,0L); send_ok(thd,0L);
DBUG_RETURN(0); // Nothing to delete DBUG_RETURN(0); // Nothing to delete
} }
@ -108,7 +108,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
if (safe_update && !using_limit) if (safe_update && !using_limit)
{ {
delete select; delete select;
free_underlaid_joins(thd, &thd->lex.select_lex); free_underlaid_joins(thd, &thd->lex->select_lex);
send_error(thd,ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE); send_error(thd,ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
@ -130,8 +130,8 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
table->sort.io_cache = (IO_CACHE *) my_malloc(sizeof(IO_CACHE), table->sort.io_cache = (IO_CACHE *) my_malloc(sizeof(IO_CACHE),
MYF(MY_FAE | MY_ZEROFILL)); MYF(MY_FAE | MY_ZEROFILL));
if (thd->lex.select_lex.setup_ref_array(thd, 0) || if (thd->lex->select_lex.setup_ref_array(thd, 0) ||
setup_order(thd, thd->lex.select_lex.ref_pointer_array, &tables, setup_order(thd, thd->lex->select_lex.ref_pointer_array, &tables,
fields, all_fields, order) || fields, all_fields, order) ||
!(sortorder=make_unireg_sortorder(order, &length)) || !(sortorder=make_unireg_sortorder(order, &length)) ||
(table->sort.found_records = filesort(thd, table, sortorder, length, (table->sort.found_records = filesort(thd, table, sortorder, length,
@ -140,7 +140,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
== HA_POS_ERROR) == HA_POS_ERROR)
{ {
delete select; delete select;
free_underlaid_joins(thd, &thd->lex.select_lex); free_underlaid_joins(thd, &thd->lex->select_lex);
DBUG_RETURN(-1); // This will force out message DBUG_RETURN(-1); // This will force out message
} }
/* /*
@ -153,7 +153,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
init_read_record(&info,thd,table,select,1,1); init_read_record(&info,thd,table,select,1,1);
deleted=0L; deleted=0L;
init_ftfuncs(thd, &thd->lex.select_lex, 1); init_ftfuncs(thd, &thd->lex->select_lex, 1);
thd->proc_info="updating"; thd->proc_info="updating";
while (!(error=info.read_record(&info)) && !thd->killed && while (!(error=info.read_record(&info)) && !thd->killed &&
!thd->net.report_error) !thd->net.report_error)
@ -233,7 +233,7 @@ cleanup:
thd->lock=0; thd->lock=0;
} }
delete select; delete select;
free_underlaid_joins(thd, &thd->lex.select_lex); free_underlaid_joins(thd, &thd->lex->select_lex);
if (error >= 0 || thd->net.report_error) if (error >= 0 || thd->net.report_error)
send_error(thd,thd->killed ? ER_SERVER_SHUTDOWN: 0); send_error(thd,thd->killed ? ER_SERVER_SHUTDOWN: 0);
else else
@ -323,7 +323,7 @@ multi_delete::initialize_tables(JOIN *join)
table->file->ref_length, table->file->ref_length,
MEM_STRIP_BUF_SIZE); MEM_STRIP_BUF_SIZE);
} }
init_ftfuncs(thd, thd->lex.current_select, 1); init_ftfuncs(thd, thd->lex->current_select, 1);
DBUG_RETURN(thd->is_fatal_error != 0); DBUG_RETURN(thd->is_fatal_error != 0);
} }

View File

@ -185,7 +185,7 @@ my_bool mysqld_show_warnings(THD *thd, ulong levels_to_show)
DBUG_RETURN(1); DBUG_RETURN(1);
MYSQL_ERROR *err; MYSQL_ERROR *err;
SELECT_LEX *sel= &thd->lex.select_lex; SELECT_LEX *sel= &thd->lex->select_lex;
ha_rows offset= sel->offset_limit, limit= sel->select_limit; ha_rows offset= sel->offset_limit, limit= sel->select_limit;
Protocol *protocol=thd->protocol; Protocol *protocol=thd->protocol;

View File

@ -131,7 +131,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
char *query=thd->query; char *query=thd->query;
thr_lock_type lock_type = table_list->lock_type; thr_lock_type lock_type = table_list->lock_type;
TABLE_LIST *insert_table_list= (TABLE_LIST*) TABLE_LIST *insert_table_list= (TABLE_LIST*)
thd->lex.select_lex.table_list.first; thd->lex->select_lex.table_list.first;
DBUG_ENTER("mysql_insert"); DBUG_ENTER("mysql_insert");
#ifndef NO_EMBEDDED_ACCESS_CHECKS #ifndef NO_EMBEDDED_ACCESS_CHECKS
@ -188,7 +188,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
res= open_and_lock_tables(thd, table_list); res= open_and_lock_tables(thd, table_list);
if (res) if (res)
DBUG_RETURN(-1); DBUG_RETURN(-1);
fix_tables_pointers(thd->lex.all_selects_list); fix_tables_pointers(thd->lex->all_selects_list);
table= table_list->table; table= table_list->table;
thd->proc_info="init"; thd->proc_info="init";
@ -429,14 +429,14 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
(ulong) info.deleted, (ulong) thd->cuted_fields); (ulong) info.deleted, (ulong) thd->cuted_fields);
::send_ok(thd,info.copied+info.deleted,(ulonglong)id,buff); ::send_ok(thd,info.copied+info.deleted,(ulonglong)id,buff);
} }
free_underlaid_joins(thd, &thd->lex.select_lex); free_underlaid_joins(thd, &thd->lex->select_lex);
table->insert_values=0; table->insert_values=0;
DBUG_RETURN(0); DBUG_RETURN(0);
abort: abort:
if (lock_type == TL_WRITE_DELAYED) if (lock_type == TL_WRITE_DELAYED)
end_delayed_insert(thd); end_delayed_insert(thd);
free_underlaid_joins(thd, &thd->lex.select_lex); free_underlaid_joins(thd, &thd->lex->select_lex);
table->insert_values=0; table->insert_values=0;
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
@ -644,7 +644,7 @@ public:
thd.current_tablenr=0; thd.current_tablenr=0;
thd.version=refresh_version; thd.version=refresh_version;
thd.command=COM_DELAYED_INSERT; thd.command=COM_DELAYED_INSERT;
thd.lex.current_select= 0; /* for my_message_sql */ thd.lex->current_select= 0; /* for my_message_sql */
bzero((char*) &thd.net,sizeof(thd.net)); // Safety bzero((char*) &thd.net,sizeof(thd.net)); // Safety
thd.system_thread= SYSTEM_THREAD_DELAYED_INSERT; thd.system_thread= SYSTEM_THREAD_DELAYED_INSERT;

View File

@ -115,7 +115,7 @@ void lex_free(void)
LEX *lex_start(THD *thd, uchar *buf,uint length) LEX *lex_start(THD *thd, uchar *buf,uint length)
{ {
LEX *lex= &thd->lex; LEX *lex= thd->lex;
lex->thd= thd; lex->thd= thd;
lex->next_state=MY_LEX_START; lex->next_state=MY_LEX_START;
lex->end_of_query=(lex->ptr=buf)+length; lex->end_of_query=(lex->ptr=buf)+length;
@ -433,7 +433,7 @@ int yylex(void *arg, void *yythd)
int tokval, result_state; int tokval, result_state;
uint length; uint length;
enum my_lex_states state; enum my_lex_states state;
LEX *lex= &(((THD *)yythd)->lex); LEX *lex= ((THD *)yythd)->lex;
YYSTYPE *yylval=(YYSTYPE*) arg; YYSTYPE *yylval=(YYSTYPE*) arg;
CHARSET_INFO *cs= ((THD *) yythd)->charset(); CHARSET_INFO *cs= ((THD *) yythd)->charset();
uchar *state_map= cs->state_map; uchar *state_map= cs->state_map;

View File

@ -611,4 +611,4 @@ extern pthread_key(LEX*,THR_LEX);
extern LEX_STRING tmp_table_alias; extern LEX_STRING tmp_table_alias;
#define current_lex (&current_thd->lex) #define current_lex (current_thd->lex)

View File

@ -1176,7 +1176,7 @@ bool do_command(THD *thd)
indicator of uninitialized lex => normal flow of errors handling indicator of uninitialized lex => normal flow of errors handling
(see my_message_sql) (see my_message_sql)
*/ */
thd->lex.current_select= 0; thd->lex->current_select= 0;
packet=0; packet=0;
old_timeout=net->read_timeout; old_timeout=net->read_timeout;
@ -1383,16 +1383,16 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
DBUG_PRINT("query",("%-.4096s",thd->query)); DBUG_PRINT("query",("%-.4096s",thd->query));
mysql_parse(thd,thd->query, thd->query_length); mysql_parse(thd,thd->query, thd->query_length);
while (!thd->killed && !thd->is_fatal_error && thd->lex.found_colon) while (!thd->killed && !thd->is_fatal_error && thd->lex->found_colon)
{ {
char *packet= thd->lex.found_colon; char *packet= thd->lex->found_colon;
/* /*
Multiple queries exits, execute them individually Multiple queries exits, execute them individually
*/ */
if (thd->lock || thd->open_tables || thd->derived_tables) if (thd->lock || thd->open_tables || thd->derived_tables)
close_thread_tables(thd); close_thread_tables(thd);
ulong length= thd->query_length-(ulong)(thd->lex.found_colon-thd->query); ulong length= thd->query_length-(ulong)(thd->lex->found_colon-thd->query);
/* Remove garbage at start of query */ /* Remove garbage at start of query */
while (my_isspace(thd->charset(), *packet) && length > 0) while (my_isspace(thd->charset(), *packet) && length > 0)
@ -1736,7 +1736,7 @@ void
mysql_execute_command(THD *thd) mysql_execute_command(THD *thd)
{ {
int res= 0; int res= 0;
LEX *lex= &thd->lex; LEX *lex= thd->lex;
TABLE_LIST *tables= (TABLE_LIST*) lex->select_lex.table_list.first; TABLE_LIST *tables= (TABLE_LIST*) lex->select_lex.table_list.first;
SELECT_LEX *select_lex= &lex->select_lex; SELECT_LEX *select_lex= &lex->select_lex;
SELECT_LEX_UNIT *unit= &lex->unit; SELECT_LEX_UNIT *unit= &lex->unit;
@ -1865,7 +1865,7 @@ mysql_execute_command(THD *thd)
else else
thd->send_explain_fields(result); thd->send_explain_fields(result);
fix_tables_pointers(lex->all_selects_list); fix_tables_pointers(lex->all_selects_list);
res= mysql_explain_union(thd, &thd->lex.unit, result); res= mysql_explain_union(thd, &thd->lex->unit, result);
MYSQL_LOCK *save_lock= thd->lock; MYSQL_LOCK *save_lock= thd->lock;
thd->lock= (MYSQL_LOCK *)0; thd->lock= (MYSQL_LOCK *)0;
if (lex->describe & DESCRIBE_EXTENDED) if (lex->describe & DESCRIBE_EXTENDED)
@ -1873,7 +1873,7 @@ mysql_execute_command(THD *thd)
char buff[1024]; char buff[1024];
String str(buff,(uint32) sizeof(buff), system_charset_info); String str(buff,(uint32) sizeof(buff), system_charset_info);
str.length(0); str.length(0);
thd->lex.unit.print(&str); thd->lex->unit.print(&str);
str.append('\0'); str.append('\0');
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_YES, str.ptr()); ER_YES, str.ptr());
@ -2634,7 +2634,7 @@ mysql_execute_command(THD *thd)
} }
case SQLCOM_DELETE_MULTI: case SQLCOM_DELETE_MULTI:
{ {
TABLE_LIST *aux_tables=(TABLE_LIST *)thd->lex.auxilliary_table_list.first; TABLE_LIST *aux_tables= (TABLE_LIST *)thd->lex->auxilliary_table_list.first;
TABLE_LIST *auxi; TABLE_LIST *auxi;
uint table_count=0; uint table_count=0;
multi_delete *result; multi_delete *result;
@ -3693,7 +3693,7 @@ void
mysql_init_query(THD *thd) mysql_init_query(THD *thd)
{ {
DBUG_ENTER("mysql_init_query"); DBUG_ENTER("mysql_init_query");
LEX *lex=&thd->lex; LEX *lex= thd->lex;
lex->unit.init_query(); lex->unit.init_query();
lex->unit.init_select(); lex->unit.init_select();
lex->unit.thd= thd; lex->unit.thd= thd;
@ -3821,7 +3821,7 @@ void create_select_for_variable(const char *var_name)
DBUG_ENTER("create_select_for_variable"); DBUG_ENTER("create_select_for_variable");
thd= current_thd; thd= current_thd;
lex= &thd->lex; lex= thd->lex;
mysql_init_select(lex); mysql_init_select(lex);
lex->sql_command= SQLCOM_SELECT; lex->sql_command= SQLCOM_SELECT;
tmp.str= (char*) var_name; tmp.str= (char*) var_name;
@ -3899,7 +3899,7 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
uint uint_geom_type) uint uint_geom_type)
{ {
register create_field *new_field; register create_field *new_field;
LEX *lex= &thd->lex; LEX *lex= thd->lex;
uint allowed_type_modifier=0; uint allowed_type_modifier=0;
char warn_buff[MYSQL_ERRMSG_SIZE]; char warn_buff[MYSQL_ERRMSG_SIZE];
DBUG_ENTER("add_field_to_list"); DBUG_ENTER("add_field_to_list");
@ -4233,7 +4233,7 @@ add_proc_to_list(THD* thd, Item *item)
*item_ptr= item; *item_ptr= item;
order->item=item_ptr; order->item=item_ptr;
order->free_me=0; order->free_me=0;
thd->lex.proc_list.link_in_list((byte*) order,(byte**) &order->next); thd->lex->proc_list.link_in_list((byte*) order,(byte**) &order->next);
return 0; return 0;
} }
@ -4715,11 +4715,11 @@ static bool append_file_to_dir(THD *thd, char **filename_ptr, char *table_name)
bool check_simple_select() bool check_simple_select()
{ {
THD *thd= current_thd; THD *thd= current_thd;
if (thd->lex.current_select != &thd->lex.select_lex) if (thd->lex->current_select != &thd->lex->select_lex)
{ {
char command[80]; char command[80];
strmake(command, thd->lex.yylval->symbol.str, strmake(command, thd->lex->yylval->symbol.str,
min(thd->lex.yylval->symbol.length, sizeof(command)-1)); min(thd->lex->yylval->symbol.length, sizeof(command)-1));
net_printf(thd, ER_CANT_USE_OPTION_HERE, command); net_printf(thd, ER_CANT_USE_OPTION_HERE, command);
return 1; return 1;
} }

View File

@ -421,7 +421,7 @@ void setup_param_functions(Item_param *param, uchar param_type)
static bool insert_params_withlog(PREP_STMT *stmt, uchar *pos, uchar *read_pos) static bool insert_params_withlog(PREP_STMT *stmt, uchar *pos, uchar *read_pos)
{ {
THD *thd= stmt->thd; THD *thd= stmt->thd;
List<Item> &params= thd->lex.param_list; List<Item> &params= thd->lex->param_list;
List_iterator<Item> param_iterator(params); List_iterator<Item> param_iterator(params);
Item_param *param; Item_param *param;
DBUG_ENTER("insert_params_withlog"); DBUG_ENTER("insert_params_withlog");
@ -467,7 +467,7 @@ static bool insert_params_withlog(PREP_STMT *stmt, uchar *pos, uchar *read_pos)
static bool insert_params(PREP_STMT *stmt, uchar *pos, uchar *read_pos) static bool insert_params(PREP_STMT *stmt, uchar *pos, uchar *read_pos)
{ {
THD *thd= stmt->thd; THD *thd= stmt->thd;
List<Item> &params= thd->lex.param_list; List<Item> &params= thd->lex->param_list;
List_iterator<Item> param_iterator(params); List_iterator<Item> param_iterator(params);
Item_param *param; Item_param *param;
DBUG_ENTER("insert_params"); DBUG_ENTER("insert_params");
@ -493,7 +493,7 @@ static bool insert_params(PREP_STMT *stmt, uchar *pos, uchar *read_pos)
static bool setup_params_data(PREP_STMT *stmt) static bool setup_params_data(PREP_STMT *stmt)
{ {
THD *thd= stmt->thd; THD *thd= stmt->thd;
List<Item> &params= thd->lex.param_list; List<Item> &params= thd->lex->param_list;
List_iterator<Item> param_iterator(params); List_iterator<Item> param_iterator(params);
Item_param *param; Item_param *param;
DBUG_ENTER("setup_params_data"); DBUG_ENTER("setup_params_data");
@ -538,8 +538,8 @@ static bool mysql_test_insert_fields(PREP_STMT *stmt,
DBUG_ENTER("mysql_test_insert_fields"); DBUG_ENTER("mysql_test_insert_fields");
#ifndef NO_EMBEDDED_ACCESS_CHECKS #ifndef NO_EMBEDDED_ACCESS_CHECKS
my_bool update=(thd->lex.value_list.elements ? UPDATE_ACL : 0); my_bool update=(thd->lex->value_list.elements ? UPDATE_ACL : 0);
ulong privilege= (thd->lex.duplicates == DUP_REPLACE ? ulong privilege= (thd->lex->duplicates == DUP_REPLACE ?
INSERT_ACL | DELETE_ACL : INSERT_ACL | update); INSERT_ACL | DELETE_ACL : INSERT_ACL | update);
if (check_access(thd,privilege,table_list->db, if (check_access(thd,privilege,table_list->db,
@ -640,8 +640,8 @@ static bool mysql_test_select_fields(PREP_STMT *stmt, TABLE_LIST *tables,
SELECT_LEX *select_lex) SELECT_LEX *select_lex)
{ {
THD *thd= stmt->thd; THD *thd= stmt->thd;
LEX *lex= &thd->lex; LEX *lex= &thd->main_lex;
select_result *result= thd->lex.result; select_result *result= thd->lex->result;
DBUG_ENTER("mysql_test_select_fields"); DBUG_ENTER("mysql_test_select_fields");
#ifndef NO_EMBEDDED_ACCESS_CHECKS #ifndef NO_EMBEDDED_ACCESS_CHECKS
@ -668,7 +668,7 @@ static bool mysql_test_select_fields(PREP_STMT *stmt, TABLE_LIST *tables,
} }
else else
{ {
fix_tables_pointers(thd->lex.all_selects_list); fix_tables_pointers(thd->lex->all_selects_list);
if (!result && !(result= new select_send())) if (!result && !(result= new select_send()))
{ {
send_error(thd, ER_OUT_OF_RESOURCES); send_error(thd, ER_OUT_OF_RESOURCES);
@ -702,8 +702,8 @@ static bool mysql_test_select_fields(PREP_STMT *stmt, TABLE_LIST *tables,
static bool send_prepare_results(PREP_STMT *stmt) static bool send_prepare_results(PREP_STMT *stmt)
{ {
THD *thd= stmt->thd; THD *thd= stmt->thd;
LEX *lex= &thd->lex; LEX *lex= &thd->main_lex;
enum enum_sql_command sql_command= thd->lex.sql_command; enum enum_sql_command sql_command= thd->lex->sql_command;
DBUG_ENTER("send_prepare_results"); DBUG_ENTER("send_prepare_results");
DBUG_PRINT("enter",("command: %d, param_count: %ld", DBUG_PRINT("enter",("command: %d, param_count: %ld",
sql_command, lex->param_count)); sql_command, lex->param_count));
@ -783,7 +783,7 @@ static bool parse_prepare_query(PREP_STMT *stmt,
mysql_init_query(thd); mysql_init_query(thd);
LEX *lex=lex_start(thd, (uchar*) packet, length); LEX *lex=lex_start(thd, (uchar*) packet, length);
lex->safe_to_cache_query= 0; lex->safe_to_cache_query= 0;
thd->lex.param_count= 0; thd->lex->param_count= 0;
if (!yyparse((void *)thd) && !thd->is_fatal_error) if (!yyparse((void *)thd) && !thd->is_fatal_error)
error= send_prepare_results(stmt); error= send_prepare_results(stmt);
lex_end(lex); lex_end(lex);
@ -797,11 +797,11 @@ static bool parse_prepare_query(PREP_STMT *stmt,
static bool init_param_items(PREP_STMT *stmt) static bool init_param_items(PREP_STMT *stmt)
{ {
THD *thd= stmt->thd; THD *thd= stmt->thd;
List<Item> &params= thd->lex.param_list; List<Item> &params= thd->lex->param_list;
Item_param **to; Item_param **to;
uint32 length= thd->query_length; uint32 length= thd->query_length;
stmt->lex= thd->lex; stmt->lex= thd->main_lex;
if (mysql_bin_log.is_open() || mysql_update_log.is_open()) if (mysql_bin_log.is_open() || mysql_update_log.is_open())
{ {
@ -850,7 +850,7 @@ static bool init_param_items(PREP_STMT *stmt)
static void init_stmt_execute(PREP_STMT *stmt) static void init_stmt_execute(PREP_STMT *stmt)
{ {
THD *thd= stmt->thd; THD *thd= stmt->thd;
TABLE_LIST *tables= (TABLE_LIST*) thd->lex.select_lex.table_list.first; TABLE_LIST *tables= (TABLE_LIST*) thd->lex->select_lex.table_list.first;
/* /*
TODO: When the new table structure is ready, then have a status bit TODO: When the new table structure is ready, then have a status bit
@ -908,7 +908,7 @@ bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length)
my_pthread_setprio(pthread_self(),WAIT_PRIOR); my_pthread_setprio(pthread_self(),WAIT_PRIOR);
// save WHERE clause pointers to avoid damaging they by optimisation // save WHERE clause pointers to avoid damaging they by optimisation
for (sl= thd->lex.all_selects_list; for (sl= thd->lex->all_selects_list;
sl; sl;
sl= sl->next_select_in_list()) sl= sl->next_select_in_list())
{ {
@ -961,8 +961,8 @@ void mysql_stmt_execute(THD *thd, char *packet)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
LEX thd_lex= thd->lex; LEX thd_lex= thd->main_lex;
thd->lex= stmt->lex; thd->main_lex= stmt->lex;
for (sl= stmt->lex.all_selects_list; for (sl= stmt->lex.all_selects_list;
sl; sl;
@ -1001,7 +1001,7 @@ void mysql_stmt_execute(THD *thd, char *packet)
if (!(specialflag & SPECIAL_NO_PRIOR)) if (!(specialflag & SPECIAL_NO_PRIOR))
my_pthread_setprio(pthread_self(), WAIT_PRIOR); my_pthread_setprio(pthread_self(), WAIT_PRIOR);
thd->lex= thd_lex; thd->main_lex= thd_lex;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }

View File

@ -678,8 +678,8 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
was running (as we don't wan't to touch the other thread), so set the was running (as we don't wan't to touch the other thread), so set the
bit to 0 for the other thread bit to 0 for the other thread
*/ */
if (thd->lex.slave_thd_opt) if (thd->lex->slave_thd_opt)
thread_mask &= thd->lex.slave_thd_opt; thread_mask&= thd->lex->slave_thd_opt;
if (thread_mask) //some threads are stopped, start them if (thread_mask) //some threads are stopped, start them
{ {
if (init_master_info(mi,master_info_file,relay_log_info_file, 0)) if (init_master_info(mi,master_info_file,relay_log_info_file, 0))
@ -695,22 +695,22 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
{ {
pthread_mutex_lock(&mi->rli.data_lock); pthread_mutex_lock(&mi->rli.data_lock);
if (thd->lex.mi.pos) if (thd->lex->mi.pos)
{ {
mi->rli.until_condition= RELAY_LOG_INFO::UNTIL_MASTER_POS; mi->rli.until_condition= RELAY_LOG_INFO::UNTIL_MASTER_POS;
mi->rli.until_log_pos= thd->lex.mi.pos; mi->rli.until_log_pos= thd->lex->mi.pos;
/* /*
We don't check thd->lex.mi.log_file_name for NULL here We don't check thd->lex->mi.log_file_name for NULL here
since it is checked in sql_yacc.yy since it is checked in sql_yacc.yy
*/ */
strmake(mi->rli.until_log_name, thd->lex.mi.log_file_name, strmake(mi->rli.until_log_name, thd->lex->mi.log_file_name,
sizeof(mi->rli.until_log_name)-1); sizeof(mi->rli.until_log_name)-1);
} }
else if (thd->lex.mi.relay_log_pos) else if (thd->lex->mi.relay_log_pos)
{ {
mi->rli.until_condition= RELAY_LOG_INFO::UNTIL_RELAY_POS; mi->rli.until_condition= RELAY_LOG_INFO::UNTIL_RELAY_POS;
mi->rli.until_log_pos= thd->lex.mi.relay_log_pos; mi->rli.until_log_pos= thd->lex->mi.relay_log_pos;
strmake(mi->rli.until_log_name, thd->lex.mi.relay_log_name, strmake(mi->rli.until_log_name, thd->lex->mi.relay_log_name,
sizeof(mi->rli.until_log_name)-1); sizeof(mi->rli.until_log_name)-1);
} }
else else
@ -748,7 +748,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
pthread_mutex_unlock(&mi->rli.data_lock); pthread_mutex_unlock(&mi->rli.data_lock);
} }
else if (thd->lex.mi.pos || thd->lex.mi.relay_log_pos) else if (thd->lex->mi.pos || thd->lex->mi.relay_log_pos)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_UNTIL_COND_IGNORED, push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_UNTIL_COND_IGNORED,
ER(ER_UNTIL_COND_IGNORED)); ER(ER_UNTIL_COND_IGNORED));
@ -802,8 +802,8 @@ int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report )
was stopped (as we don't wan't to touch the other thread), so set the was stopped (as we don't wan't to touch the other thread), so set the
bit to 0 for the other thread bit to 0 for the other thread
*/ */
if (thd->lex.slave_thd_opt) if (thd->lex->slave_thd_opt)
thread_mask &= thd->lex.slave_thd_opt; thread_mask &= thd->lex->slave_thd_opt;
if (thread_mask) if (thread_mask)
{ {
@ -975,7 +975,7 @@ int change_master(THD* thd, MASTER_INFO* mi)
} }
thd->proc_info = "Changing master"; thd->proc_info = "Changing master";
LEX_MASTER_INFO* lex_mi = &thd->lex.mi; LEX_MASTER_INFO* lex_mi= &thd->lex->mi;
// TODO: see if needs re-write // TODO: see if needs re-write
if (init_master_info(mi, master_info_file, relay_log_info_file, 0)) if (init_master_info(mi, master_info_file, relay_log_info_file, 0))
{ {
@ -1204,7 +1204,7 @@ int show_binlog_events(THD* thd)
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())
{ {
LEX_MASTER_INFO *lex_mi = &thd->lex.mi; LEX_MASTER_INFO *lex_mi= &thd->lex->mi;
ha_rows event_count, limit_start, limit_end; ha_rows event_count, limit_start, limit_end;
my_off_t pos = max(BIN_LOG_HEADER_SIZE, lex_mi->pos); // user-friendly my_off_t pos = max(BIN_LOG_HEADER_SIZE, lex_mi->pos); // user-friendly
char search_file_name[FN_REFLEN], *name; char search_file_name[FN_REFLEN], *name;
@ -1213,8 +1213,8 @@ int show_binlog_events(THD* thd)
LOG_INFO linfo; LOG_INFO linfo;
Log_event* ev; Log_event* ev;
limit_start = thd->lex.current_select->offset_limit; limit_start= thd->lex->current_select->offset_limit;
limit_end = thd->lex.current_select->select_limit + limit_start; limit_end= thd->lex->current_select->select_limit + limit_start;
name= search_file_name; name= search_file_name;
if (log_file_name) if (log_file_name)

View File

@ -501,8 +501,8 @@ JOIN::optimize()
optimized= 1; optimized= 1;
// Ignore errors of execution if option IGNORE present // Ignore errors of execution if option IGNORE present
if (thd->lex.duplicates == DUP_IGNORE) if (thd->lex->duplicates == DUP_IGNORE)
thd->lex.current_select->no_error= 1; thd->lex->current_select->no_error= 1;
#ifdef HAVE_REF_TO_FIELDS // Not done yet #ifdef HAVE_REF_TO_FIELDS // Not done yet
/* Add HAVING to WHERE if possible */ /* Add HAVING to WHERE if possible */
if (having && !group_list && !sum_func_count) if (having && !group_list && !sum_func_count)
@ -1602,7 +1602,7 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
goto err; // 1 goto err; // 1
} }
if (thd->lex.describe & DESCRIBE_EXTENDED) if (thd->lex->describe & DESCRIBE_EXTENDED)
{ {
join->conds_history= join->conds; join->conds_history= join->conds;
join->having_history= (join->having?join->having:join->tmp_having); join->having_history= (join->having?join->having:join->tmp_having);
@ -1613,7 +1613,7 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
join->exec(); join->exec();
if (thd->lex.describe & DESCRIBE_EXTENDED) if (thd->lex->describe & DESCRIBE_EXTENDED)
{ {
select_lex->where= join->conds_history; select_lex->where= join->conds_history;
select_lex->having= join->having_history; select_lex->having= join->having_history;
@ -2459,7 +2459,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
if (!(key_fields=(KEY_FIELD*) if (!(key_fields=(KEY_FIELD*)
thd->alloc(sizeof(key_fields[0])* thd->alloc(sizeof(key_fields[0])*
(thd->lex.current_select->cond_count+1)*2))) (thd->lex->current_select->cond_count+1)*2)))
return TRUE; /* purecov: inspected */ return TRUE; /* purecov: inspected */
and_level= 0; and_level= 0;
field= end= key_fields; field= end= key_fields;
@ -3549,7 +3549,7 @@ static void
make_join_readinfo(JOIN *join, uint options) make_join_readinfo(JOIN *join, uint options)
{ {
uint i; uint i;
SELECT_LEX *select_lex = &(join->thd->lex.select_lex); SELECT_LEX *select_lex= &join->thd->lex->select_lex;
DBUG_ENTER("make_join_readinfo"); DBUG_ENTER("make_join_readinfo");
for (i=join->const_tables ; i < join->tables ; i++) for (i=join->const_tables ; i < join->tables ; i++)
@ -5461,7 +5461,7 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param,
thd->proc_info="converting HEAP to MyISAM"; thd->proc_info="converting HEAP to MyISAM";
if (create_myisam_tmp_table(&new_table,param, if (create_myisam_tmp_table(&new_table,param,
thd->lex.select_lex.options | thd->options)) thd->lex->select_lex.options | thd->options))
goto err2; goto err2;
if (open_tmp_table(&new_table)) if (open_tmp_table(&new_table))
goto err1; goto err1;
@ -8942,7 +8942,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
List<Item> field_list; List<Item> field_list;
List<Item> item_list; List<Item> item_list;
THD *thd=join->thd; THD *thd=join->thd;
SELECT_LEX *select_lex = &(join->thd->lex.select_lex); SELECT_LEX *select_lex= &join->thd->lex->select_lex;
select_result *result=join->result; select_result *result=join->result;
Item *item_null= new Item_null(); Item *item_null= new Item_null();
CHARSET_INFO *cs= &my_charset_latin1; CHARSET_INFO *cs= &my_charset_latin1;
@ -9129,8 +9129,8 @@ int mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
sl= sl->next_select()) sl= sl->next_select())
{ {
res= mysql_explain_select(thd, sl, res= mysql_explain_select(thd, sl,
(((&thd->lex.select_lex)==sl)? (((&thd->lex->select_lex)==sl)?
((thd->lex.all_selects_list != sl)?"PRIMARY": ((thd->lex->all_selects_list != sl)?"PRIMARY":
"SIMPLE"): "SIMPLE"):
((sl == first)? ((sl == first)?
((sl->linkage == DERIVED_TABLE_TYPE) ? ((sl->linkage == DERIVED_TABLE_TYPE) ?
@ -9160,7 +9160,7 @@ int mysql_explain_select(THD *thd, SELECT_LEX *select_lex, char const *type,
DBUG_ENTER("mysql_explain_select"); DBUG_ENTER("mysql_explain_select");
DBUG_PRINT("info", ("Select 0x%lx, type %s", (ulong)select_lex, type)) DBUG_PRINT("info", ("Select 0x%lx, type %s", (ulong)select_lex, type))
select_lex->type= type; select_lex->type= type;
thd->lex.current_select= select_lex; thd->lex->current_select= select_lex;
SELECT_LEX_UNIT *unit= select_lex->master_unit(); SELECT_LEX_UNIT *unit= select_lex->master_unit();
int res= mysql_select(thd, &select_lex->ref_pointer_array, int res= mysql_select(thd, &select_lex->ref_pointer_array,
(TABLE_LIST*) select_lex->table_list.first, (TABLE_LIST*) select_lex->table_list.first,
@ -9171,7 +9171,7 @@ int mysql_explain_select(THD *thd, SELECT_LEX *select_lex, char const *type,
(ORDER*) select_lex->order_list.first, (ORDER*) select_lex->order_list.first,
(ORDER*) select_lex->group_list.first, (ORDER*) select_lex->group_list.first,
select_lex->having, select_lex->having,
(ORDER*) thd->lex.proc_list.first, (ORDER*) thd->lex->proc_list.first,
select_lex->options | thd->options | SELECT_DESCRIBE, select_lex->options | thd->options | SELECT_DESCRIBE,
result, unit, select_lex); result, unit, select_lex);
DBUG_RETURN(res); DBUG_RETURN(res);
@ -9188,8 +9188,8 @@ void st_select_lex::print(THD *thd, String *str)
//options //options
if (options & SELECT_STRAIGHT_JOIN) if (options & SELECT_STRAIGHT_JOIN)
str->append("straight_join ", 14); str->append("straight_join ", 14);
if ((thd->lex.lock_option & TL_READ_HIGH_PRIORITY) && if ((thd->lex->lock_option & TL_READ_HIGH_PRIORITY) &&
(this == &thd->lex.select_lex)) (this == &thd->lex->select_lex))
str->append("high_priority ", 14); str->append("high_priority ", 14);
if (options & SELECT_DISTINCT) if (options & SELECT_DISTINCT)
str->append("distinct ", 9); str->append("distinct ", 9);
@ -9201,7 +9201,7 @@ void st_select_lex::print(THD *thd, String *str)
str->append("buffer_result ", 14); str->append("buffer_result ", 14);
if (options & OPTION_FOUND_ROWS) if (options & OPTION_FOUND_ROWS)
str->append("calc_found_rows ", 16); str->append("calc_found_rows ", 16);
if (!thd->lex.safe_to_cache_query) if (!thd->lex->safe_to_cache_query)
str->append("no_cache ", 9); str->append("no_cache ", 9);
if (options & OPTION_TO_QUERY_CACHE) if (options & OPTION_TO_QUERY_CACHE)
str->append("cache ", 6); str->append("cache ", 6);

View File

@ -1246,7 +1246,7 @@ static int prepare_for_restore(THD* thd, TABLE_LIST* table,
} }
else else
{ {
char* backup_dir = thd->lex.backup_dir; char* backup_dir= thd->lex->backup_dir;
char src_path[FN_REFLEN], dst_path[FN_REFLEN]; char src_path[FN_REFLEN], dst_path[FN_REFLEN];
char* table_name = table->real_name; char* table_name = table->real_name;
char* db = thd->db ? thd->db : table->db; char* db = thd->db ? thd->db : table->db;
@ -2696,8 +2696,8 @@ copy_data_between_tables(TABLE *from,TABLE *to,
tables.db = from->table_cache_key; tables.db = from->table_cache_key;
error=1; error=1;
if (thd->lex.select_lex.setup_ref_array(thd, order_num) || if (thd->lex->select_lex.setup_ref_array(thd, order_num) ||
setup_order(thd, thd->lex.select_lex.ref_pointer_array, setup_order(thd, thd->lex->select_lex.ref_pointer_array,
&tables, fields, all_fields, order) || &tables, fields, all_fields, order) ||
!(sortorder=make_unireg_sortorder(order, &length)) || !(sortorder=make_unireg_sortorder(order, &length)) ||
(from->sort.found_records = filesort(thd, from, sortorder, length, (from->sort.found_records = filesort(thd, from, sortorder, length,

View File

@ -108,7 +108,7 @@ bool select_union::flush()
int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result) int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result)
{ {
SELECT_LEX *lex_select_save= thd_arg->lex.current_select; SELECT_LEX *lex_select_save= thd_arg->lex->current_select;
SELECT_LEX *sl, *first_select; SELECT_LEX *sl, *first_select;
select_result *tmp_result; select_result *tmp_result;
DBUG_ENTER("st_select_lex_unit::prepare"); DBUG_ENTER("st_select_lex_unit::prepare");
@ -124,7 +124,7 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result)
prepared= 1; prepared= 1;
res= 0; res= 0;
thd_arg->lex.current_select= sl= first_select= first_select_in_union(); thd_arg->lex->current_select= sl= first_select= first_select_in_union();
found_rows_for_union= first_select->options & OPTION_FOUND_ROWS; found_rows_for_union= first_select->options & OPTION_FOUND_ROWS;
/* Global option */ /* Global option */
@ -148,7 +148,7 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result)
JOIN *join= new JOIN(thd_arg, sl->item_list, JOIN *join= new JOIN(thd_arg, sl->item_list,
sl->options | thd_arg->options | SELECT_NO_UNLOCK, sl->options | thd_arg->options | SELECT_NO_UNLOCK,
tmp_result); tmp_result);
thd_arg->lex.current_select= sl; thd_arg->lex->current_select= sl;
offset_limit_cnt= sl->offset_limit; offset_limit_cnt= sl->offset_limit;
select_limit_cnt= sl->select_limit+sl->offset_limit; select_limit_cnt= sl->select_limit+sl->offset_limit;
if (select_limit_cnt < sl->select_limit) if (select_limit_cnt < sl->select_limit)
@ -221,7 +221,7 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result)
union_result->set_table(table); union_result->set_table(table);
item_list.empty(); item_list.empty();
thd_arg->lex.current_select= lex_select_save; thd_arg->lex->current_select= lex_select_save;
{ {
Field **field; Field **field;
for (field= table->field; *field; field++) for (field= table->field; *field; field++)
@ -234,19 +234,19 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result)
else else
first_select->braces= 0; // remove our changes first_select->braces= 0; // remove our changes
thd_arg->lex.current_select= lex_select_save; thd_arg->lex->current_select= lex_select_save;
DBUG_RETURN(res || thd_arg->is_fatal_error ? 1 : 0); DBUG_RETURN(res || thd_arg->is_fatal_error ? 1 : 0);
err: err:
thd_arg->lex.current_select= lex_select_save; thd_arg->lex->current_select= lex_select_save;
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
int st_select_lex_unit::exec() int st_select_lex_unit::exec()
{ {
SELECT_LEX *lex_select_save= thd->lex.current_select; SELECT_LEX *lex_select_save= thd->lex->current_select;
SELECT_LEX *select_cursor=first_select_in_union(); SELECT_LEX *select_cursor=first_select_in_union();
ulonglong add_rows=0; ulonglong add_rows=0;
DBUG_ENTER("st_select_lex_unit::exec"); DBUG_ENTER("st_select_lex_unit::exec");
@ -266,7 +266,7 @@ int st_select_lex_unit::exec()
for (SELECT_LEX *sl= select_cursor; sl; sl= sl->next_select()) for (SELECT_LEX *sl= select_cursor; sl; sl= sl->next_select())
{ {
ha_rows records_at_start= 0; ha_rows records_at_start= 0;
thd->lex.current_select= sl; thd->lex->current_select= sl;
if (optimized) if (optimized)
res= sl->join->reinit(); res= sl->join->reinit();
@ -338,13 +338,13 @@ int st_select_lex_unit::exec()
offset_limit_cnt= sl->offset_limit; offset_limit_cnt= sl->offset_limit;
if (!res && union_result->flush()) if (!res && union_result->flush())
{ {
thd->lex.current_select= lex_select_save; thd->lex->current_select= lex_select_save;
DBUG_RETURN(1); DBUG_RETURN(1);
} }
} }
if (res) if (res)
{ {
thd->lex.current_select= lex_select_save; thd->lex->current_select= lex_select_save;
DBUG_RETURN(res); DBUG_RETURN(res);
} }
/* Needed for the following test and for records_at_start in next loop */ /* Needed for the following test and for records_at_start in next loop */
@ -375,7 +375,7 @@ int st_select_lex_unit::exec()
if (!thd->is_fatal_error) // Check if EOM if (!thd->is_fatal_error) // Check if EOM
{ {
ulong options_tmp= thd->options; ulong options_tmp= thd->options;
thd->lex.current_select= fake_select_lex; thd->lex->current_select= fake_select_lex;
offset_limit_cnt= global_parameters->offset_limit; offset_limit_cnt= global_parameters->offset_limit;
select_limit_cnt= global_parameters->select_limit + select_limit_cnt= global_parameters->select_limit +
global_parameters->offset_limit; global_parameters->offset_limit;
@ -384,7 +384,7 @@ int st_select_lex_unit::exec()
select_limit_cnt= HA_POS_ERROR; // no limit select_limit_cnt= HA_POS_ERROR; // no limit
if (select_limit_cnt == HA_POS_ERROR) if (select_limit_cnt == HA_POS_ERROR)
options_tmp&= ~OPTION_FOUND_ROWS; options_tmp&= ~OPTION_FOUND_ROWS;
else if (found_rows_for_union && !thd->lex.describe) else if (found_rows_for_union && !thd->lex->describe)
options_tmp|= OPTION_FOUND_ROWS; options_tmp|= OPTION_FOUND_ROWS;
fake_select_lex->ftfunc_list= &empty_list; fake_select_lex->ftfunc_list= &empty_list;
fake_select_lex->table_list.link_in_list((byte *)&result_table_list, fake_select_lex->table_list.link_in_list((byte *)&result_table_list,
@ -430,7 +430,7 @@ int st_select_lex_unit::exec()
*/ */
} }
} }
thd->lex.current_select= lex_select_save; thd->lex->current_select= lex_select_save;
DBUG_RETURN(res); DBUG_RETURN(res);
} }

View File

@ -68,7 +68,7 @@ int mysql_update(THD *thd,
SQL_SELECT *select; SQL_SELECT *select;
READ_RECORD info; READ_RECORD info;
TABLE_LIST *update_table_list= ((TABLE_LIST*) TABLE_LIST *update_table_list= ((TABLE_LIST*)
thd->lex.select_lex.table_list.first); thd->lex->select_lex.table_list.first);
TABLE_LIST tables; TABLE_LIST tables;
List<Item> all_fields; List<Item> all_fields;
DBUG_ENTER("mysql_update"); DBUG_ENTER("mysql_update");
@ -79,7 +79,7 @@ int mysql_update(THD *thd,
if ((open_and_lock_tables(thd, table_list))) if ((open_and_lock_tables(thd, table_list)))
DBUG_RETURN(-1); DBUG_RETURN(-1);
thd->proc_info="init"; thd->proc_info="init";
fix_tables_pointers(thd->lex.all_selects_list); fix_tables_pointers(thd->lex->all_selects_list);
table= table_list->table; table= table_list->table;
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK); table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
@ -97,10 +97,10 @@ int mysql_update(THD *thd,
if (setup_tables(update_table_list) || if (setup_tables(update_table_list) ||
setup_conds(thd,update_table_list,&conds) || setup_conds(thd,update_table_list,&conds) ||
thd->lex.select_lex.setup_ref_array(thd, order_num) || thd->lex->select_lex.setup_ref_array(thd, order_num) ||
setup_order(thd, thd->lex.select_lex.ref_pointer_array, setup_order(thd, thd->lex->select_lex.ref_pointer_array,
&tables, all_fields, all_fields, order) || &tables, all_fields, all_fields, order) ||
setup_ftfuncs(&thd->lex.select_lex)) setup_ftfuncs(&thd->lex->select_lex))
DBUG_RETURN(-1); /* purecov: inspected */ DBUG_RETURN(-1); /* purecov: inspected */
/* Check that we are not using table that we are updating in a sub select */ /* Check that we are not using table that we are updating in a sub select */
@ -144,7 +144,7 @@ int mysql_update(THD *thd,
#endif #endif
if (setup_fields(thd, 0, update_table_list, values, 0, 0, 0)) if (setup_fields(thd, 0, update_table_list, values, 0, 0, 0))
{ {
free_underlaid_joins(thd, &thd->lex.select_lex); free_underlaid_joins(thd, &thd->lex->select_lex);
DBUG_RETURN(-1); /* purecov: inspected */ DBUG_RETURN(-1); /* purecov: inspected */
} }
@ -155,7 +155,7 @@ int mysql_update(THD *thd,
(select && select->check_quick(thd, safe_update, limit)) || !limit) (select && select->check_quick(thd, safe_update, limit)) || !limit)
{ {
delete select; delete select;
free_underlaid_joins(thd, &thd->lex.select_lex); free_underlaid_joins(thd, &thd->lex->select_lex);
if (error) if (error)
{ {
DBUG_RETURN(-1); // Error in where DBUG_RETURN(-1); // Error in where
@ -174,7 +174,7 @@ int mysql_update(THD *thd,
goto err; goto err;
} }
} }
init_ftfuncs(thd, &thd->lex.select_lex, 1); init_ftfuncs(thd, &thd->lex->select_lex, 1);
/* Check if we are modifying a key that we are used to search with */ /* Check if we are modifying a key that we are used to search with */
if (select && select->quick) if (select && select->quick)
used_key_is_modified= (!select->quick->unique_key_range() && used_key_is_modified= (!select->quick->unique_key_range() &&
@ -375,7 +375,7 @@ int mysql_update(THD *thd,
} }
delete select; delete select;
free_underlaid_joins(thd, &thd->lex.select_lex); free_underlaid_joins(thd, &thd->lex->select_lex);
if (error >= 0) if (error >= 0)
send_error(thd,thd->killed ? ER_SERVER_SHUTDOWN : 0); /* purecov: inspected */ send_error(thd,thd->killed ? ER_SERVER_SHUTDOWN : 0); /* purecov: inspected */
else else
@ -394,7 +394,7 @@ int mysql_update(THD *thd,
err: err:
delete select; delete select;
free_underlaid_joins(thd, &thd->lex.select_lex); free_underlaid_joins(thd, &thd->lex->select_lex);
if (table->key_read) if (table->key_read)
{ {
table->key_read=0; table->key_read=0;
@ -431,7 +431,7 @@ int mysql_multi_update(THD *thd,
#endif #endif
if ((res=open_and_lock_tables(thd,table_list))) if ((res=open_and_lock_tables(thd,table_list)))
DBUG_RETURN(res); DBUG_RETURN(res);
fix_tables_pointers(thd->lex.all_selects_list); fix_tables_pointers(thd->lex->all_selects_list);
select_lex->select_limit= HA_POS_ERROR; select_lex->select_limit= HA_POS_ERROR;
if (setup_fields(thd, 0, table_list, *fields, 1, 0, 0)) if (setup_fields(thd, 0, table_list, *fields, 1, 0, 0))

View File

@ -28,7 +28,7 @@
#define MYSQL_YACC #define MYSQL_YACC
#define YYINITDEPTH 100 #define YYINITDEPTH 100
#define YYMAXDEPTH 3200 /* Because of 64K stack */ #define YYMAXDEPTH 3200 /* Because of 64K stack */
#define Lex (&(YYTHD->lex)) #define Lex (YYTHD->lex)
#define Select Lex->current_select #define Select Lex->current_select
#include "mysql_priv.h" #include "mysql_priv.h"
#include "slave.h" #include "slave.h"
@ -733,14 +733,14 @@ query:
{ {
THD *thd= YYTHD; THD *thd= YYTHD;
if (!thd->bootstrap && if (!thd->bootstrap &&
(!(thd->lex.select_lex.options & OPTION_FOUND_COMMENT))) (!(thd->lex->select_lex.options & OPTION_FOUND_COMMENT)))
{ {
send_error(thd,ER_EMPTY_QUERY); send_error(thd,ER_EMPTY_QUERY);
YYABORT; YYABORT;
} }
else else
{ {
thd->lex.sql_command = SQLCOM_EMPTY_QUERY; thd->lex->sql_command= SQLCOM_EMPTY_QUERY;
} }
} }
| verb_clause END_OF_INPUT {}; | verb_clause END_OF_INPUT {};
@ -1658,7 +1658,7 @@ alter:
ALTER opt_ignore TABLE_SYM table_ident ALTER opt_ignore TABLE_SYM table_ident
{ {
THD *thd= YYTHD; THD *thd= YYTHD;
LEX *lex=&thd->lex; LEX *lex= thd->lex;
lex->sql_command = SQLCOM_ALTER_TABLE; lex->sql_command = SQLCOM_ALTER_TABLE;
lex->name=0; lex->name=0;
if (!lex->select_lex.add_table_to_list(thd, $4, NULL, if (!lex->select_lex.add_table_to_list(thd, $4, NULL,
@ -2255,7 +2255,7 @@ select_item_list:
THD *thd= YYTHD; THD *thd= YYTHD;
if (add_item_to_list(thd, new Item_field(NULL, NULL, "*"))) if (add_item_to_list(thd, new Item_field(NULL, NULL, "*")))
YYABORT; YYABORT;
(thd->lex.current_select->with_wild)++; (thd->lex->current_select->with_wild)++;
}; };
@ -4053,8 +4053,8 @@ show_param:
| opt_var_type VARIABLES wild | opt_var_type VARIABLES wild
{ {
THD *thd= YYTHD; THD *thd= YYTHD;
thd->lex.sql_command= SQLCOM_SHOW_VARIABLES; thd->lex->sql_command= SQLCOM_SHOW_VARIABLES;
thd->lex.option_type= (enum_var_type) $1; thd->lex->option_type= (enum_var_type) $1;
} }
| charset wild | charset wild
{ Lex->sql_command= SQLCOM_SHOW_CHARSETS; } { Lex->sql_command= SQLCOM_SHOW_CHARSETS; }
@ -4491,7 +4491,7 @@ simple_ident:
| ident '.' ident | ident '.' ident
{ {
THD *thd= YYTHD; THD *thd= YYTHD;
LEX *lex= &thd->lex; LEX *lex= thd->lex;
SELECT_LEX *sel= lex->current_select; SELECT_LEX *sel= lex->current_select;
if (sel->no_table_names_allowed) if (sel->no_table_names_allowed)
{ {
@ -4507,7 +4507,7 @@ simple_ident:
| '.' ident '.' ident | '.' ident '.' ident
{ {
THD *thd= YYTHD; THD *thd= YYTHD;
LEX *lex= &thd->lex; LEX *lex= thd->lex;
SELECT_LEX *sel= lex->current_select; SELECT_LEX *sel= lex->current_select;
if (sel->no_table_names_allowed) if (sel->no_table_names_allowed)
{ {
@ -4523,7 +4523,7 @@ simple_ident:
| ident '.' ident '.' ident | ident '.' ident '.' ident
{ {
THD *thd= YYTHD; THD *thd= YYTHD;
LEX *lex= &thd->lex; LEX *lex= thd->lex;
SELECT_LEX *sel= lex->current_select; SELECT_LEX *sel= lex->current_select;
if (sel->no_table_names_allowed) if (sel->no_table_names_allowed)
{ {
@ -4930,7 +4930,7 @@ option_value:
YYABORT; YYABORT;
user->host.str=0; user->host.str=0;
user->user.str=thd->priv_user; user->user.str=thd->priv_user;
thd->lex.var_list.push_back(new set_var_password(user, $3)); thd->lex->var_list.push_back(new set_var_password(user, $3));
} }
| PASSWORD FOR_SYM user equal text_or_password | PASSWORD FOR_SYM user equal text_or_password
{ {
@ -5478,7 +5478,7 @@ optional_order_or_limit:
| |
{ {
THD *thd= YYTHD; THD *thd= YYTHD;
LEX *lex= &thd->lex; LEX *lex= thd->lex;
DBUG_ASSERT(lex->current_select->linkage != GLOBAL_OPTIONS_TYPE); DBUG_ASSERT(lex->current_select->linkage != GLOBAL_OPTIONS_TYPE);
SELECT_LEX *sel= lex->current_select; SELECT_LEX *sel= lex->current_select;
SELECT_LEX_UNIT *unit= sel->master_unit(); SELECT_LEX_UNIT *unit= sel->master_unit();
@ -5494,7 +5494,7 @@ optional_order_or_limit:
order_or_limit order_or_limit
{ {
THD *thd= YYTHD; THD *thd= YYTHD;
thd->lex.current_select->no_table_names_allowed= 0; thd->lex->current_select->no_table_names_allowed= 0;
thd->where= ""; thd->where= "";
} }
; ;