summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/sql_string.cc15
1 files changed, 5 insertions, 10 deletions
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index 225076bc555..42e700b27aa 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -240,17 +240,12 @@ bool String::needs_conversion(const char *str, uint32 arg_length,
CHARSET_INFO *from_cs,
CHARSET_INFO *to_cs)
{
- if (to_cs == &my_charset_bin)
+ if ((to_cs == &my_charset_bin) ||
+ (to_cs == from_cs) ||
+ my_charset_same(from_cs, to_cs) ||
+ ((from_cs == &my_charset_bin) && (!(arg_length % to_cs->mbminlen))))
return FALSE;
- if (to_cs == from_cs)
- return FALSE;
- if (my_charset_same(from_cs, to_cs))
- return FALSE;
- if ((from_cs == &my_charset_bin))
- {
- if (!(arg_length % to_cs->mbminlen))
- return FALSE;
- }
+
return TRUE;
}