From 8c52df67436b9ed3438c5683d64460f87a0942a5 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 6 Jun 2011 20:28:15 +0200 Subject: revert a suggested "optimization" that introduced a bug compilation error in mysys/my_getsystime.c fixed some redundant code removed sec_to_time, time_to_sec, from_unixtime, unix_timestamp, @@timestamp now use decimal, not double for numbers with a fractional part. purge_master_logs_before_date() fixed many bugs in corner cases fixed mysys/my_getsystime.c: compilation failure fixed sql/sql_parse.cc: don't cut corners. it backfires. --- sql/item_sum.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'sql/item_sum.cc') diff --git a/sql/item_sum.cc b/sql/item_sum.cc index d2fd0c4b0eb..e38e1d237b6 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -500,7 +500,7 @@ Field *Item_sum::create_tmp_field(bool group, TABLE *table, field= Field_new_decimal::create_from_item(this); break; case ROW_RESULT: - default: + case TIME_RESULT: // This case should never be choosen DBUG_ASSERT(0); return 0; @@ -624,7 +624,7 @@ Item_sum_hybrid::fix_fields(THD *thd, Item **ref) max_length= item->max_length; break; case ROW_RESULT: - default: + case TIME_RESULT: DBUG_ASSERT(0); }; setup_hybrid(args[0], NULL); @@ -761,13 +761,14 @@ void Item_sum_sum::fix_length_and_dec() DBUG_ENTER("Item_sum_sum::fix_length_and_dec"); maybe_null=null_value=1; decimals= args[0]->decimals; - switch (args[0]->result_type()) { + switch (args[0]->cast_to_int_type()) { case REAL_RESULT: case STRING_RESULT: hybrid_type= REAL_RESULT; sum= 0.0; break; case INT_RESULT: + case TIME_RESULT: case DECIMAL_RESULT: { /* SUM result can't be longer than length(arg) + length(MAX_ROWS) */ @@ -781,7 +782,6 @@ void Item_sum_sum::fix_length_and_dec() break; } case ROW_RESULT: - default: DBUG_ASSERT(0); } DBUG_PRINT("info", ("Type: %s (%d, %d)", @@ -970,7 +970,7 @@ void Item_sum_distinct::fix_length_and_dec() table_field_type= MYSQL_TYPE_NEWDECIMAL; break; case ROW_RESULT: - default: + case TIME_RESULT: DBUG_ASSERT(0); } val.traits->fix_length_and_dec(this, args[0]); @@ -1421,7 +1421,7 @@ void Item_sum_variance::fix_length_and_dec() break; } case ROW_RESULT: - default: + case TIME_RESULT: DBUG_ASSERT(0); } DBUG_PRINT("info", ("Type: REAL_RESULT (%d, %d)", max_length, (int)decimals)); @@ -1832,7 +1832,7 @@ void Item_sum_hybrid::reset_field() break; } case ROW_RESULT: - default: + case TIME_RESULT: DBUG_ASSERT(0); } } -- cgit v1.2.1