diff options
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r-- | sql/sql_parse.cc | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 5e58ceb9621..a86465f73b0 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2685,7 +2685,7 @@ mysql_execute_command(THD *thd) goto error; } if (v->var->session_is_default(thd)) - o= new set_var(v->type, v->var, &v->base, NULL); + o= new set_var(thd,v->type, v->var, &v->base, NULL); else { switch (v->var->option.var_type & GET_TYPE_MASK) @@ -2697,10 +2697,10 @@ mysql_execute_command(THD *thd) { bool null_value; longlong val= v->var->val_int(&null_value, thd, v->type, &v->base); - o= new set_var(v->type, v->var, &v->base, + o= new set_var(thd, v->type, v->var, &v->base, (null_value ? - (Item *)new Item_null() : - (Item *)new Item_int(val))); + (Item *) new Item_null(thd) : + (Item *) new Item_int(thd, val))); } break; case GET_UINT: @@ -2709,20 +2709,20 @@ mysql_execute_command(THD *thd) { bool null_value; ulonglong val= v->var->val_int(&null_value, thd, v->type, &v->base); - o= new set_var(v->type, v->var, &v->base, + o= new set_var(thd, v->type, v->var, &v->base, (null_value ? - (Item *)new Item_null() : - (Item *)new Item_uint(val))); + (Item *) new Item_null(thd) : + (Item *) new Item_uint(thd, val))); } break; case GET_DOUBLE: { bool null_value; double val= v->var->val_real(&null_value, thd, v->type, &v->base); - o= new set_var(v->type, v->var, &v->base, + o= new set_var(thd, v->type, v->var, &v->base, (null_value ? - (Item *)new Item_null() : - (Item *)new Item_float(val, 1))); + (Item *) new Item_null(thd) : + (Item *) new Item_float(thd, val, 1))); } break; default: @@ -2741,12 +2741,13 @@ mysql_execute_command(THD *thd) val= v->var->val_str(&tmp, thd, v->type, &v->base); if (val) { - Item_string *str= new Item_string(v->var->charset(thd), + Item_string *str= new Item_string(thd, v->var->charset(thd), val->ptr(), val->length()); - o= new set_var(v->type, v->var, &v->base, str); + o= new set_var(thd, v->type, v->var, &v->base, str); } else - o= new set_var(v->type, v->var, &v->base, new Item_null()); + o= new set_var(thd, v->type, v->var, &v->base, + new Item_null(thd)); } break; } @@ -3002,7 +3003,7 @@ mysql_execute_command(THD *thd) my_error(ER_WRONG_ARGUMENTS, MYF(0), "PURGE LOGS BEFORE"); goto error; } - it= new Item_func_unix_timestamp(it); + it= new Item_func_unix_timestamp(thd, it); it->fix_fields(thd, &it); res = purge_master_logs_before_date(thd, (ulong)it->val_int()); break; @@ -4087,7 +4088,7 @@ end_with_restore_list: /* condition will be TRUE on SP re-excuting */ if (select_lex->item_list.elements != 0) select_lex->item_list.empty(); - if (add_item_to_list(thd, new Item_null())) + if (add_item_to_list(thd, new Item_null(thd))) goto error; THD_STAGE_INFO(thd, stage_init); @@ -5745,7 +5746,8 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables) SELECT_LEX *param= lex->unit.global_parameters(); if (!param->explicit_limit) param->select_limit= - new (thd->mem_root) Item_int((ulonglong) thd->variables.select_limit); + new (thd->mem_root) Item_int(thd, + (ulonglong) thd->variables.select_limit); } if (!(res= open_and_lock_tables(thd, all_tables, TRUE, 0))) { @@ -7867,14 +7869,14 @@ push_new_name_resolution_context(THD *thd, @return fixed condition */ -Item *normalize_cond(Item *cond) +Item *normalize_cond(THD *thd, Item *cond) { if (cond) { Item::Type type= cond->type(); if (type == Item::FIELD_ITEM || type == Item::REF_ITEM) { - cond= new Item_func_ne(cond, new Item_int(0)); + cond= new Item_func_ne(thd, cond, new Item_int(thd, 0)); } } return cond; @@ -7895,11 +7897,11 @@ Item *normalize_cond(Item *cond) TRUE if all is OK */ -void add_join_on(TABLE_LIST *b, Item *expr) +void add_join_on(THD *thd, TABLE_LIST *b, Item *expr) { if (expr) { - expr= normalize_cond(expr); + expr= normalize_cond(thd, expr); if (!b->on_expr) b->on_expr= expr; else @@ -7909,7 +7911,7 @@ void add_join_on(TABLE_LIST *b, Item *expr) right and left join. If called later, it happens if we add more than one condition to the ON clause. */ - b->on_expr= new Item_cond_and(b->on_expr,expr); + b->on_expr= new Item_cond_and(thd, b->on_expr,expr); } b->on_expr->top_level_item(); } @@ -8279,16 +8281,17 @@ Item * all_any_subquery_creator(THD *thd, Item *left_expr, return new (thd->mem_root) Item_in_subselect(thd, left_expr, select_lex); if ((cmp == &comp_ne_creator) && all) // <> ALL <=> NOT IN - return new (thd->mem_root) Item_func_not( + return new (thd->mem_root) Item_func_not(thd, new (thd->mem_root) Item_in_subselect(thd, left_expr, select_lex)); Item_allany_subselect *it= new (thd->mem_root) Item_allany_subselect(thd, left_expr, cmp, select_lex, all); - if (all) - return it->upper_item= new (thd->mem_root) Item_func_not_all(it); /* ALL */ + if (all) /* ALL */ + return it->upper_item= new (thd->mem_root) Item_func_not_all(thd, it); - return it->upper_item= new (thd->mem_root) Item_func_nop_all(it); /* ANY/SOME */ + /* ANY/SOME */ + return it->upper_item= new (thd->mem_root) Item_func_nop_all(thd, it); } @@ -8816,12 +8819,12 @@ Item *negate_expression(THD *thd, Item *expr) if it is not boolean function then we have to emulate value of not(not(a)), it will be a != 0 */ - return new Item_func_ne(arg, new Item_int((char*) "0", 0, 1)); + return new Item_func_ne(thd, arg, new Item_int(thd, (char*) "0", 0, 1)); } if ((negated= expr->neg_transformer(thd)) != 0) return negated; - return new Item_func_not(expr); + return new Item_func_not(thd, expr); } /** |