diff options
author | unknown <hf@deer.mysql.r18.ru> | 2003-03-30 18:36:01 +0500 |
---|---|---|
committer | unknown <hf@deer.mysql.r18.ru> | 2003-03-30 18:36:01 +0500 |
commit | 9f86ed8fc4bac15999390bae530971984cf4dbc9 (patch) | |
tree | a21c2b605e1720fc0506df39a9d292c62658b491 /sql/item_strfunc.cc | |
parent | aba362c3c087914f601ee7fd03808f167ca9edc7 (diff) | |
download | mariadb-git-9f86ed8fc4bac15999390bae530971984cf4dbc9.tar.gz |
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
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r-- | sql/item_strfunc.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index bff8bc7e3f4..0f1ce8adba6 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -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) { |