@@ -2246,50 +2246,6 @@ void Item_func_between::print(String *str, enum_query_type query_type)
2246
2246
}
2247
2247
2248
2248
2249
- void
2250
- Item_func_case_abbreviation2::fix_length_and_dec2 (Item **args)
2251
- {
2252
- uint32 char_length;
2253
- set_handler_by_field_type (agg_field_type (args, 2 , true ));
2254
- maybe_null=args[0 ]->maybe_null || args[1 ]->maybe_null ;
2255
- decimals= MY_MAX (args[0 ]->decimals , args[1 ]->decimals );
2256
- unsigned_flag= args[0 ]->unsigned_flag && args[1 ]->unsigned_flag ;
2257
-
2258
- if (Item_func_case_abbreviation2::result_type () == DECIMAL_RESULT ||
2259
- Item_func_case_abbreviation2::result_type () == INT_RESULT)
2260
- {
2261
- int len0= args[0 ]->max_char_length () - args[0 ]->decimals
2262
- - (args[0 ]->unsigned_flag ? 0 : 1 );
2263
-
2264
- int len1= args[1 ]->max_char_length () - args[1 ]->decimals
2265
- - (args[1 ]->unsigned_flag ? 0 : 1 );
2266
-
2267
- char_length= MY_MAX (len0, len1) + decimals + (unsigned_flag ? 0 : 1 );
2268
- }
2269
- else
2270
- char_length= MY_MAX (args[0 ]->max_char_length (), args[1 ]->max_char_length ());
2271
-
2272
- switch (Item_func_case_abbreviation2::result_type ()) {
2273
- case STRING_RESULT:
2274
- if (count_string_result_length (Item_func_case_abbreviation2::field_type (),
2275
- args, 2 ))
2276
- return ;
2277
- break ;
2278
- case DECIMAL_RESULT:
2279
- case REAL_RESULT:
2280
- break ;
2281
- case INT_RESULT:
2282
- decimals= 0 ;
2283
- break ;
2284
- case ROW_RESULT:
2285
- case TIME_RESULT:
2286
- DBUG_ASSERT (0 );
2287
- }
2288
- fix_char_length (char_length);
2289
- }
2290
-
2291
-
2292
-
2293
2249
uint Item_func_case_abbreviation2::decimal_precision2 (Item **args) const
2294
2250
{
2295
2251
int arg0_int_part= args[0 ]->decimal_int_part ();
@@ -3076,24 +3032,6 @@ bool Item_func_case::fix_fields(THD *thd, Item **ref)
3076
3032
}
3077
3033
3078
3034
3079
- void Item_func_case::agg_str_lengths (Item* arg)
3080
- {
3081
- fix_char_length (MY_MAX (max_char_length (), arg->max_char_length ()));
3082
- set_if_bigger (decimals, arg->decimals );
3083
- unsigned_flag= unsigned_flag && arg->unsigned_flag ;
3084
- }
3085
-
3086
-
3087
- void Item_func_case::agg_num_lengths (Item *arg)
3088
- {
3089
- uint len= my_decimal_length_to_precision (arg->max_length , arg->decimals ,
3090
- arg->unsigned_flag ) - arg->decimals ;
3091
- set_if_bigger (max_length, len);
3092
- set_if_bigger (decimals, arg->decimals );
3093
- unsigned_flag= unsigned_flag && arg->unsigned_flag ;
3094
- }
3095
-
3096
-
3097
3035
/* *
3098
3036
Check if (*place) and new_value points to different Items and call
3099
3037
THD::change_item_tree() if needed.
@@ -3155,18 +3093,7 @@ void Item_func_case::fix_length_and_dec()
3155
3093
}
3156
3094
else
3157
3095
{
3158
- collation.set_numeric ();
3159
- max_length=0 ;
3160
- decimals=0 ;
3161
- unsigned_flag= TRUE ;
3162
- for (uint i= 0 ; i < ncases; i+= 2 )
3163
- agg_num_lengths (args[i + 1 ]);
3164
- if (else_expr_num != -1 )
3165
- agg_num_lengths (args[else_expr_num]);
3166
- max_length= my_decimal_precision_to_length_no_truncation (max_length +
3167
- decimals,
3168
- decimals,
3169
- unsigned_flag);
3096
+ fix_attributes (agg, nagg);
3170
3097
}
3171
3098
3172
3099
/*
@@ -3468,23 +3395,25 @@ my_decimal *Item_func_coalesce::decimal_op(my_decimal *decimal_value)
3468
3395
}
3469
3396
3470
3397
3471
- void Item_func_coalesce::fix_length_and_dec ( )
3398
+ void Item_hybrid_func::fix_attributes (Item **items, uint nitems )
3472
3399
{
3473
- set_handler_by_field_type (agg_field_type (args, arg_count, true ));
3474
- switch (Item_func_coalesce::result_type ()) {
3400
+ switch (Item_hybrid_func::result_type ()) {
3475
3401
case STRING_RESULT:
3476
- if (count_string_result_length (Item_func_coalesce ::field_type (),
3477
- args, arg_count ))
3402
+ if (count_string_result_length (Item_hybrid_func ::field_type (),
3403
+ items, nitems ))
3478
3404
return ;
3479
3405
break ;
3480
3406
case DECIMAL_RESULT:
3481
- count_decimal_length ();
3407
+ collation.set_numeric ();
3408
+ count_decimal_length (items, nitems);
3482
3409
break ;
3483
3410
case REAL_RESULT:
3484
- count_real_length ();
3411
+ collation.set_numeric ();
3412
+ count_real_length (items, nitems);
3485
3413
break ;
3486
3414
case INT_RESULT:
3487
- count_only_length (args, arg_count);
3415
+ collation.set_numeric ();
3416
+ count_only_length (items, nitems);
3488
3417
decimals= 0 ;
3489
3418
break ;
3490
3419
case ROW_RESULT:
0 commit comments