• unknown's avatar
    Fixed BUG#13941: replace() string fuction behaves badly inside stored · a7f4882a
    unknown authored
                     procedure
      For some functions returning strings (like "replace" and "ifnull" - where
      val_str() is returning a pointer into one of the parameters) - we ended
      up with a dangling pointer after the new operator destroyed the reuse item
      in the eval function.
      A working, if not very elegant, solution is to simply copy the string in
      such cases.
    
    
    mysql-test/r/sp.result:
      New test case for BUG#13941.
    mysql-test/t/sp.test:
      New test case for BUG#13941.
    sql/sp_head.cc:
      Copy the string when evaluating some string functions (e.g. "replace" and "ifnull")
      to avoid using a dangling pointer.
    a7f4882a
sp.test 90.9 KB