diff options
author | unknown <ram@mysql.r18.ru> | 2003-01-01 15:59:35 +0400 |
---|---|---|
committer | unknown <ram@mysql.r18.ru> | 2003-01-01 15:59:35 +0400 |
commit | be551fd94370ef85aa9aa9cad36a890eee9c04b0 (patch) | |
tree | 874bc2d3ce49042c6ad87693c6a7531b320be311 | |
parent | cd248a8d636395a467f26550b55e0a184e86f0db (diff) | |
download | mariadb-git-be551fd94370ef85aa9aa9cad36a890eee9c04b0.tar.gz |
Fix for QUOTE() function.
-rw-r--r-- | mysql-test/r/func_str.result | 3 | ||||
-rw-r--r-- | mysql-test/t/func_str.test | 2 | ||||
-rw-r--r-- | sql/item_strfunc.cc | 2 |
3 files changed, 5 insertions, 2 deletions
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index d0358aad6ba..429574575f1 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -170,6 +170,9 @@ quote(concat('abc\'', '\\cba')) select quote(1/0), quote('\0\Z'); quote(1/0) quote('\0\Z') NULL '\0\Z' +select length(quote(concat(char(0), "test"))); +length(quote(concat(char(0), "test"))) +8 select reverse(""); reverse("") diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index d355cc95317..97b771e7363 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -69,7 +69,7 @@ select decode(encode("abcdef","monty"),"monty")="abcdef"; select quote('\'\"\\test'); select quote(concat('abc\'', '\\cba')); select quote(1/0), quote('\0\Z'); - +select length(quote(concat(char(0), "test"))); # # Wrong usage of functions # diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index ce362d6b972..0baa479a601 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2398,7 +2398,7 @@ String *Item_func_quote::val_str(String *str) */ to= (char*) str->ptr() + new_length - 1; *to--= '\''; - for (start= (char*) arg->ptr() ; end-- != start; to--) + for (start= (char*) arg->ptr(),end= start + arg_length; end-- != start; to--) { /* We can't use the bitmask here as we want to replace \O and ^Z with 0 |