summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorbar@mysql.com <>2005-03-16 17:44:29 +0400
committerbar@mysql.com <>2005-03-16 17:44:29 +0400
commita7b877df780ee6ce1146ee33826e9a0b29ee0ab0 (patch)
tree8ec389c98bb914b6fa3f8ace1883c627bc4cdc6a /sql
parent41487d0b4e9647e074c5f946caf219f4b837f8e7 (diff)
downloadmariadb-git-a7b877df780ee6ce1146ee33826e9a0b29ee0ab0.tar.gz
Bugs#9129: CHARSET(), COLLATION(), COERCIBILITY()
not always correct for NULL values. Now they always result a non NULL value even the argument is NULL. It is more usefull for debugging purposes.
Diffstat (limited to 'sql')
-rw-r--r--sql/item_func.cc5
-rw-r--r--sql/item_strfunc.cc15
2 files changed, 7 insertions, 13 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 96250522c4a..ade394f90d3 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1346,11 +1346,6 @@ longlong Item_func_char_length::val_int()
longlong Item_func_coercibility::val_int()
{
DBUG_ASSERT(fixed == 1);
- if (args[0]->null_value)
- {
- null_value= 1;
- return 0;
- }
null_value= 0;
return (longlong) args[0]->collation.derivation;
}
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index b4f75859469..8b9351d95a5 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2290,12 +2290,11 @@ bool Item_func_set_collation::eq(const Item *item, bool binary_cmp) const
String *Item_func_charset::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
- String *res = args[0]->val_str(str);
uint dummy_errors;
- if ((null_value=(args[0]->null_value || !res->charset())))
- return 0;
- str->copy(res->charset()->csname,strlen(res->charset()->csname),
+ CHARSET_INFO *cs= args[0]->collation.collation;
+ null_value= 0;
+ str->copy(cs->csname, strlen(cs->csname),
&my_charset_latin1, collation.collation, &dummy_errors);
return str;
}
@@ -2303,12 +2302,11 @@ String *Item_func_charset::val_str(String *str)
String *Item_func_collation::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
- String *res = args[0]->val_str(str);
uint dummy_errors;
+ CHARSET_INFO *cs= args[0]->collation.collation;
- if ((null_value=(args[0]->null_value || !res->charset())))
- return 0;
- str->copy(res->charset()->name,strlen(res->charset()->name),
+ null_value= 0;
+ str->copy(cs->name, strlen(cs->name),
&my_charset_latin1, collation.collation, &dummy_errors);
return str;
}
@@ -2472,6 +2470,7 @@ String* Item_func_export_set::val_str(String* str)
uint num_set_values = 64;
ulonglong mask = 0x1;
str->length(0);
+ str->set_charset(collation.collation);
/* Check if some argument is a NULL value */
if (args[0]->null_value || args[1]->null_value || args[2]->null_value)