• Alexander Barkov's avatar
    MDEV-11337 Split Item::save_in_field() into virtual methods in Type_handler · cb16d753
    Alexander Barkov authored
    Also fixes:
    MDEV-11331 Wrong result for INSERT INTO t1 (datetime_field) VALUES (hybrid_function_of_TIME_data_type)
    MDEV-11333 Expect "Impossible where condition" for WHERE timestamp_field>=DATE_ADD(TIMESTAMP'9999-01-01 00:00:00',INTERVAL 1000 YEAR)
    
    This patch does the following:
    1. Splits the function Item::save_in_field() into pieces:
    - Item::save_str_in_field()
    - Item::save_real_in_field()
    - Item::save_decimal_in_field()
    - Item::save_int_in_field()
    
    2. Adds the missing "no_conversion" parameters to
       Item::save_time_in_field() and Item::save_date_in_field(),
       so this parameter is now correctly passed to
       set_field_to_null_with_conversions().
       This fixes the problem reported in 11333.
    
    3. Introduces a new virtual method Type_handler::Item_save_in_field()
       and uses the methods Item::save_xxx_in_field() from the implementations
       of Type_handler_xxx::Item_save_in_field().
    
    These changes additionally fix the problem reported in MDEV-11331,
    as the old code erroneously handled expressions like
    COALESE(datetime-expression) through the STRING_RESULT branch of
    Item::save_in_field() and therefore they looked like string type expressions
    for the target fields. Now such expressions are correctly handled by
    Item::save_date_in_field().
    cb16d753
item.h 184 KB