summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <jani@ua141d10.elisa.omakaista.fi>2004-11-12 20:38:58 +0200
committerunknown <jani@ua141d10.elisa.omakaista.fi>2004-11-12 20:38:58 +0200
commit75a4c71b67508c7b1390477a4a3a4a4aba120bbb (patch)
treed351998dbbb6448d1c9c837ff4fa33e2687cce1c
parent20d88eb76f4e5fea1acdb68b6d2ad86b59ba61f9 (diff)
parentc7b66f9ddefb95050c21a9938578a0f56d9dd0d0 (diff)
downloadmariadb-git-75a4c71b67508c7b1390477a4a3a4a4aba120bbb.tar.gz
Merge with 4.0
-rw-r--r--mysql-test/r/func_str.result5
-rw-r--r--mysql-test/t/func_str.test6
-rw-r--r--mysys/default.c9
-rw-r--r--sql/item_strfunc.cc14
4 files changed, 25 insertions, 9 deletions
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index 4a3a70274fd..8d49d55be39 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -201,6 +201,9 @@ hex(unhex("1")) hex(unhex("12")) hex(unhex("123")) hex(unhex("1234")) hex(unhex(
select length(unhex(md5("abrakadabra")));
length(unhex(md5("abrakadabra")))
16
+select concat('a', quote(NULL));
+concat('a', quote(NULL))
+aNULL
select reverse("");
reverse("")
@@ -312,7 +315,7 @@ insert into t1 values ('one'),(NULL),('two'),('four');
select a, quote(a), isnull(quote(a)), quote(a) is null, ifnull(quote(a), 'n') from t1;
a quote(a) isnull(quote(a)) quote(a) is null ifnull(quote(a), 'n')
one 'one' 0 0 'one'
-NULL NULL 1 1 n
+NULL NULL 0 0 NULL
two 'two' 0 0 'two'
four 'four' 0 0 'four'
drop table t1;
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index 3eab694ee05..d5a3e80c417 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -83,6 +83,12 @@ select hex(unhex("1")), hex(unhex("12")), hex(unhex("123")), hex(unhex("1234")),
select length(unhex(md5("abrakadabra")));
#
+# Bug #6564: QUOTE(NULL
+#
+
+select concat('a', quote(NULL));
+
+#
# Wrong usage of functions
#
diff --git a/mysys/default.c b/mysys/default.c
index efeb1c2ce19..ea23bbb6693 100644
--- a/mysys/default.c
+++ b/mysys/default.c
@@ -120,7 +120,7 @@ int load_defaults(const char *conf_file, const char **groups,
uint args_used=0;
int error= 0;
MEM_ROOT alloc;
- char *ptr, **res, **ext;
+ char *ptr, **res;
DBUG_ENTER("load_defaults");
@@ -182,10 +182,9 @@ int load_defaults(const char *conf_file, const char **groups,
}
else if (dirname_length(conf_file))
{
- for (ext= (char**) f_extensions; *ext; *ext++)
- if ((error= search_default_file(&args, &alloc, NullS, conf_file,
- &group)) < 0)
- goto err;
+ if ((error= search_default_file(&args, &alloc, NullS, conf_file,
+ &group)) < 0)
+ goto err;
}
else
{
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 81fff899ec7..3f659964a6c 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2562,9 +2562,12 @@ String* Item_func_inet_ntoa::val_str(String* str)
This function is very useful when you want to generate SQL statements
- RETURN VALUES
+ NOTE
+ QUOTE(NULL) returns the string 'NULL' (4 letters, without quotes).
+
+ RETURN VALUES
str Quoted string
- NULL Argument to QUOTE() was NULL or out of memory.
+ NULL Out of memory.
*/
#define get_esc_bit(mask, num) (1 & (*((mask) + ((num) >> 3))) >> ((num) & 7))
@@ -2589,7 +2592,12 @@ String *Item_func_quote::val_str(String *str)
String *arg= args[0]->val_str(str);
uint arg_length, new_length;
if (!arg) // Null argument
- goto null;
+ {
+ str->copy("NULL", 4); // Return the string 'NULL'
+ null_value= 0;
+ return str;
+ }
+
arg_length= arg->length();
new_length= arg_length+2; /* for beginning and ending ' signs */