summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/field.cc1
-rw-r--r--sql/sql_string.cc16
2 files changed, 11 insertions, 6 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 3069a1ef60b..abe856a8292 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -7974,7 +7974,6 @@ int Field_enum::store(const char *from,uint length,CHARSET_INFO *cs)
{
ASSERT_COLUMN_MARKED_FOR_WRITE;
int err= 0;
- uint32 not_used;
char buff[STRING_BUFFER_USUAL_SIZE];
String tmpstr(buff,sizeof(buff), &my_charset_bin);
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index b9a9ce92cd6..41725128415 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -241,11 +241,17 @@ bool String::needs_conversion_on_storage(uint32 arg_length,
{
uint32 offset;
return (needs_conversion(arg_length, cs_from, cs_to, &offset) ||
- (cs_from == &my_charset_bin && /* force conversion when storing a binary string */
- cs_to != &my_charset_bin && /* into a non-binary destination */
- ( /* and any of the following is true :*/
- cs_to->mbminlen != cs_to->mbmaxlen || /* it's a variable length encoding */
- cs_to->mbminlen > 2 || /* longer than 2 bytes : neither 1 byte nor ucs2 */
+ /* force conversion when storing a binary string */
+ (cs_from == &my_charset_bin &&
+ /* into a non-binary destination */
+ cs_to != &my_charset_bin &&
+ /* and any of the following is true :*/
+ (
+ /* it's a variable length encoding */
+ cs_to->mbminlen != cs_to->mbmaxlen ||
+ /* longer than 2 bytes : neither 1 byte nor ucs2 */
+ cs_to->mbminlen > 2 ||
+ /* and is not a multiple of the char byte size */
0 != (arg_length % cs_to->mbmaxlen)
)
)