Bit type: code clean-up.
sql/field.h: Field_bit_as_char::size_of() added - we use it in the ::new_key_field(). sql/sql_table.cc: We have to set pack_flag for bit fields in the mysql_prepare_table() as we use it in the create_length_to_internal_length().
This commit is contained in:
parent
87e742c187
commit
923b76f8d1
@ -1321,6 +1321,7 @@ public:
|
||||
enum utype unireg_check_arg, const char *field_name_arg,
|
||||
struct st_table *table_arg);
|
||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
|
||||
uint size_of() const { return sizeof(*this); }
|
||||
int store(const char *to, uint length, CHARSET_INFO *charset);
|
||||
int store(double nr) { return Field_bit::store(nr); }
|
||||
int store(longlong nr) { return Field_bit::store(nr); }
|
||||
|
@ -563,9 +563,9 @@ int prepare_create_field(create_field *sql_field,
|
||||
sql_field->pack_flag=f_settype((uint) sql_field->sql_type);
|
||||
break;
|
||||
case FIELD_TYPE_BIT:
|
||||
sql_field->pack_flag= f_bit_as_char(sql_field->pack_flag) ?
|
||||
FIELDFLAG_NUMBER | FIELDFLAG_TREAT_BIT_AS_CHAR :
|
||||
FIELDFLAG_NUMBER;
|
||||
/*
|
||||
We have sql_field->pack_flag already set here, see mysql_prepare_table().
|
||||
*/
|
||||
break;
|
||||
case FIELD_TYPE_NEWDECIMAL:
|
||||
sql_field->pack_flag=(FIELDFLAG_NUMBER |
|
||||
@ -773,6 +773,7 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
||||
|
||||
if (sql_field->sql_type == FIELD_TYPE_BIT)
|
||||
{
|
||||
sql_field->pack_flag= FIELDFLAG_NUMBER;
|
||||
if (file->table_flags() & HA_CAN_BIT_FIELD)
|
||||
total_uneven_bit_length+= sql_field->length & 7;
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user