Commit 3767fb01 authored by unknown's avatar unknown

Bit type: code cleanup.


sql/field.cc:
  We have to use memcmp() here to get determinate results.
sql/sql_table.cc:
  Should set pack_flag here instead of doing |=
parent 79c62d31
...@@ -7879,7 +7879,7 @@ int Field_bit::key_cmp(const byte *str, uint length) ...@@ -7879,7 +7879,7 @@ int Field_bit::key_cmp(const byte *str, uint length)
str++; str++;
length--; length--;
} }
return bcmp(ptr, str, length); return memcmp(ptr, str, length);
} }
...@@ -7893,7 +7893,7 @@ int Field_bit::cmp_offset(uint row_offset) ...@@ -7893,7 +7893,7 @@ int Field_bit::cmp_offset(uint row_offset)
if ((flag= (int) (bits_a - bits_b))) if ((flag= (int) (bits_a - bits_b)))
return flag; return flag;
} }
return bcmp(ptr, ptr + row_offset, field_length); return memcmp(ptr, ptr + row_offset, field_length);
} }
......
...@@ -563,7 +563,9 @@ int prepare_create_field(create_field *sql_field, ...@@ -563,7 +563,9 @@ int prepare_create_field(create_field *sql_field,
sql_field->pack_flag=f_settype((uint) sql_field->sql_type); sql_field->pack_flag=f_settype((uint) sql_field->sql_type);
break; break;
case FIELD_TYPE_BIT: case FIELD_TYPE_BIT:
sql_field->pack_flag|= FIELDFLAG_NUMBER; sql_field->pack_flag= f_bit_as_char(sql_field->pack_flag) ?
FIELDFLAG_NUMBER | FIELDFLAG_TREAT_BIT_AS_CHAR :
FIELDFLAG_NUMBER;
break; break;
case FIELD_TYPE_NEWDECIMAL: case FIELD_TYPE_NEWDECIMAL:
sql_field->pack_flag=(FIELDFLAG_NUMBER | sql_field->pack_flag=(FIELDFLAG_NUMBER |
......
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