Commit 936c8498 authored by unknown's avatar unknown
Browse files

A fix (bug #10179: error in default value setting).


include/my_handler.h:
  A fix (bug #10179: error in default value setting).
  Proper masks added: we should not touch extra bits.
sql/key.cc:
  A fix (bug #10179: error in default value setting).
  Unnecessary code removed.
sql/unireg.cc:
  A fix (bug #10179: error in default value setting).
  1. we should take into account uneven bits (for bit fields) stored among NULL bits.
  2. changed code which sets NULL bits for fields.
  3. changed code which sets unused bits after NULL bits.
  4. unused variables removed.
BitKeeper/etc/logging_ok:
  Logging to logging@openlogging.org accepted
parent a406c034
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -217,6 +217,7 @@ ram@deer.(none)
ram@gw.mysql.r18.ru
ram@gw.udmsearch.izhnet.ru
ram@mysql.r18.ru
ram@ram-book.(none)
ram@ram.(none)
ramil@mysql.com
ranger@regul.home.lan
+3 −2
Original line number Diff line number Diff line
@@ -72,10 +72,11 @@ typedef struct st_HA_KEYSEG /* Key-portion */

#define set_rec_bits(bits, bit_ptr, bit_ofs, bit_len) \
{ \
  (bit_ptr)[0]= ((bit_ptr)[0] & ((1 << (bit_ofs)) - 1)) | \
  (bit_ptr)[0]= ((bit_ptr)[0] & ~(((1 << (bit_len)) - 1) << (bit_ofs))) | \
                ((bits) << (bit_ofs)); \
  if ((bit_ofs) + (bit_len) > 8) \
    (bit_ptr)[1]= ((bits) & ((1 << (bit_len)) - 1)) >> (8 - (bit_ofs)); \
    (bit_ptr)[1]= ((bit_ptr)[1] & ~((1 << ((bit_len) - 8 + (bit_ofs))) - 1)) | \
                  ((bits) >> (8 - (bit_ofs))); \
}

#define clr_rec_bits(bit_ptr, bit_ofs, bit_len) \
+21 −0
Original line number Diff line number Diff line
@@ -437,3 +437,24 @@ a+0 b+0
2303	2
12345	4
drop table t1, t2;
create table t1 (a int, b time, c tinyint, d bool, e char(10), f bit(1), 
g bit(1) NOT NULL default 1, h char(1) default 'a');
insert into t1 set a=1;
select hex(g), h from t1;
hex(g)	h
1	a
drop table t1;
create table t1 (a int, b time, c tinyint, d bool, e char(10), f bit(1),
g bit(1) NOT NULL default 1);
insert into t1 set a=1;
select hex(g) from t1;
hex(g)
1
drop table t1;
create table t1 (a int, b time, c tinyint, d bool, e char(10), f bit(1), 
h char(1) default 'a') engine=myisam;
insert into t1 set a=1;
select h from t1;
h
a
drop table t1;
+22 −0
Original line number Diff line number Diff line
@@ -140,3 +140,25 @@ drop table t1;
create table t1 select * from t2;
select a+0, b+0 from t1;
drop table t1, t2;

#
# Bug #10179: problem with NULLs and default values
#

create table t1 (a int, b time, c tinyint, d bool, e char(10), f bit(1), 
  g bit(1) NOT NULL default 1, h char(1) default 'a');
insert into t1 set a=1;
select hex(g), h from t1;
drop table t1;

create table t1 (a int, b time, c tinyint, d bool, e char(10), f bit(1),
  g bit(1) NOT NULL default 1);
insert into t1 set a=1;
select hex(g) from t1;
drop table t1;

create table t1 (a int, b time, c tinyint, d bool, e char(10), f bit(1), 
  h char(1) default 'a') engine=myisam;
insert into t1 set a=1;
select h from t1;
drop table t1;
+0 −6
Original line number Diff line number Diff line
@@ -197,12 +197,6 @@ void key_restore(byte *to_record, byte *from_key, KEY *key_info,
                     (key_part->null_bit == 128),
                     field->bit_ofs, field->bit_len);
      }
      else
      {
        clr_rec_bits(to_record + key_part->null_offset +
                     (key_part->null_bit == 128),
                     field->bit_ofs, field->bit_len);
      }
    }
    if (key_part->key_part_flag & HA_BLOB_PART)
    {
Loading