• unknown's avatar
    Fix for bug #8068 "TIMEDIFF with first negative argument gives wrong · bdd82f3a
    unknown authored
    result" (and similar bug in ADDTIME/SUBTIME).
    
    Both Item_func_add_time/Item_func_timediff::val_str() now use
    calc_time_diff() function which was backported from 5.0 (and which
    was was fixed to properly handle microseconds part of its second 
    argument). Also now we correctly set sign of result in case when
    first argument is negative and second is positive.  
    
    
    mysql-test/r/func_sapdb.result:
      Added test for bug #8068 "TIMEDIFF with first negative argument gives wrong 
      result".
    mysql-test/t/func_sapdb.test:
      Added test for bug #8068 "TIMEDIFF with first negative argument gives wrong 
      result".
    sql/item_timefunc.cc:
      - Backported calc_time_diff() function from 5.0 tree. Changed it to
        accept time value as its second argument when its first argument
        is datetime value. Fixed wrong handling of microsecond part of
        second argument.
      - Item_func_add_time::val_str()/Item_func_timediff::val_str()
        Removed similar pieces of code calculating difference 
        between two datetime values (or their sum) in microseconds.
        Now we use calc_time_diff() function instead. 
        Also now we correctly set sign of result in case when first 
        argument is negative and second is positive.
    bdd82f3a
item_timefunc.cc 71.9 KB