• Gleb Shchepa's avatar
    Bug #40625: Concat fails on DOUBLE values in a Stored · 99a0ace4
    Gleb Shchepa authored
                Procedure, while DECIMAL works
    
    Selecting of the CONCAT(...<SP variable>...) result into
    a user variable may return wrong data.
    
    
    Item_func_concat::val_str contains a number of memory
    allocation-saving tricks. One of them concatenates
    strings inplace inserting the value of one string
    at the beginning of the other string. However,
    this trick didn't care about strings those points
    to the same data buffer: this is possible when
    a CONCAT() parameter is a stored procedure variable -
    Item_sp_variable::val_str() uses the intermediate
    Item_sp_variable::str_value field, where it may
    store a reference to an external buffer.
    
    
    The Item_func_concat::val_str function has been
    modified to take into account val_str functions
    (such as Item_sp_variable::val_str) that return
    a pointer to an internal Item member variable
    that may reference to a buffer provided.
    99a0ace4
func_concat.test 3.67 KB