From f83cf4144065c12cad4007767e2e70d444fd0e05 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 17 Mar 2004 14:26:26 +0200 Subject: DBUG_ASSERT(fixed == 0) added to fix_fields() sql/item.cc: layout fixed fixed bug in prepared statements with subqueries and outer references sql/item.h: neg_transformer get thd argument to call fix_fields sql/item_cmpfunc.cc: DBUG_ASSERT(fixed == 0) added to fix_fields() fixed Item_in_optimizer fixed flag neg_arguments(), neg_transformer() call fix_field() on created items to avoid bouble fix field or non-called fixfields() sql/item_cmpfunc.h: neg_transformer get thd argument to call fix_fields fixed forgoten cleanup() call of parent class sql/item_func.cc: DBUG_ASSERT(fixed == 0) and fixed flag check added to fix_fields() sql/item_func.h: DBUG_ASSERT(fixed == 0) added to fix_fields() fixed forgoten cleanup() call of parent class sql/item_row.cc: DBUG_ASSERT(fixed == 0) added to fix_fields() added forgoten 'fixed' flag set sql/item_subselect.cc: DBUG_ASSERT(fixed == 0) added to fix_fields() fixed subquery transformation sql/sql_base.cc: check of fixed flag added sql/sql_derived.cc: fixed cleunup union in derived table during EXPLAIN command processing sql/sql_select.cc: thd argument add to function to allow call fix_fields() of new created items fixed EXPLAIN double preparation check of fixed flag added eliminate_not_funcs fixed for corrcet fix_fields call of new created items sql/sql_select.h: thd argument add to function to allow call fix_fields() of new created items sql/sql_union.cc: union processing fixed tests/client_test.c: layout fixed new test of outer references fron subqueries --- sql/item_func.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sql/item_func.h') diff --git a/sql/item_func.h b/sql/item_func.h index 8fbe5a124da..b463be1e0ca 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -765,6 +765,7 @@ public: const char *func_name() const { return udf.name(); } bool fix_fields(THD *thd, struct st_table_list *tables, Item **ref) { + DBUG_ASSERT(fixed == 0); bool res= udf.fix_fields(thd, tables, this, arg_count, args); used_tables_cache= udf.used_tables_cache; const_item_cache= udf.const_item_cache; @@ -1000,6 +1001,7 @@ public: void cleanup() { DBUG_ENTER("Item_func_match"); + Item_real_func::cleanup(); if (!master && ft_handler) { ft_handler->please->close_search(ft_handler); -- cgit v1.2.1 From 1a81e0414515cef6275b5d2f3f27b950aa1ff91f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 Mar 2004 15:14:36 +0200 Subject: DBUG_ASSERT(fixed == 1); added to val* small optimisation in signed_literal sql/field.cc: layout fixed sql/item.cc: DBUG_ASSERT(fixed == 1); added to val* layout fixed fixed= 1; added where it was forgoten in fix_fields Item_string can be used without fix_fields sql/item.h: DBUG_ASSERT(fixed == 1); added to val* Item_string can be used without fix_fields sql/item_cmpfunc.cc: DBUG_ASSERT(fixed == 1); added to val* sql/item_cmpfunc.h: fixed layout and getting Item statistic sql/item_func.cc: DBUG_ASSERT(fixed == 1); added to val* sql/item_func.h: DBUG_ASSERT(fixed == 1); added to val* sql/item_geofunc.cc: DBUG_ASSERT(fixed == 1); added to val* sql/item_strfunc.cc: DBUG_ASSERT(fixed == 1); added to val* layout fixed sql/item_strfunc.h: DBUG_ASSERT(fixed == 1); added to val* sql/item_subselect.cc: DBUG_ASSERT(fixed == 1); added to val* sql/item_sum.cc: DBUG_ASSERT(fixed == 1); added to val* sql/item_sum.h: DBUG_ASSERT(fixed == 1); added to val* sql/item_timefunc.cc: DBUG_ASSERT(fixed == 1); added to val* sql/item_timefunc.h: DBUG_ASSERT(fixed == 1); added to val* sql/item_uniq.h: DBUG_ASSERT(fixed == 1); added to val* sql/sql_base.cc: Item creation revised sql/sql_help.cc: Item creation revised sql/sql_load.cc: Item creation revised sql/sql_parse.cc: fix_field call added sql/sql_select.cc: Item creation revised sql/sql_show.cc: Item creation revised sql/sql_union.cc: Item creation revised sql/sql_update.cc: Item creation revised sql/sql_yacc.yy: Item creation revised small optimisation in signed_literal --- sql/item_func.h | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'sql/item_func.h') diff --git a/sql/item_func.h b/sql/item_func.h index b463be1e0ca..73846a1fd31 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -155,7 +155,7 @@ public: Item_real_func(Item *a,Item *b) :Item_func(a,b) {} Item_real_func(List &list) :Item_func(list) {} String *val_str(String*str); - longlong val_int() { return (longlong) val(); } + longlong val_int() { DBUG_ASSERT(fixed == 1); return (longlong) val(); } enum Item_result result_type () const { return REAL_RESULT; } void fix_length_and_dec() { decimals=NOT_FIXED_DEC; max_length=float_length(decimals); } }; @@ -169,7 +169,7 @@ public: Item_num_func(Item *a) :Item_func(a),hybrid_type(REAL_RESULT) {} Item_num_func(Item *a,Item *b) :Item_func(a,b),hybrid_type(REAL_RESULT) {} String *val_str(String*str); - longlong val_int() { return (longlong) val(); } + longlong val_int() { DBUG_ASSERT(fixed == 1); return (longlong) val(); } enum Item_result result_type () const { return hybrid_type; } void fix_length_and_dec() { fix_num_length_and_dec(); } bool is_null() { (void) val(); return null_value; } @@ -200,7 +200,7 @@ public: Item_int_func(Item *a,Item *b,Item *c) :Item_func(a,b,c) { max_length=21; } Item_int_func(List &list) :Item_func(list) { max_length=21; } Item_int_func(THD *thd, Item_int_func *item) :Item_func(thd, item) {} - double val() { return (double) val_int(); } + double val() { DBUG_ASSERT(fixed == 1); return (double) val_int(); } String *val_str(String*str); enum Item_result result_type () const { return INT_RESULT; } void fix_length_and_dec() {} @@ -285,7 +285,7 @@ class Item_func_int_div :public Item_num_op public: Item_func_int_div(Item *a,Item *b) :Item_num_op(a,b) { hybrid_type=INT_RESULT; } - double val() { return (double) val_int(); } + double val() { DBUG_ASSERT(fixed == 1); return (double) val_int(); } longlong val_int(); const char *func_name() const { return "DIV"; } void fix_length_and_dec(); @@ -584,7 +584,8 @@ class Item_func_bit_length :public Item_func_length { public: Item_func_bit_length(Item *a) :Item_func_length(a) {} - longlong val_int() { return Item_func_length::val_int()*8; } + longlong val_int() + { DBUG_ASSERT(fixed == 1); return Item_func_length::val_int()*8; } const char *func_name() const { return "bit_length"; } }; @@ -783,7 +784,8 @@ class Item_func_udf_float :public Item_udf_func Item_func_udf_float(udf_func *udf_arg) :Item_udf_func(udf_arg) {} Item_func_udf_float(udf_func *udf_arg, List &list) :Item_udf_func(udf_arg,list) {} - longlong val_int() { return (longlong) Item_func_udf_float::val(); } + longlong val_int() + { DBUG_ASSERT(fixed == 1); return (longlong) Item_func_udf_float::val(); } double val(); String *val_str(String *str); void fix_length_and_dec() { fix_num_length_and_dec(); } @@ -834,7 +836,7 @@ class Item_func_udf_float :public Item_real_func public: Item_func_udf_float(udf_func *udf_arg) :Item_real_func() {} Item_func_udf_float(udf_func *udf_arg, List &list) :Item_real_func(list) {} - double val() { return 0.0; } + double val() { DBUG_ASSERT(fixed == 1); return 0.0; } }; @@ -843,7 +845,7 @@ class Item_func_udf_int :public Item_int_func public: Item_func_udf_int(udf_func *udf_arg) :Item_int_func() {} Item_func_udf_int(udf_func *udf_arg, List &list) :Item_int_func(list) {} - longlong val_int() { return 0; } + longlong val_int() { DBUG_ASSERT(fixed == 1); return 0; } }; @@ -852,9 +854,10 @@ class Item_func_udf_str :public Item_func public: Item_func_udf_str(udf_func *udf_arg) :Item_func() {} Item_func_udf_str(udf_func *udf_arg, List &list) :Item_func(list) {} - String *val_str(String *) { null_value=1; return 0; } - double val() { null_value=1; return 0.0; } - longlong val_int() { null_value=1; return 0; } + String *val_str(String *) + { DBUG_ASSERT(fixed == 1); null_value=1; return 0; } + double val() { DBUG_ASSERT(fixed == 1); null_value=1; return 0.0; } + longlong val_int() { DBUG_ASSERT(fixed == 1); null_value=1; return 0; } enum Item_result result_type () const { return STRING_RESULT; } void fix_length_and_dec() { maybe_null=1; max_length=0; } }; @@ -1023,7 +1026,7 @@ public: table_map not_null_tables() const { return 0; } bool fix_fields(THD *thd, struct st_table_list *tlist, Item **ref); bool eq(const Item *, bool binary_cmp) const; - longlong val_int() { return val()!=0.0; } + longlong val_int() { DBUG_ASSERT(fixed == 1); return val()!=0.0; } double val(); void print(String *str); -- cgit v1.2.1