Commit 923b76f8 authored by unknown's avatar unknown
Browse files

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().
parent 87e742c1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1321,6 +1321,7 @@ class Field_bit_as_char: public Field_bit {
                    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); }
+4 −3
Original line number Diff line number Diff line
@@ -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