mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 10:14:19 +01:00
truncating REPLACE result bug fix
mysql-test/r/func_str.result: test result for truncating REPLACE result mysql-test/t/func_str.test: test with long arguments for REPLACE sql/item_strfunc.cc: fix for counting REPLACE result length
This commit is contained in:
parent
420686dd8e
commit
5380411728
3 changed files with 6 additions and 2 deletions
|
@ -225,6 +225,9 @@ CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugstatus,submitter), '"'
|
|||
SELECT CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified,bugstatus,submitter) FROM t1;
|
||||
CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified,bugstatus,submitter)
|
||||
Link";"1";"1";"1";"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";"2001-02-28 08:40:16";"20010228084016";"0";"4
|
||||
SELECT bugdesc, REPLACE(bugdesc, 'xxxxxxxxxxxxxxxxxxxx', 'bbbbbbbbbbbbbbbbbbbb') from t1 group by bugdesc;
|
||||
bugdesc REPLACE(bugdesc, 'xxxxxxxxxxxxxxxxxxxx', 'bbbbbbbbbbbbbbbbbbbb')
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (id int(11) NOT NULL auto_increment, tmp text NOT NULL, KEY id (id)) TYPE=MyISAM;
|
||||
INSERT INTO t1 VALUES (1, 'a545f661efdd1fb66fdee3aab79945bf');
|
||||
|
|
|
@ -114,6 +114,7 @@ INSERT INTO t1 VALUES (1,'Link',1,1,1,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
|||
SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified,bugstatus,submitter), '"') FROM t1;
|
||||
SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugstatus,submitter), '"') FROM t1;
|
||||
SELECT CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified,bugstatus,submitter) FROM t1;
|
||||
SELECT bugdesc, REPLACE(bugdesc, 'xxxxxxxxxxxxxxxxxxxx', 'bbbbbbbbbbbbbbbbbbbb') from t1 group by bugdesc;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
|
|
|
@ -780,8 +780,8 @@ void Item_func_replace::fix_length_and_dec()
|
|||
int diff=(int) (args[2]->max_length - args[1]->max_length);
|
||||
if (diff > 0 && args[1]->max_length)
|
||||
{ // Calculate of maxreplaces
|
||||
max_length= max_length/args[1]->max_length;
|
||||
max_length= (max_length+1)*(uint) diff;
|
||||
uint max_substrs= max_length/args[1]->max_length;
|
||||
max_length+= max_substrs * (uint)diff;
|
||||
}
|
||||
if (max_length > MAX_BLOB_WIDTH)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue