Commit graph

7 commits

Author SHA1 Message Date
unknown
1991a87d83 Fixed bug#16716: subselect in concat() may lead to a wrong result.
The Item_func_concat::val_str() function tries to make as less re-allocations
as possible. This results in appending strings returned by 2nd and next
arguments to the string returned by 1st argument if the buffer for the first
argument has enough free space. A constant subselect is evaluated only once 
and its result is stored in an Item_cache_str. In the case when the first
argument of the concat() function is such a subselect Item_cache_str returns
the stored value and Item_func_concat::val_str() append values of other
arguments to it. But for the next row the value in the Item_cache_str isn't
restored because the subselect is a constant one and it isn't evaluated second
time. This results in appending string values of 2nd and next arguments to the 
result of the previous Item_func_concat::val_str() call.

The Item_func_concat::val_str() function now checks whether the first argument 
is a constant one and if so it doesn't append values of 2nd and next arguments
to the string value returned by it.


mysql-test/t/func_concat.test:
  Added test case for bug#16716: subselect in concat() may lead to a wrong result.
mysql-test/r/func_concat.result:
  Added test case for bug#16716: subselect in concat() may lead to a wrong result.
sql/item_strfunc.cc:
  Fixed bug#16716: subselect in concat() may lead to a wrong result.
  The Item_func_concat::val_str() function now checks whether the first argument 
  is a constant one and if so it doesn't append values of 2nd and next arguments
  to the string value returned by it.
2006-05-26 01:24:14 +04:00
unknown
c1f1732f37 Fix func_concat.result: allow -0.00 to be converted to string both with and without leading minus 2004-12-30 14:56:31 +03:00
unknown
665f6b6875 incorrect result fixed 2004-12-23 17:32:29 +01:00
unknown
f7193b9254 Fix for BUG#6825: When calculating Item_func_neg::max_length, add 1 for '-'.
For numeric constants we only need to add, since the parser doesn't produce 
negative numbers. 
For strings we only add (we actually could substract 1 if given string is a constant 
and it has '-number' form but we're not doing that because 
 * we set max_length bigger then necessary in other cases as well.  
 * the current solution is simpler and safer (bigger max_length is better then cutting out)


mysql-test/r/func_concat.result:
  Test for BUG#6825
mysql-test/r/metadata.result:
  Ajusted results according to fix of bug BUG#6825:length(-1) = 2 , not 1
mysql-test/t/func_concat.test:
  Test for BUG#6825
2004-12-17 12:14:45 +03:00
unknown
b87892265c A fix (bug #5540: CONCAT function and 'double' type). 2004-09-15 15:13:17 +05:00
unknown
a34e76c66a Fixes for gcc 3.1
Fixed bug in new code for regexp LIKE NULL


BUILD/SETUP.sh:
  Fixes for gcc 3.1
BUILD/compile-solaris-sparc-debug:
  Fixes for gcc 3.1
BUILD/compile-solaris-sparc-purify:
  Fixes for gcc 3.1
BUILD/compile-solaris-sparc:
  Fixes for gcc 3.1
Docs/manual.texi:
  Fixed typo
include/violite.h:
  Fixes for gcc 3.1
mysql-test/r/func_concat.result:
  Updated test results
sql/item_cmpfunc.cc:
  Fixed bug in new code for regexp LIKE NULL
2002-05-21 20:35:58 +03:00
unknown
c2504d86b3 Fix bug in CONCAT_WS()
Update of glibc patch from MySQL 4.0


Docs/glibc-2.2.5.patch:
  Update of patch from MySQL 4.0
Docs/manual.texi:
  ChangeLog
sql/item_strfunc.cc:
  Fix bug in CONCAT_WS()
sql/share/italian/errmsg.txt:
  Update of new error messages
2002-05-17 10:50:57 +03:00