made lex a pointer in THD
This commit is contained in:
parent
0e89178661
commit
b9121cdea3
@ -1110,7 +1110,7 @@ get_addon_fields(THD *thd, Field **ptabfield, uint sortlength, uint *plength)
|
||||
The fact is the filter 'field->query_id != thd->query_id'
|
||||
doesn't work for alter table
|
||||
*/
|
||||
if (thd->lex.sql_command != SQLCOM_SELECT)
|
||||
if (thd->lex->sql_command != SQLCOM_SELECT)
|
||||
return 0;
|
||||
for (pfield= ptabfield; (field= *pfield) ; pfield++)
|
||||
{
|
||||
|
@ -1938,8 +1938,8 @@ ha_innobase::write_row(
|
||||
build_template(prebuilt, NULL, table, ROW_MYSQL_WHOLE_ROW);
|
||||
}
|
||||
|
||||
if (user_thd->lex.sql_command == SQLCOM_INSERT
|
||||
&& user_thd->lex.duplicates == DUP_IGNORE) {
|
||||
if (user_thd->lex->sql_command == SQLCOM_INSERT
|
||||
&& user_thd->lex->duplicates == DUP_IGNORE) {
|
||||
prebuilt->trx->ignore_duplicates_in_insert = TRUE;
|
||||
} else {
|
||||
prebuilt->trx->ignore_duplicates_in_insert = FALSE;
|
||||
@ -1967,8 +1967,8 @@ ha_innobase::write_row(
|
||||
skip_auto_inc_decr = FALSE;
|
||||
|
||||
if (error == DB_DUPLICATE_KEY
|
||||
&& (user_thd->lex.sql_command == SQLCOM_REPLACE
|
||||
|| user_thd->lex.sql_command
|
||||
&& (user_thd->lex->sql_command == SQLCOM_REPLACE
|
||||
|| user_thd->lex->sql_command
|
||||
== SQLCOM_REPLACE_SELECT)) {
|
||||
|
||||
skip_auto_inc_decr= TRUE;
|
||||
|
@ -388,7 +388,7 @@ int ha_myisam::analyze(THD *thd, HA_CHECK_OPT* check_opt)
|
||||
int ha_myisam::restore(THD* thd, HA_CHECK_OPT *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* table_name = table->real_name;
|
||||
int error;
|
||||
@ -428,7 +428,7 @@ int ha_myisam::restore(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* table_name = table->real_name;
|
||||
int error;
|
||||
|
24
sql/item.cc
24
sql/item.cc
@ -779,7 +779,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
||||
Item **refer= (Item **)not_found_item;
|
||||
uint counter;
|
||||
// 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 (outer_resolving ||
|
||||
cursel->master_unit()->first_select()->linkage != DERIVED_TABLE_TYPE)
|
||||
for (SELECT_LEX *sl=(outer_resolving?cursel:cursel->outer_select());
|
||||
@ -839,7 +839,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
||||
Mark all selects from resolved to 1 before select where was
|
||||
found table as depended (of select where was found table)
|
||||
*/
|
||||
thd->lex.current_select->mark_as_dependent(last);
|
||||
thd->lex->current_select->mark_as_dependent(last);
|
||||
if (depended_from->having_fix_field)
|
||||
{
|
||||
Item_ref *rf;
|
||||
@ -1242,8 +1242,8 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
|
||||
{
|
||||
TABLE_LIST *where= 0;
|
||||
SELECT_LEX *sl= (outer_resolving?
|
||||
thd->lex.current_select->select_lex():
|
||||
thd->lex.current_select->outer_select());
|
||||
thd->lex->current_select->select_lex():
|
||||
thd->lex->current_select->outer_select());
|
||||
/*
|
||||
Finding only in current select will be performed for selects that have
|
||||
not outer one and for derived tables (which not support using outer
|
||||
@ -1251,10 +1251,10 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
|
||||
*/
|
||||
if (outer_resolving ||
|
||||
(ref= find_item_in_list(this,
|
||||
*(thd->lex.current_select->get_item_list()),
|
||||
*(thd->lex->current_select->get_item_list()),
|
||||
&counter,
|
||||
((sl &&
|
||||
thd->lex.current_select->master_unit()->
|
||||
thd->lex->current_select->master_unit()->
|
||||
first_select()->linkage !=
|
||||
DERIVED_TABLE_TYPE) ?
|
||||
REPORT_EXCEPT_NOT_FOUND :
|
||||
@ -1296,7 +1296,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
|
||||
{
|
||||
// Call to report error
|
||||
find_item_in_list(this,
|
||||
*(thd->lex.current_select->get_item_list()),
|
||||
*(thd->lex->current_select->get_item_list()),
|
||||
&counter,
|
||||
REPORT_ALL_ERRORS);
|
||||
ref= 0;
|
||||
@ -1310,7 +1310,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
|
||||
return 1;
|
||||
// store pointer on SELECT_LEX from wich item is dependent
|
||||
f->depended_from= last;
|
||||
thd->lex.current_select->mark_as_dependent(last);
|
||||
thd->lex->current_select->mark_as_dependent(last);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
@ -1325,7 +1325,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
|
||||
depended_from: pointer on SELECT_LEX from wich item is dependent
|
||||
*/
|
||||
ref= (depended_from= last)->ref_pointer_array + counter;
|
||||
thd->lex.current_select->mark_as_dependent(last);
|
||||
thd->lex->current_select->mark_as_dependent(last);
|
||||
}
|
||||
}
|
||||
else if (!ref)
|
||||
@ -1338,7 +1338,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
|
||||
"forward reference in item list");
|
||||
return -1;
|
||||
}
|
||||
ref= thd->lex.current_select->ref_pointer_array + counter;
|
||||
ref= thd->lex->current_select->ref_pointer_array + counter;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1353,8 +1353,8 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
|
||||
|
||||
if (((*ref)->with_sum_func && name &&
|
||||
(depended_from ||
|
||||
!(thd->lex.current_select->linkage != GLOBAL_OPTIONS_TYPE &&
|
||||
thd->lex.current_select->select_lex()->having_fix_field))) ||
|
||||
!(thd->lex->current_select->linkage != GLOBAL_OPTIONS_TYPE &&
|
||||
thd->lex->current_select->select_lex()->having_fix_field))) ||
|
||||
!(*ref)->fixed)
|
||||
{
|
||||
my_error(ER_ILLEGAL_REFERENCE, MYF(0), name,
|
||||
|
@ -83,7 +83,7 @@ Item *create_func_ceiling(Item* a)
|
||||
Item *create_func_connection_id(void)
|
||||
{
|
||||
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->thread_id,10);
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ Item *create_func_floor(Item* a)
|
||||
Item *create_func_found_rows(void)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
@ -170,7 +170,7 @@ Item *create_func_from_days(Item* a)
|
||||
|
||||
Item *create_func_get_lock(Item* a, Item *b)
|
||||
{
|
||||
current_thd->lex.uncacheable();
|
||||
current_thd->lex->uncacheable();
|
||||
return new Item_func_get_lock(a, b);
|
||||
}
|
||||
|
||||
@ -340,7 +340,7 @@ Item *create_func_radians(Item *a)
|
||||
|
||||
Item *create_func_release_lock(Item* a)
|
||||
{
|
||||
current_thd->lex.uncacheable();
|
||||
current_thd->lex->uncacheable();
|
||||
return new Item_func_release_lock(a);
|
||||
}
|
||||
|
||||
@ -448,7 +448,7 @@ Item *create_func_year(Item* a)
|
||||
|
||||
Item *create_load_file(Item* a)
|
||||
{
|
||||
current_thd->lex.uncacheable();
|
||||
current_thd->lex->uncacheable();
|
||||
return new Item_load_file(a);
|
||||
}
|
||||
|
||||
@ -471,13 +471,13 @@ Item *create_func_cast(Item *a, Item_cast cast_type)
|
||||
|
||||
Item *create_func_is_free_lock(Item* a)
|
||||
{
|
||||
current_thd->lex.uncacheable();
|
||||
current_thd->lex->uncacheable();
|
||||
return new Item_func_is_free_lock(a);
|
||||
}
|
||||
|
||||
Item *create_func_is_used_lock(Item* a)
|
||||
{
|
||||
current_thd->lex.uncacheable();
|
||||
current_thd->lex->uncacheable();
|
||||
return new Item_func_is_used_lock(a);
|
||||
}
|
||||
|
||||
|
@ -2253,7 +2253,7 @@ void Item_func_get_user_var::fix_length_and_dec()
|
||||
|
||||
if ((var_entry= get_variable(&thd->user_vars, name, 0)))
|
||||
{
|
||||
if (opt_bin_log && is_update_query(thd->lex.sql_command) &&
|
||||
if (opt_bin_log && is_update_query(thd->lex->sql_command) &&
|
||||
var_entry->used_query_id != thd->query_id)
|
||||
{
|
||||
uint size;
|
||||
@ -2632,7 +2632,7 @@ Item *get_system_var(enum_var_type var_type, LEX_STRING name)
|
||||
}
|
||||
if (!(item=var->item(thd, var_type)))
|
||||
return 0; // Impossible
|
||||
thd->lex.uncacheable();
|
||||
thd->lex->uncacheable();
|
||||
buff[0]='@';
|
||||
buff[1]='@';
|
||||
pos=buff+2;
|
||||
@ -2658,7 +2658,7 @@ Item *get_system_var(enum_var_type var_type, const char *var_name, uint length,
|
||||
DBUG_ASSERT(var != 0);
|
||||
if (!(item=var->item(thd, var_type)))
|
||||
return 0; // Impossible
|
||||
thd->lex.uncacheable();
|
||||
thd->lex->uncacheable();
|
||||
item->set_name(item_name, 0, system_charset_info); // Will use original name
|
||||
return item;
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ void Item_singlerow_subselect::select_transformer(THD *thd,
|
||||
{
|
||||
|
||||
have_to_be_excluded= 1;
|
||||
if (thd->lex.describe)
|
||||
if (thd->lex->describe)
|
||||
{
|
||||
char warn_buff[MYSQL_ERRMSG_SIZE];
|
||||
sprintf(warn_buff, ER(ER_SELECT_REDUCED), select_lex->select_number);
|
||||
@ -560,7 +560,7 @@ void Item_in_subselect::single_value_transformer(THD *thd,
|
||||
item= (*func)(left_expr, item);
|
||||
substitution= item;
|
||||
have_to_be_excluded= 1;
|
||||
if (thd->lex.describe)
|
||||
if (thd->lex->describe)
|
||||
{
|
||||
char warn_buff[MYSQL_ERRMSG_SIZE];
|
||||
sprintf(warn_buff, ER(ER_SELECT_REDUCED), sl->select_number);
|
||||
@ -703,8 +703,8 @@ int subselect_single_select_engine::prepare()
|
||||
if (prepared)
|
||||
return 0;
|
||||
prepared= 1;
|
||||
SELECT_LEX_NODE *save_select= thd->lex.current_select;
|
||||
thd->lex.current_select= select_lex;
|
||||
SELECT_LEX_NODE *save_select= thd->lex->current_select;
|
||||
thd->lex->current_select= select_lex;
|
||||
if (join->prepare(&select_lex->ref_pointer_array,
|
||||
(TABLE_LIST*) select_lex->table_list.first,
|
||||
select_lex->with_wild,
|
||||
@ -717,7 +717,7 @@ int subselect_single_select_engine::prepare()
|
||||
(ORDER*) 0, select_lex,
|
||||
select_lex->master_unit(), 0))
|
||||
return 1;
|
||||
thd->lex.current_select= save_select;
|
||||
thd->lex->current_select= save_select;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -830,10 +830,10 @@ int subselect_single_select_engine::exec()
|
||||
}
|
||||
if (!executed)
|
||||
{
|
||||
SELECT_LEX_NODE *save_select= join->thd->lex.current_select;
|
||||
join->thd->lex.current_select= select_lex;
|
||||
SELECT_LEX_NODE *save_select= join->thd->lex->current_select;
|
||||
join->thd->lex->current_select= select_lex;
|
||||
join->exec();
|
||||
join->thd->lex.current_select= save_select;
|
||||
join->thd->lex->current_select= save_select;
|
||||
executed= 1;
|
||||
join->thd->where= save_where;
|
||||
DBUG_RETURN(join->error||thd->is_fatal_error);
|
||||
|
@ -57,7 +57,7 @@ Item_sum::Item_sum(THD *thd, Item_sum &item):
|
||||
|
||||
void Item_sum::mark_as_sum_func()
|
||||
{
|
||||
current_thd->lex.current_select->with_sum_func++;
|
||||
current_thd->lex->current_select->with_sum_func++;
|
||||
with_sum_func= 1;
|
||||
}
|
||||
|
||||
|
@ -895,22 +895,22 @@ bool flush_error_log(void);
|
||||
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
|
@ -1269,12 +1269,12 @@ static void server_init(void)
|
||||
void yyerror(const char *s)
|
||||
{
|
||||
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 */
|
||||
if (strcmp(s,"parse error") == 0 || strcmp(s,"syntax error") == 0)
|
||||
s=ER(ER_SYNTAX_ERROR);
|
||||
net_printf(thd,ER_PARSE_ERROR, s, yytext ? (char*) yytext : "",
|
||||
thd->lex.yylineno);
|
||||
thd->lex->yylineno);
|
||||
}
|
||||
|
||||
|
||||
|
@ -422,7 +422,7 @@ int show_new_master(THD* thd)
|
||||
DBUG_ENTER("show_new_master");
|
||||
List<Item> field_list;
|
||||
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
|
||||
if (translate_master(thd, lex_mi, errmsg))
|
||||
|
@ -1158,7 +1158,7 @@ void sys_var_thd_sql_mode::set_default(THD *thd, enum_var_type type)
|
||||
bool sys_var_thd_bit::update(THD *thd, set_var *var)
|
||||
{
|
||||
int res= (*update_func)(thd, var);
|
||||
thd->lex.select_lex.options=thd->options;
|
||||
thd->lex->select_lex.options=thd->options;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -359,7 +359,7 @@ sp_cache_functions(THD *thd, LEX *lex)
|
||||
continue;
|
||||
if (db_find_routine(thd, TYPE_ENUM_FUNCTION, fn, strlen(fn), &sp) == SP_OK)
|
||||
{
|
||||
ret= sp_cache_functions(thd, &thd->lex);
|
||||
ret= sp_cache_functions(thd, thd->lex);
|
||||
if (ret)
|
||||
break;
|
||||
thd->spfuns.push_back(sp);
|
||||
|
@ -351,35 +351,35 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
|
||||
void
|
||||
sp_head::reset_lex(THD *thd)
|
||||
{
|
||||
memcpy(&m_lex, &thd->lex, sizeof(LEX)); // Save old one
|
||||
memcpy(&m_lex, thd->lex, sizeof(LEX)); // Save old one
|
||||
/* Reset most stuff. The length arguments doesn't matter here. */
|
||||
lex_start(thd, m_lex.buf, m_lex.end_of_query - m_lex.ptr);
|
||||
/* We must reset ptr and end_of_query again */
|
||||
thd->lex.ptr= m_lex.ptr;
|
||||
thd->lex.end_of_query= m_lex.end_of_query;
|
||||
thd->lex->ptr= m_lex.ptr;
|
||||
thd->lex->end_of_query= m_lex.end_of_query;
|
||||
/* And keep the SP stuff too */
|
||||
thd->lex.sphead = m_lex.sphead;
|
||||
thd->lex.spcont = m_lex.spcont;
|
||||
thd->lex->sphead = m_lex.sphead;
|
||||
thd->lex->spcont = m_lex.spcont;
|
||||
/* Clear all lists. (QQ Why isn't this reset by lex_start()?).
|
||||
We may be overdoing this, but we know for sure that value_list must
|
||||
be cleared at least. */
|
||||
thd->lex.col_list.empty();
|
||||
thd->lex.ref_list.empty();
|
||||
thd->lex.drop_list.empty();
|
||||
thd->lex.alter_list.empty();
|
||||
thd->lex.interval_list.empty();
|
||||
thd->lex.users_list.empty();
|
||||
thd->lex.columns.empty();
|
||||
thd->lex.key_list.empty();
|
||||
thd->lex.create_list.empty();
|
||||
thd->lex.insert_list= NULL;
|
||||
thd->lex.field_list.empty();
|
||||
thd->lex.value_list.empty();
|
||||
thd->lex.many_values.empty();
|
||||
thd->lex.var_list.empty();
|
||||
thd->lex.param_list.empty();
|
||||
thd->lex.proc_list.empty();
|
||||
thd->lex.auxilliary_table_list.empty();
|
||||
thd->lex->col_list.empty();
|
||||
thd->lex->ref_list.empty();
|
||||
thd->lex->drop_list.empty();
|
||||
thd->lex->alter_list.empty();
|
||||
thd->lex->interval_list.empty();
|
||||
thd->lex->users_list.empty();
|
||||
thd->lex->columns.empty();
|
||||
thd->lex->key_list.empty();
|
||||
thd->lex->create_list.empty();
|
||||
thd->lex->insert_list= NULL;
|
||||
thd->lex->field_list.empty();
|
||||
thd->lex->value_list.empty();
|
||||
thd->lex->many_values.empty();
|
||||
thd->lex->var_list.empty();
|
||||
thd->lex->param_list.empty();
|
||||
thd->lex->proc_list.empty();
|
||||
thd->lex->auxilliary_table_list.empty();
|
||||
}
|
||||
|
||||
// Restore lex during parsing, after we have parsed a sub statement.
|
||||
@ -387,11 +387,11 @@ void
|
||||
sp_head::restore_lex(THD *thd)
|
||||
{
|
||||
// Update some state in the old one first
|
||||
m_lex.ptr= thd->lex.ptr;
|
||||
m_lex.next_state= thd->lex.next_state;
|
||||
m_lex.ptr= thd->lex->ptr;
|
||||
m_lex.next_state= thd->lex->next_state;
|
||||
|
||||
// Collect some data from the sub statement lex.
|
||||
sp_merge_funs(&m_lex, &thd->lex);
|
||||
sp_merge_funs(&m_lex, thd->lex);
|
||||
#if 0
|
||||
// QQ We're not using this at the moment.
|
||||
if (thd->lex.sql_command == SQLCOM_CALL)
|
||||
@ -434,7 +434,7 @@ sp_head::restore_lex(THD *thd)
|
||||
}
|
||||
#endif
|
||||
|
||||
memcpy(&thd->lex, &m_lex, sizeof(LEX)); // Restore lex
|
||||
memcpy(thd->lex, &m_lex, sizeof(LEX)); // Restore lex
|
||||
}
|
||||
|
||||
void
|
||||
@ -480,10 +480,10 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
|
||||
LEX olex; // The other lex
|
||||
int res;
|
||||
|
||||
memcpy(&olex, &thd->lex, sizeof(LEX)); // Save the other lex
|
||||
memcpy(&olex, thd->lex, sizeof(LEX)); // Save the other lex
|
||||
|
||||
memcpy(&thd->lex, &m_lex, sizeof(LEX)); // Use my own lex
|
||||
thd->lex.thd = thd;
|
||||
memcpy(thd->lex, &m_lex, sizeof(LEX)); // Use my own lex
|
||||
thd->lex->thd = thd;
|
||||
|
||||
res= mysql_execute_command(thd);
|
||||
if (thd->lock || thd->open_tables || thd->derived_tables)
|
||||
@ -492,7 +492,7 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
|
||||
close_thread_tables(thd); /* Free tables */
|
||||
}
|
||||
|
||||
memcpy(&thd->lex, &olex, sizeof(LEX)); // Restore the other lex
|
||||
memcpy(thd->lex, &olex, sizeof(LEX)); // Restore the other lex
|
||||
|
||||
*nextp = m_ip+1;
|
||||
DBUG_RETURN(res);
|
||||
|
@ -1401,7 +1401,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 */
|
||||
{
|
||||
/* We write down SSL related ACL stuff */
|
||||
switch (thd->lex.ssl_type) {
|
||||
switch (thd->lex->ssl_type) {
|
||||
case SSL_TYPE_ANY:
|
||||
table->field[24]->store("ANY",3, &my_charset_latin1);
|
||||
table->field[25]->store("", 0, &my_charset_latin1);
|
||||
@ -1419,15 +1419,15 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
|
||||
table->field[25]->store("", 0, &my_charset_latin1);
|
||||
table->field[26]->store("", 0, &my_charset_latin1);
|
||||
table->field[27]->store("", 0, &my_charset_latin1);
|
||||
if (thd->lex.ssl_cipher)
|
||||
table->field[25]->store(thd->lex.ssl_cipher,
|
||||
strlen(thd->lex.ssl_cipher), &my_charset_latin1);
|
||||
if (thd->lex.x509_issuer)
|
||||
table->field[26]->store(thd->lex.x509_issuer,
|
||||
strlen(thd->lex.x509_issuer), &my_charset_latin1);
|
||||
if (thd->lex.x509_subject)
|
||||
table->field[27]->store(thd->lex.x509_subject,
|
||||
strlen(thd->lex.x509_subject), &my_charset_latin1);
|
||||
if (thd->lex->ssl_cipher)
|
||||
table->field[25]->store(thd->lex->ssl_cipher,
|
||||
strlen(thd->lex->ssl_cipher), &my_charset_latin1);
|
||||
if (thd->lex->x509_issuer)
|
||||
table->field[26]->store(thd->lex->x509_issuer,
|
||||
strlen(thd->lex->x509_issuer), &my_charset_latin1);
|
||||
if (thd->lex->x509_subject)
|
||||
table->field[27]->store(thd->lex->x509_subject,
|
||||
strlen(thd->lex->x509_subject), &my_charset_latin1);
|
||||
break;
|
||||
case SSL_TYPE_NOT_SPECIFIED:
|
||||
break;
|
||||
@ -1439,7 +1439,7 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
|
||||
break;
|
||||
}
|
||||
|
||||
USER_RESOURCES mqh = thd->lex.mqh;
|
||||
USER_RESOURCES mqh = thd->lex->mqh;
|
||||
if (mqh.bits & 1)
|
||||
table->field[28]->store((longlong) mqh.questions);
|
||||
if (mqh.bits & 2)
|
||||
@ -1482,19 +1482,19 @@ end:
|
||||
password=0; // No password given on command
|
||||
if (old_row_exists)
|
||||
acl_update_user(combo.user.str,combo.host.str,password,
|
||||
thd->lex.ssl_type,
|
||||
thd->lex.ssl_cipher,
|
||||
thd->lex.x509_issuer,
|
||||
thd->lex.x509_subject,
|
||||
&thd->lex.mqh,
|
||||
thd->lex->ssl_type,
|
||||
thd->lex->ssl_cipher,
|
||||
thd->lex->x509_issuer,
|
||||
thd->lex->x509_subject,
|
||||
&thd->lex->mqh,
|
||||
rights);
|
||||
else
|
||||
acl_insert_user(combo.user.str,combo.host.str,password,
|
||||
thd->lex.ssl_type,
|
||||
thd->lex.ssl_cipher,
|
||||
thd->lex.x509_issuer,
|
||||
thd->lex.x509_subject,
|
||||
&thd->lex.mqh,
|
||||
thd->lex->ssl_type,
|
||||
thd->lex->ssl_cipher,
|
||||
thd->lex->x509_issuer,
|
||||
thd->lex->x509_subject,
|
||||
&thd->lex->mqh,
|
||||
rights);
|
||||
}
|
||||
table->file->index_end();
|
||||
|
@ -761,7 +761,7 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
|
||||
uint8 tables_type= 0;
|
||||
|
||||
if ((local_tables = is_cacheable(thd, thd->query_length,
|
||||
thd->query, &thd->lex, tables_used,
|
||||
thd->query, thd->lex, tables_used,
|
||||
&tables_type)))
|
||||
{
|
||||
NET *net= &thd->net;
|
||||
@ -895,7 +895,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 */
|
||||
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"));
|
||||
goto err;
|
||||
@ -996,7 +996,7 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
|
||||
table_list.db, table_list.alias));
|
||||
refused++; // This is actually a hit
|
||||
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);
|
||||
DBUG_RETURN(-1); // Privilege error
|
||||
}
|
||||
@ -1005,7 +1005,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",
|
||||
table_list.db, table_list.alias));
|
||||
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
|
||||
}
|
||||
if (check_tables && !handler::caching_allowed(thd, table->db(),
|
||||
@ -1015,7 +1015,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",
|
||||
table_list.db, table_list.alias));
|
||||
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
|
||||
}
|
||||
else
|
||||
|
@ -90,6 +90,7 @@ THD::THD():user_time(0), is_fatal_error(0),
|
||||
insert_id_used(0), rand_used(0), in_lock_tables(0),
|
||||
global_read_lock(0), bootstrap(0), spcont(NULL)
|
||||
{
|
||||
lex= &main_lex;
|
||||
host=user=priv_user=db=query=ip=0;
|
||||
host_or_ip= "connecting host";
|
||||
locked=count_cuted_fields=some_tables_deleted=no_errors=password=
|
||||
@ -1040,7 +1041,7 @@ int select_dumpvar::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
|
||||
else
|
||||
{
|
||||
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();
|
||||
vars.push_back(xx);
|
||||
}
|
||||
|
@ -404,7 +404,8 @@ public:
|
||||
struct st_mysql *mysql;
|
||||
#endif
|
||||
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 con_root; // connection-life memory
|
||||
MEM_ROOT warn_root; // For warnings and errors
|
||||
|
@ -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;
|
||||
ha_rows deleted;
|
||||
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");
|
||||
|
||||
if ((open_and_lock_tables(thd, table_list)))
|
||||
DBUG_RETURN(-1);
|
||||
fix_tables_pointers(thd->lex.all_selects_list);
|
||||
fix_tables_pointers(thd->lex->all_selects_list);
|
||||
table= table_list->table;
|
||||
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
|
||||
thd->proc_info="init";
|
||||
table->map=1;
|
||||
if (setup_conds(thd, delete_table_list, &conds) ||
|
||||
setup_ftfuncs(&thd->lex.select_lex))
|
||||
setup_ftfuncs(&thd->lex->select_lex))
|
||||
DBUG_RETURN(-1);
|
||||
if (find_real_table_in_list(table_list->next,
|
||||
table_list->db, table_list->real_name))
|
||||
@ -92,7 +92,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
|
||||
if ((select && select->check_quick(safe_update, limit)) || !limit)
|
||||
{
|
||||
delete select;
|
||||
free_underlaid_joins(thd, &thd->lex.select_lex);
|
||||
free_underlaid_joins(thd, &thd->lex->select_lex);
|
||||
send_ok(thd,0L);
|
||||
DBUG_RETURN(0); // Nothing to delete
|
||||
}
|
||||
@ -100,11 +100,11 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
|
||||
/* If running in safe sql mode, don't allow updates without keys */
|
||||
if (!table->quick_keys)
|
||||
{
|
||||
thd->lex.select_lex.options|=QUERY_NO_INDEX_USED;
|
||||
thd->lex->select_lex.options|=QUERY_NO_INDEX_USED;
|
||||
if (safe_update && !using_limit)
|
||||
{
|
||||
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);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
@ -126,9 +126,9 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
|
||||
|
||||
table->sort.io_cache = (IO_CACHE *) my_malloc(sizeof(IO_CACHE),
|
||||
MYF(MY_FAE | MY_ZEROFILL));
|
||||
if (setup_ref_array(thd, &thd->lex.select_lex.ref_pointer_array,
|
||||
if (setup_ref_array(thd, &thd->lex->select_lex.ref_pointer_array,
|
||||
all_fields.elements)||
|
||||
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) ||
|
||||
!(sortorder=make_unireg_sortorder(order, &length)) ||
|
||||
(table->sort.found_records = filesort(thd, table, sortorder, length,
|
||||
@ -137,14 +137,14 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
|
||||
== HA_POS_ERROR)
|
||||
{
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
init_read_record(&info,thd,table,select,1,1);
|
||||
deleted=0L;
|
||||
init_ftfuncs(thd, &thd->lex.select_lex, 1);
|
||||
init_ftfuncs(thd, &thd->lex->select_lex, 1);
|
||||
thd->proc_info="updating";
|
||||
while (!(error=info.read_record(&info)) && !thd->killed &&
|
||||
!thd->net.report_error)
|
||||
@ -212,7 +212,7 @@ cleanup:
|
||||
thd->lock=0;
|
||||
}
|
||||
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)
|
||||
send_error(thd,thd->killed_errno());
|
||||
else
|
||||
@ -302,7 +302,7 @@ multi_delete::initialize_tables(JOIN *join)
|
||||
table->file->ref_length,
|
||||
MEM_STRIP_BUF_SIZE);
|
||||
}
|
||||
init_ftfuncs(thd, thd->lex.current_select->select_lex(), 1);
|
||||
init_ftfuncs(thd, thd->lex->current_select->select_lex(), 1);
|
||||
DBUG_RETURN(thd->is_fatal_error != 0);
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ my_bool mysqld_show_warnings(THD *thd, ulong levels_to_show)
|
||||
DBUG_RETURN(1);
|
||||
|
||||
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;
|
||||
Protocol *protocol=thd->protocol;
|
||||
|
||||
|
@ -123,7 +123,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
|
||||
char *query=thd->query;
|
||||
thr_lock_type lock_type = table_list->lock_type;
|
||||
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");
|
||||
|
||||
/*
|
||||
@ -166,7 +166,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
|
||||
res= open_and_lock_tables(thd, table_list);
|
||||
if (res)
|
||||
DBUG_RETURN(-1);
|
||||
fix_tables_pointers(thd->lex.all_selects_list);
|
||||
fix_tables_pointers(thd->lex->all_selects_list);
|
||||
|
||||
table= table_list->table;
|
||||
thd->proc_info="init";
|
||||
@ -378,13 +378,13 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
|
||||
thd->cuted_fields);
|
||||
::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);
|
||||
DBUG_RETURN(0);
|
||||
|
||||
abort:
|
||||
if (lock_type == TL_WRITE_DELAYED)
|
||||
end_delayed_insert(thd);
|
||||
free_underlaid_joins(thd, &thd->lex.select_lex);
|
||||
free_underlaid_joins(thd, &thd->lex->select_lex);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ void lex_free(void)
|
||||
|
||||
LEX *lex_start(THD *thd, uchar *buf,uint length)
|
||||
{
|
||||
LEX *lex= &thd->lex;
|
||||
LEX *lex= thd->lex;
|
||||
lex->thd= thd;
|
||||
lex->next_state=MY_LEX_START;
|
||||
lex->buf= buf;
|
||||
@ -436,7 +436,7 @@ int yylex(void *arg, void *yythd)
|
||||
int tokval;
|
||||
uint length;
|
||||
enum my_lex_states state,prev_state;
|
||||
LEX *lex= &(((THD *)yythd)->lex);
|
||||
LEX *lex= (((THD *)yythd)->lex);
|
||||
YYSTYPE *yylval=(YYSTYPE*) arg;
|
||||
CHARSET_INFO *cs= ((THD *) yythd)->charset();
|
||||
uchar *state_map= cs->state_map;
|
||||
|
@ -529,4 +529,4 @@ extern pthread_key(LEX*,THR_LEX);
|
||||
|
||||
extern LEX_STRING tmp_table_alias;
|
||||
|
||||
#define current_lex (¤t_thd->lex)
|
||||
#define current_lex (current_thd->lex)
|
||||
|
@ -1087,7 +1087,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
thread_running++;
|
||||
VOID(pthread_mutex_unlock(&LOCK_thread_count));
|
||||
|
||||
thd->lex.select_lex.options=0; // We store status here
|
||||
thd->lex->select_lex.options=0; // We store status here
|
||||
switch (command) {
|
||||
case COM_INIT_DB:
|
||||
statistic_increment(com_stat[SQLCOM_CHANGE_DB],&LOCK_status);
|
||||
@ -1263,16 +1263,16 @@ restore_user:
|
||||
DBUG_PRINT("query",("%-.4096s",thd->query));
|
||||
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
|
||||
*/
|
||||
if (thd->lock || thd->open_tables || thd->derived_tables)
|
||||
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 */
|
||||
while (my_isspace(thd->charset(), *packet) && length > 0)
|
||||
@ -1510,7 +1510,7 @@ restore_user:
|
||||
|
||||
if ((ulong) (thd->start_time - thd->time_after_lock) >
|
||||
thd->variables.long_query_time ||
|
||||
((thd->lex.select_lex.options &
|
||||
((thd->lex->select_lex.options &
|
||||
(QUERY_NO_INDEX_USED | QUERY_NO_GOOD_INDEX_USED)) &&
|
||||
(specialflag & SPECIAL_LONG_LOG_FORMAT)))
|
||||
{
|
||||
@ -1592,7 +1592,7 @@ int
|
||||
mysql_execute_command(THD *thd)
|
||||
{
|
||||
int res= 0;
|
||||
LEX *lex= &thd->lex;
|
||||
LEX *lex= thd->lex;
|
||||
TABLE_LIST *tables= (TABLE_LIST*) lex->select_lex.table_list.first;
|
||||
SELECT_LEX *select_lex= &lex->select_lex;
|
||||
SELECT_LEX_UNIT *unit= &lex->unit;
|
||||
@ -1719,7 +1719,7 @@ mysql_execute_command(THD *thd)
|
||||
else
|
||||
thd->send_explain_fields(result);
|
||||
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;
|
||||
thd->lock= (MYSQL_LOCK *)0;
|
||||
result->send_eof();
|
||||
@ -2404,7 +2404,7 @@ mysql_execute_command(THD *thd)
|
||||
}
|
||||
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;
|
||||
uint table_count=0;
|
||||
multi_delete *result;
|
||||
@ -3436,7 +3436,7 @@ void
|
||||
mysql_init_query(THD *thd)
|
||||
{
|
||||
DBUG_ENTER("mysql_init_query");
|
||||
LEX *lex=&thd->lex;
|
||||
LEX *lex=thd->lex;
|
||||
lex->unit.init_query();
|
||||
lex->unit.init_select();
|
||||
lex->unit.thd= thd;
|
||||
@ -3621,7 +3621,7 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
|
||||
uint uint_geom_type)
|
||||
{
|
||||
register create_field *new_field;
|
||||
LEX *lex= &thd->lex;
|
||||
LEX *lex= thd->lex;
|
||||
uint allowed_type_modifier=0;
|
||||
char warn_buff[MYSQL_ERRMSG_SIZE];
|
||||
DBUG_ENTER("add_field_to_list");
|
||||
@ -3945,7 +3945,7 @@ add_proc_to_list(THD* thd, Item *item)
|
||||
*item_ptr= item;
|
||||
order->item=item_ptr;
|
||||
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;
|
||||
}
|
||||
|
||||
@ -4368,11 +4368,11 @@ static bool append_file_to_dir(THD *thd, char **filename_ptr, char *table_name)
|
||||
bool check_simple_select()
|
||||
{
|
||||
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];
|
||||
strmake(command, thd->lex.yylval->symbol.str,
|
||||
min(thd->lex.yylval->symbol.length, sizeof(command)-1));
|
||||
strmake(command, thd->lex->yylval->symbol.str,
|
||||
min(thd->lex->yylval->symbol.length, sizeof(command)-1));
|
||||
net_printf(thd, ER_CANT_USE_OPTION_HERE, command);
|
||||
return 1;
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ static void setup_param_functions(Item_param *param, uchar param_type)
|
||||
static bool insert_params_withlog(PREP_STMT *stmt, uchar *pos, uchar *read_pos)
|
||||
{
|
||||
THD *thd= stmt->thd;
|
||||
List<Item> ¶ms= thd->lex.param_list;
|
||||
List<Item> ¶ms= thd->lex->param_list;
|
||||
List_iterator<Item> param_iterator(params);
|
||||
Item_param *param;
|
||||
DBUG_ENTER("insert_params_withlog");
|
||||
@ -445,7 +445,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)
|
||||
{
|
||||
THD *thd= stmt->thd;
|
||||
List<Item> ¶ms= thd->lex.param_list;
|
||||
List<Item> ¶ms= thd->lex->param_list;
|
||||
List_iterator<Item> param_iterator(params);
|
||||
Item_param *param;
|
||||
DBUG_ENTER("insert_params");
|
||||
@ -471,7 +471,7 @@ static bool insert_params(PREP_STMT *stmt, uchar *pos, uchar *read_pos)
|
||||
static bool setup_params_data(PREP_STMT *stmt)
|
||||
{
|
||||
THD *thd= stmt->thd;
|
||||
List<Item> ¶ms= thd->lex.param_list;
|
||||
List<Item> ¶ms= thd->lex->param_list;
|
||||
List_iterator<Item> param_iterator(params);
|
||||
Item_param *param;
|
||||
DBUG_ENTER("setup_params_data");
|
||||
@ -517,8 +517,8 @@ static bool mysql_test_insert_fields(PREP_STMT *stmt,
|
||||
List_item *values;
|
||||
DBUG_ENTER("mysql_test_insert_fields");
|
||||
|
||||
my_bool update=(thd->lex.value_list.elements ? UPDATE_ACL : 0);
|
||||
ulong privilege= (thd->lex.duplicates == DUP_REPLACE ?
|
||||
my_bool update=(thd->lex->value_list.elements ? UPDATE_ACL : 0);
|
||||
ulong privilege= (thd->lex->duplicates == DUP_REPLACE ?
|
||||
INSERT_ACL | DELETE_ACL : INSERT_ACL | update);
|
||||
|
||||
if (check_access(thd,privilege,table_list->db,
|
||||
@ -616,8 +616,8 @@ static bool mysql_test_select_fields(PREP_STMT *stmt, TABLE_LIST *tables,
|
||||
SELECT_LEX *select_lex)
|
||||
{
|
||||
THD *thd= stmt->thd;
|
||||
LEX *lex= &thd->lex;
|
||||
select_result *result= thd->lex.result;
|
||||
LEX *lex= thd->lex;
|
||||
select_result *result= thd->lex->result;
|
||||
DBUG_ENTER("mysql_test_select_fields");
|
||||
|
||||
ulong privilege= lex->exchange ? SELECT_ACL | FILE_ACL : SELECT_ACL;
|
||||
@ -643,7 +643,7 @@ static bool mysql_test_select_fields(PREP_STMT *stmt, TABLE_LIST *tables,
|
||||
}
|
||||
else
|
||||
{
|
||||
fix_tables_pointers(thd->lex.all_selects_list);
|
||||
fix_tables_pointers(thd->lex->all_selects_list);
|
||||
if (!result && !(result= new select_send()))
|
||||
{
|
||||
delete select_lex->having;
|
||||
@ -676,8 +676,8 @@ static bool mysql_test_select_fields(PREP_STMT *stmt, TABLE_LIST *tables,
|
||||
static bool send_prepare_results(PREP_STMT *stmt)
|
||||
{
|
||||
THD *thd= stmt->thd;
|
||||
LEX *lex= &thd->lex;
|
||||
enum enum_sql_command sql_command= thd->lex.sql_command;
|
||||
LEX *lex= thd->lex;
|
||||
enum enum_sql_command sql_command= thd->lex->sql_command;
|
||||
DBUG_ENTER("send_prepare_results");
|
||||
DBUG_PRINT("enter",("command: %d, param_count: %ld",
|
||||
sql_command, lex->param_count));
|
||||
@ -758,7 +758,7 @@ static bool parse_prepare_query(PREP_STMT *stmt,
|
||||
LEX *lex=lex_start(thd, (uchar*) packet, length);
|
||||
lex->safe_to_cache_query= 0;
|
||||
thd->prepare_command= TRUE;
|
||||
thd->lex.param_count= 0;
|
||||
thd->lex->param_count= 0;
|
||||
if (!yyparse((void *)thd) && !thd->is_fatal_error)
|
||||
error= send_prepare_results(stmt);
|
||||
lex_end(lex);
|
||||
@ -772,11 +772,11 @@ static bool parse_prepare_query(PREP_STMT *stmt,
|
||||
static bool init_param_items(PREP_STMT *stmt)
|
||||
{
|
||||
THD *thd= stmt->thd;
|
||||
List<Item> ¶ms= thd->lex.param_list;
|
||||
List<Item> ¶ms= thd->lex->param_list;
|
||||
Item_param **to;
|
||||
uint32 length= thd->query_length;
|
||||
|
||||
stmt->lex= thd->lex;
|
||||
stmt->lex= *thd->lex;
|
||||
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
@ -817,7 +817,7 @@ static bool init_param_items(PREP_STMT *stmt)
|
||||
static void init_stmt_execute(PREP_STMT *stmt)
|
||||
{
|
||||
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
|
||||
@ -914,8 +914,8 @@ void mysql_stmt_execute(THD *thd, char *packet)
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
LEX thd_lex= thd->lex;
|
||||
thd->lex= stmt->lex;
|
||||
LEX *old_thd_lex= thd->lex;
|
||||
thd->lex= &stmt->lex;
|
||||
init_stmt_execute(stmt);
|
||||
|
||||
if (stmt->param_count && setup_params_data(stmt))
|
||||
@ -937,7 +937,7 @@ void mysql_stmt_execute(THD *thd, char *packet)
|
||||
if (!(specialflag & SPECIAL_NO_PRIOR))
|
||||
my_pthread_setprio(pthread_self(), WAIT_PRIOR);
|
||||
|
||||
thd->lex= thd_lex;
|
||||
thd->lex= old_thd_lex;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
@ -650,8 +650,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
|
||||
bit to 0 for the other thread
|
||||
*/
|
||||
if (thd->lex.slave_thd_opt)
|
||||
thread_mask &= thd->lex.slave_thd_opt;
|
||||
if (thd->lex->slave_thd_opt)
|
||||
thread_mask &= thd->lex->slave_thd_opt;
|
||||
if (thread_mask) //some threads are stopped, start them
|
||||
{
|
||||
if (init_master_info(mi,master_info_file,relay_log_info_file, 0))
|
||||
@ -707,8 +707,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
|
||||
bit to 0 for the other thread
|
||||
*/
|
||||
if (thd->lex.slave_thd_opt)
|
||||
thread_mask &= thd->lex.slave_thd_opt;
|
||||
if (thd->lex->slave_thd_opt)
|
||||
thread_mask &= thd->lex->slave_thd_opt;
|
||||
|
||||
if (thread_mask)
|
||||
{
|
||||
@ -856,7 +856,7 @@ int change_master(THD* thd, MASTER_INFO* mi)
|
||||
}
|
||||
|
||||
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
|
||||
if (init_master_info(mi, master_info_file, relay_log_info_file, 0))
|
||||
{
|
||||
@ -1003,7 +1003,7 @@ int show_binlog_events(THD* thd)
|
||||
|
||||
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;
|
||||
my_off_t pos = lex_mi->pos;
|
||||
char search_file_name[FN_REFLEN], *name;
|
||||
@ -1012,8 +1012,8 @@ int show_binlog_events(THD* thd)
|
||||
LOG_INFO linfo;
|
||||
Log_event* ev;
|
||||
|
||||
limit_start = thd->lex.current_select->offset_limit;
|
||||
limit_end = thd->lex.current_select->select_limit + limit_start;
|
||||
limit_start = thd->lex->current_select->offset_limit;
|
||||
limit_end = thd->lex->current_select->select_limit + limit_start;
|
||||
|
||||
name= search_file_name;
|
||||
if (log_file_name)
|
||||
|
@ -816,7 +816,7 @@ JOIN::optimize()
|
||||
}
|
||||
}
|
||||
|
||||
if (select_lex != &thd->lex.select_lex &&
|
||||
if (select_lex != &thd->lex->select_lex &&
|
||||
select_lex->linkage != DERIVED_TABLE_TYPE)
|
||||
{
|
||||
if (!(tmp_join= (JOIN*)thd->alloc(sizeof(JOIN))))
|
||||
@ -3076,7 +3076,7 @@ static void
|
||||
make_join_readinfo(JOIN *join, uint options)
|
||||
{
|
||||
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");
|
||||
|
||||
for (i=join->const_tables ; i < join->tables ; i++)
|
||||
@ -4788,7 +4788,7 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param,
|
||||
thd->proc_info="converting HEAP to MyISAM";
|
||||
|
||||
if (create_myisam_tmp_table(&new_table,param,
|
||||
thd->lex.select_lex.options | thd->options))
|
||||
thd->lex->select_lex.options | thd->options))
|
||||
goto err2;
|
||||
if (open_tmp_table(&new_table))
|
||||
goto err1;
|
||||
@ -7917,7 +7917,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
|
||||
List<Item> field_list;
|
||||
List<Item> item_list;
|
||||
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;
|
||||
Item *item_null= new Item_null();
|
||||
CHARSET_INFO *cs= &my_charset_latin1;
|
||||
@ -8101,8 +8101,8 @@ int mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
|
||||
sl= sl->next_select())
|
||||
{
|
||||
res= mysql_explain_select(thd, sl,
|
||||
(((&thd->lex.select_lex)==sl)?
|
||||
((thd->lex.all_selects_list != sl)?"PRIMARY":
|
||||
(((&thd->lex->select_lex)==sl)?
|
||||
((thd->lex->all_selects_list != sl)?"PRIMARY":
|
||||
"SIMPLE"):
|
||||
((sl == first)?
|
||||
((sl->linkage == DERIVED_TABLE_TYPE) ?
|
||||
@ -8130,7 +8130,7 @@ int mysql_explain_select(THD *thd, SELECT_LEX *select_lex, char const *type,
|
||||
DBUG_ENTER("mysql_explain_select");
|
||||
DBUG_PRINT("info", ("Select 0x%lx, type %s", (ulong)select_lex, 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();
|
||||
int res= mysql_select(thd, &select_lex->ref_pointer_array,
|
||||
(TABLE_LIST*) select_lex->table_list.first,
|
||||
@ -8141,7 +8141,7 @@ int mysql_explain_select(THD *thd, SELECT_LEX *select_lex, char const *type,
|
||||
(ORDER*) select_lex->order_list.first,
|
||||
(ORDER*) select_lex->group_list.first,
|
||||
select_lex->having,
|
||||
(ORDER*) thd->lex.proc_list.first,
|
||||
(ORDER*) thd->lex->proc_list.first,
|
||||
select_lex->options | thd->options | SELECT_DESCRIBE,
|
||||
result, unit, select_lex, 0);
|
||||
DBUG_RETURN(res);
|
||||
|
@ -1132,7 +1132,7 @@ static int prepare_for_restore(THD* thd, TABLE_LIST* table,
|
||||
}
|
||||
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* table_name = table->real_name;
|
||||
char* db = thd->db ? thd->db : table->db;
|
||||
@ -2345,9 +2345,9 @@ copy_data_between_tables(TABLE *from,TABLE *to,
|
||||
tables.db = from->table_cache_key;
|
||||
error=1;
|
||||
|
||||
if (setup_ref_array(thd, &thd->lex.select_lex.ref_pointer_array,
|
||||
if (setup_ref_array(thd, &thd->lex->select_lex.ref_pointer_array,
|
||||
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) ||
|
||||
!(sortorder=make_unireg_sortorder(order, &length)) ||
|
||||
(from->sort.found_records = filesort(thd, from, sortorder, length,
|
||||
|
@ -115,7 +115,7 @@ bool select_union::flush()
|
||||
int st_select_lex_unit::prepare(THD *thd, select_result *sel_result,
|
||||
bool tables_and_fields_initied)
|
||||
{
|
||||
SELECT_LEX_NODE *lex_select_save= thd->lex.current_select;
|
||||
SELECT_LEX_NODE *lex_select_save= thd->lex->current_select;
|
||||
SELECT_LEX *select_cursor;
|
||||
DBUG_ENTER("st_select_lex_unit::prepare");
|
||||
|
||||
@ -129,7 +129,7 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result,
|
||||
t_and_f= tables_and_fields_initied;
|
||||
|
||||
bzero((char *)&tmp_table_param,sizeof(TMP_TABLE_PARAM));
|
||||
thd->lex.current_select= select_cursor= first_select_in_union();
|
||||
thd->lex->current_select= select_cursor= first_select_in_union();
|
||||
/* Global option */
|
||||
if (((void*)(global_parameters)) == ((void*)this))
|
||||
{
|
||||
@ -194,14 +194,14 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result,
|
||||
or derived table ...
|
||||
*/
|
||||
|
||||
if (thd->lex.describe)
|
||||
if (thd->lex->describe)
|
||||
{
|
||||
for (SELECT_LEX *sl= select_cursor; sl; sl= sl->next_select())
|
||||
{
|
||||
JOIN *join= new JOIN(thd, sl->item_list,
|
||||
sl->options | thd->options | SELECT_NO_UNLOCK,
|
||||
union_result);
|
||||
thd->lex.current_select= sl;
|
||||
thd->lex->current_select= sl;
|
||||
offset_limit_cnt= sl->offset_limit;
|
||||
select_limit_cnt= sl->select_limit+sl->offset_limit;
|
||||
if (select_limit_cnt < sl->select_limit)
|
||||
@ -227,7 +227,7 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result,
|
||||
}
|
||||
|
||||
item_list.empty();
|
||||
thd->lex.current_select= lex_select_save;
|
||||
thd->lex->current_select= lex_select_save;
|
||||
{
|
||||
List_iterator<Item> it(select_cursor->item_list);
|
||||
Field **field;
|
||||
@ -242,7 +242,7 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result,
|
||||
|
||||
DBUG_RETURN(res || thd->is_fatal_error ? 1 : 0);
|
||||
err:
|
||||
thd->lex.current_select= lex_select_save;
|
||||
thd->lex->current_select= lex_select_save;
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
@ -250,7 +250,7 @@ err:
|
||||
int st_select_lex_unit::exec()
|
||||
{
|
||||
int do_print_slow= 0;
|
||||
SELECT_LEX_NODE *lex_select_save= thd->lex.current_select;
|
||||
SELECT_LEX_NODE *lex_select_save= thd->lex->current_select;
|
||||
SELECT_LEX *select_cursor=first_select_in_union();
|
||||
DBUG_ENTER("st_select_lex_unit::exec");
|
||||
|
||||
@ -275,7 +275,7 @@ int st_select_lex_unit::exec()
|
||||
JOIN *join= new JOIN(thd, sl->item_list,
|
||||
sl->options | thd->options | SELECT_NO_UNLOCK,
|
||||
union_result);
|
||||
thd->lex.current_select= sl;
|
||||
thd->lex->current_select= sl;
|
||||
offset_limit_cnt= sl->offset_limit;
|
||||
select_limit_cnt= sl->select_limit+sl->offset_limit;
|
||||
if (select_limit_cnt < sl->select_limit)
|
||||
@ -297,7 +297,7 @@ int st_select_lex_unit::exec()
|
||||
t_and_f=0;
|
||||
if (res | thd->is_fatal_error)
|
||||
{
|
||||
thd->lex.current_select= lex_select_save;
|
||||
thd->lex->current_select= lex_select_save;
|
||||
DBUG_RETURN(res);
|
||||
}
|
||||
res= sl->join->optimize();
|
||||
@ -308,13 +308,13 @@ int st_select_lex_unit::exec()
|
||||
res= sl->join->error;
|
||||
if (!res && union_result->flush())
|
||||
{
|
||||
thd->lex.current_select= lex_select_save;
|
||||
thd->lex->current_select= lex_select_save;
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
}
|
||||
if (res)
|
||||
{
|
||||
thd->lex.current_select= lex_select_save;
|
||||
thd->lex->current_select= lex_select_save;
|
||||
DBUG_RETURN(res);
|
||||
}
|
||||
do_print_slow|= select_cursor->options;
|
||||
@ -325,7 +325,7 @@ int st_select_lex_unit::exec()
|
||||
/* Send result to 'result' */
|
||||
|
||||
// to correct ORDER BY reference resolving
|
||||
thd->lex.current_select= select_cursor;
|
||||
thd->lex->current_select= select_cursor;
|
||||
res= -1;
|
||||
{
|
||||
List<Item_func_match> empty_list;
|
||||
@ -333,7 +333,7 @@ int st_select_lex_unit::exec()
|
||||
|
||||
if (!thd->is_fatal_error) // Check if EOM
|
||||
{
|
||||
SELECT_LEX *fake_select = new SELECT_LEX(&thd->lex);
|
||||
SELECT_LEX *fake_select = new SELECT_LEX(thd->lex);
|
||||
offset_limit_cnt= (select_cursor->braces ?
|
||||
global_parameters->offset_limit : 0);
|
||||
select_limit_cnt= (select_cursor->braces ?
|
||||
@ -367,7 +367,7 @@ int st_select_lex_unit::exec()
|
||||
QUERY_NO_GOOD_INDEX_USED));
|
||||
}
|
||||
}
|
||||
thd->lex.current_select= lex_select_save;
|
||||
thd->lex->current_select= lex_select_save;
|
||||
DBUG_RETURN(res);
|
||||
}
|
||||
|
||||
|
@ -67,14 +67,14 @@ int mysql_update(THD *thd,
|
||||
SQL_SELECT *select;
|
||||
READ_RECORD info;
|
||||
TABLE_LIST *update_table_list= (TABLE_LIST*)
|
||||
thd->lex.select_lex.table_list.first;
|
||||
thd->lex->select_lex.table_list.first;
|
||||
DBUG_ENTER("mysql_update");
|
||||
LINT_INIT(used_index);
|
||||
LINT_INIT(timestamp_query_id);
|
||||
|
||||
if ((open_and_lock_tables(thd, table_list)))
|
||||
DBUG_RETURN(-1);
|
||||
fix_tables_pointers(thd->lex.all_selects_list);
|
||||
fix_tables_pointers(thd->lex->all_selects_list);
|
||||
table= table_list->table;
|
||||
|
||||
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
|
||||
@ -87,7 +87,7 @@ int mysql_update(THD *thd,
|
||||
table->grant.want_privilege=(SELECT_ACL & ~table->grant.privilege);
|
||||
if (setup_tables(update_table_list) ||
|
||||
setup_conds(thd,update_table_list,&conds)
|
||||
|| setup_ftfuncs(&thd->lex.select_lex))
|
||||
|| setup_ftfuncs(&thd->lex->select_lex))
|
||||
DBUG_RETURN(-1); /* purecov: inspected */
|
||||
if (find_real_table_in_list(table_list->next,
|
||||
table_list->db, table_list->real_name))
|
||||
@ -126,7 +126,7 @@ int mysql_update(THD *thd,
|
||||
table->grant.want_privilege=(SELECT_ACL & ~table->grant.privilege);
|
||||
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 */
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ int mysql_update(THD *thd,
|
||||
(select && select->check_quick(safe_update, limit)) || !limit)
|
||||
{
|
||||
delete select;
|
||||
free_underlaid_joins(thd, &thd->lex.select_lex);
|
||||
free_underlaid_joins(thd, &thd->lex->select_lex);
|
||||
if (error)
|
||||
{
|
||||
DBUG_RETURN(-1); // Error in where
|
||||
@ -148,16 +148,16 @@ int mysql_update(THD *thd,
|
||||
/* If running in safe sql mode, don't allow updates without keys */
|
||||
if (!table->quick_keys)
|
||||
{
|
||||
thd->lex.select_lex.options|=QUERY_NO_INDEX_USED;
|
||||
thd->lex->select_lex.options|=QUERY_NO_INDEX_USED;
|
||||
if (safe_update && !using_limit)
|
||||
{
|
||||
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);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
}
|
||||
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 */
|
||||
if (select && select->quick)
|
||||
used_key_is_modified= (!select->quick->unique_key_range() &&
|
||||
@ -180,7 +180,7 @@ int mysql_update(THD *thd,
|
||||
DISK_BUFFER_SIZE, MYF(MY_WME)))
|
||||
{
|
||||
delete select; /* purecov: inspected */
|
||||
free_underlaid_joins(thd, &thd->lex.select_lex);
|
||||
free_underlaid_joins(thd, &thd->lex->select_lex);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
if (old_used_keys & ((key_map) 1 << used_index))
|
||||
@ -203,9 +203,9 @@ int mysql_update(THD *thd,
|
||||
|
||||
table->sort.io_cache = (IO_CACHE *) my_malloc(sizeof(IO_CACHE),
|
||||
MYF(MY_FAE | MY_ZEROFILL));
|
||||
if (setup_ref_array(thd, &thd->lex.select_lex.ref_pointer_array,
|
||||
if (setup_ref_array(thd, &thd->lex->select_lex.ref_pointer_array,
|
||||
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) ||
|
||||
!(sortorder=make_unireg_sortorder(order, &length)) ||
|
||||
(table->sort.found_records = filesort(thd, table, sortorder, length,
|
||||
@ -214,7 +214,7 @@ int mysql_update(THD *thd,
|
||||
== HA_POS_ERROR)
|
||||
{
|
||||
delete select;
|
||||
free_underlaid_joins(thd, &thd->lex.select_lex);
|
||||
free_underlaid_joins(thd, &thd->lex->select_lex);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
}
|
||||
@ -269,7 +269,7 @@ int mysql_update(THD *thd,
|
||||
if (error >= 0)
|
||||
{
|
||||
delete select;
|
||||
free_underlaid_joins(thd, &thd->lex.select_lex);
|
||||
free_underlaid_joins(thd, &thd->lex->select_lex);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
}
|
||||
@ -354,7 +354,7 @@ int mysql_update(THD *thd,
|
||||
}
|
||||
|
||||
delete select;
|
||||
free_underlaid_joins(thd, &thd->lex.select_lex);
|
||||
free_underlaid_joins(thd, &thd->lex->select_lex);
|
||||
if (error >= 0)
|
||||
send_error(thd,thd->killed_errno()); /* purecov: inspected */
|
||||
else
|
||||
@ -399,7 +399,7 @@ int mysql_multi_update(THD *thd,
|
||||
table_list->grant.want_privilege=(SELECT_ACL & ~table_list->grant.privilege);
|
||||
if ((res=open_and_lock_tables(thd,table_list)))
|
||||
DBUG_RETURN(res);
|
||||
fix_tables_pointers(thd->lex.all_selects_list);
|
||||
fix_tables_pointers(thd->lex->all_selects_list);
|
||||
|
||||
thd->select_limit=HA_POS_ERROR;
|
||||
if (setup_fields(thd, 0, table_list, *fields, 1, 0, 0))
|
||||
|
@ -28,7 +28,7 @@
|
||||
#define MYSQL_YACC
|
||||
#define YYINITDEPTH 100
|
||||
#define YYMAXDEPTH 3200 /* Because of 64K stack */
|
||||
#define Lex (&(YYTHD->lex))
|
||||
#define Lex ((YYTHD->lex))
|
||||
#define Select Lex->current_select
|
||||
#include "mysql_priv.h"
|
||||
#include "slave.h"
|
||||
@ -729,14 +729,14 @@ query:
|
||||
{
|
||||
THD *thd= YYTHD;
|
||||
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);
|
||||
YYABORT;
|
||||
}
|
||||
else
|
||||
{
|
||||
thd->lex.sql_command = SQLCOM_EMPTY_QUERY;
|
||||
thd->lex->sql_command = SQLCOM_EMPTY_QUERY;
|
||||
}
|
||||
}
|
||||
| verb_clause END_OF_INPUT {};
|
||||
@ -2082,7 +2082,7 @@ alter:
|
||||
ALTER opt_ignore TABLE_SYM table_ident
|
||||
{
|
||||
THD *thd= YYTHD;
|
||||
LEX *lex=&thd->lex;
|
||||
LEX *lex= thd->lex;
|
||||
lex->sql_command = SQLCOM_ALTER_TABLE;
|
||||
lex->name=0;
|
||||
if (!lex->select_lex.add_table_to_list(thd, $4, NULL,
|
||||
@ -2532,7 +2532,7 @@ select_item_list:
|
||||
THD *thd= YYTHD;
|
||||
if (add_item_to_list(thd, new Item_field(NULL, NULL, "*")))
|
||||
YYABORT;
|
||||
(thd->lex.current_select->select_lex()->with_wild)++;
|
||||
(thd->lex->current_select->select_lex()->with_wild)++;
|
||||
};
|
||||
|
||||
|
||||
@ -4260,8 +4260,8 @@ show_param:
|
||||
| opt_var_type VARIABLES wild
|
||||
{
|
||||
THD *thd= YYTHD;
|
||||
thd->lex.sql_command= SQLCOM_SHOW_VARIABLES;
|
||||
thd->lex.option_type= (enum_var_type) $1;
|
||||
thd->lex->sql_command= SQLCOM_SHOW_VARIABLES;
|
||||
thd->lex->option_type= (enum_var_type) $1;
|
||||
}
|
||||
| charset wild
|
||||
{ Lex->sql_command= SQLCOM_SHOW_CHARSETS; }
|
||||
@ -4664,7 +4664,7 @@ simple_ident:
|
||||
| ident '.' ident
|
||||
{
|
||||
THD *thd= YYTHD;
|
||||
LEX *lex= &thd->lex;
|
||||
LEX *lex= thd->lex;
|
||||
SELECT_LEX_NODE *sel= lex->current_select;
|
||||
if (sel->no_table_names_allowed)
|
||||
{
|
||||
@ -4677,7 +4677,7 @@ simple_ident:
|
||||
| '.' ident '.' ident
|
||||
{
|
||||
THD *thd= YYTHD;
|
||||
LEX *lex= &thd->lex;
|
||||
LEX *lex= thd->lex;
|
||||
SELECT_LEX_NODE *sel= lex->current_select;
|
||||
if (sel->no_table_names_allowed)
|
||||
{
|
||||
@ -4690,7 +4690,7 @@ simple_ident:
|
||||
| ident '.' ident '.' ident
|
||||
{
|
||||
THD *thd= YYTHD;
|
||||
LEX *lex= &thd->lex;
|
||||
LEX *lex= thd->lex;
|
||||
SELECT_LEX_NODE *sel= lex->current_select;
|
||||
if (sel->no_table_names_allowed)
|
||||
{
|
||||
@ -5079,7 +5079,7 @@ option_value:
|
||||
YYABORT;
|
||||
user->host.str=0;
|
||||
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
|
||||
{
|
||||
@ -5597,7 +5597,7 @@ optional_order_or_limit:
|
||||
|
|
||||
{
|
||||
THD *thd= YYTHD;
|
||||
LEX *lex= &thd->lex;
|
||||
LEX *lex= thd->lex;
|
||||
DBUG_ASSERT(lex->current_select->linkage != GLOBAL_OPTIONS_TYPE);
|
||||
SELECT_LEX *sel= lex->current_select->select_lex();
|
||||
SELECT_LEX_UNIT *unit= sel->master_unit();
|
||||
@ -5609,7 +5609,7 @@ optional_order_or_limit:
|
||||
order_or_limit
|
||||
{
|
||||
THD *thd= YYTHD;
|
||||
thd->lex.current_select->no_table_names_allowed= 0;
|
||||
thd->lex->current_select->no_table_names_allowed= 0;
|
||||
thd->where= "";
|
||||
}
|
||||
;
|
||||
|
Loading…
x
Reference in New Issue
Block a user