Commit fe0b0098 authored by jani@ua141d10.elisa.omakaista.fi's avatar jani@ua141d10.elisa.omakaista.fi

Merge with 4.0

parents 4ffbe566 76b8c874
...@@ -201,6 +201,9 @@ hex(unhex("1")) hex(unhex("12")) hex(unhex("123")) hex(unhex("1234")) hex(unhex( ...@@ -201,6 +201,9 @@ hex(unhex("1")) hex(unhex("12")) hex(unhex("123")) hex(unhex("1234")) hex(unhex(
select length(unhex(md5("abrakadabra"))); select length(unhex(md5("abrakadabra")));
length(unhex(md5("abrakadabra"))) length(unhex(md5("abrakadabra")))
16 16
select concat('a', quote(NULL));
concat('a', quote(NULL))
aNULL
select reverse(""); select reverse("");
reverse("") reverse("")
...@@ -312,7 +315,7 @@ insert into t1 values ('one'),(NULL),('two'),('four'); ...@@ -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; 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') a quote(a) isnull(quote(a)) quote(a) is null ifnull(quote(a), 'n')
one 'one' 0 0 'one' one 'one' 0 0 'one'
NULL NULL 1 1 n NULL NULL 0 0 NULL
two 'two' 0 0 'two' two 'two' 0 0 'two'
four 'four' 0 0 'four' four 'four' 0 0 'four'
drop table t1; drop table t1;
......
...@@ -82,6 +82,12 @@ select unhex(hex("foobar")), hex(unhex("1234567890ABCDEF")), unhex("345678"), un ...@@ -82,6 +82,12 @@ select unhex(hex("foobar")), hex(unhex("1234567890ABCDEF")), unhex("345678"), un
select hex(unhex("1")), hex(unhex("12")), hex(unhex("123")), hex(unhex("1234")), hex(unhex("12345")), hex(unhex("123456")); select hex(unhex("1")), hex(unhex("12")), hex(unhex("123")), hex(unhex("1234")), hex(unhex("12345")), hex(unhex("123456"));
select length(unhex(md5("abrakadabra"))); select length(unhex(md5("abrakadabra")));
#
# Bug #6564: QUOTE(NULL
#
select concat('a', quote(NULL));
# #
# Wrong usage of functions # Wrong usage of functions
# #
......
...@@ -120,7 +120,7 @@ int load_defaults(const char *conf_file, const char **groups, ...@@ -120,7 +120,7 @@ int load_defaults(const char *conf_file, const char **groups,
uint args_used=0; uint args_used=0;
int error= 0; int error= 0;
MEM_ROOT alloc; MEM_ROOT alloc;
char *ptr, **res, **ext; char *ptr, **res;
DBUG_ENTER("load_defaults"); DBUG_ENTER("load_defaults");
...@@ -182,7 +182,6 @@ int load_defaults(const char *conf_file, const char **groups, ...@@ -182,7 +182,6 @@ int load_defaults(const char *conf_file, const char **groups,
} }
else if (dirname_length(conf_file)) else if (dirname_length(conf_file))
{ {
for (ext= (char**) f_extensions; *ext; *ext++)
if ((error= search_default_file(&args, &alloc, NullS, conf_file, if ((error= search_default_file(&args, &alloc, NullS, conf_file,
&group)) < 0) &group)) < 0)
goto err; goto err;
......
...@@ -2562,9 +2562,12 @@ String* Item_func_inet_ntoa::val_str(String* str) ...@@ -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 This function is very useful when you want to generate SQL statements
NOTE
QUOTE(NULL) returns the string 'NULL' (4 letters, without quotes).
RETURN VALUES RETURN VALUES
str Quoted string 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)) #define get_esc_bit(mask, num) (1 & (*((mask) + ((num) >> 3))) >> ((num) & 7))
...@@ -2589,7 +2592,12 @@ String *Item_func_quote::val_str(String *str) ...@@ -2589,7 +2592,12 @@ String *Item_func_quote::val_str(String *str)
String *arg= args[0]->val_str(str); String *arg= args[0]->val_str(str);
uint arg_length, new_length; uint arg_length, new_length;
if (!arg) // Null argument if (!arg) // Null argument
goto null; {
str->copy("NULL", 4); // Return the string 'NULL'
null_value= 0;
return str;
}
arg_length= arg->length(); arg_length= arg->length();
new_length= arg_length+2; /* for beginning and ending ' signs */ new_length= arg_length+2; /* for beginning and ending ' signs */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment