Commit 06904103 authored by unknown's avatar unknown
Browse files

Merge with global tree

Fixed some found bugs in BIT fields
Added more test cases for BIT fields and varchar


include/my_base.h:
  Merge
  Added HA_BIT_PART for easier test in key.cc
innobase/os/os0proc.c:
  Fixed typo
myisam/mi_dbug.c:
  Add printing of BIT types when debugging
mysql-test/r/show_check.result:
  Set 'Avg_row_length' to # as this value is different between 32 and 64 bit machines
mysql-test/r/type_bit.result:
  More tests
mysql-test/r/type_varchar.result:
  More tests
mysql-test/t/show_check.test:
  Set 'Avg_row_length' to # as this value is different between 32 and 64 bit machines
mysql-test/t/type_bit.test:
  More tests
mysql-test/t/type_varchar.test:
  More tests
sql/field.cc:
  Added Field::val_int_as_str() to get better logging of bit fields
  Merged new_key_field with move_field() to fix some problems with bit fields
  Fixed some bugs with bit fields
sql/field.h:
  Added Field::val_int_as_str() to get better logging of bit fields
  Merged new_key_field with move_field() to fix some problems with bit fields
  Fixed some bugs with bit fields
sql/ha_myisam.cc:
  Fixed problem with unintialized memory (not critical)
sql/key.cc:
  Fix so that 'key_cmp_if_same' works with bit fields.
sql/opt_range.cc:
  Move declarations first in function
  Nice printing of bit fields in debug log
sql/sql_prepare.cc:
  Fixed old merge error (not critical)
sql/sql_select.cc:
  Use new interface to new_key_field
sql/sql_select.h:
  Use new interface to new_key_fields()
  This fixes a bug with BIT fields where the upper bit of the data was not stored in the key buffer
sql/structs.h:
  Extend key_part_flag to be able to add HA_BIT_PART to it
sql/table.cc:
  Mark BIT key parts with HA_BIT_PART to make test in key.cc simpler
parent 3fa699ef
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -187,7 +187,7 @@ enum ha_base_keytype {
  /* Varchar (0-65535 bytes) with length packed with 2 bytes */
  HA_KEYTYPE_VARTEXT2=17,		/* Key is sorted as letters */
  HA_KEYTYPE_VARBINARY2=18,		/* Key is sorted as unsigned chars */
  HA_KEYTYPE_BIT=18
  HA_KEYTYPE_BIT=19
};

#define HA_MAX_KEYTYPE	31		/* Must be log2-1 */
@@ -237,6 +237,7 @@ enum ha_base_keytype {
  Only needed for internal temporary tables.
*/
#define HA_END_SPACE_ARE_EQUAL	 512
#define HA_BIT_PART		1024

	/* optionbits for database */
#define HA_OPTION_PACK_RECORD		1
+1 −1
Original line number Diff line number Diff line
@@ -565,7 +565,7 @@ os_mem_alloc_large(
  if (ptr) {
    if (set_to_zero) {
#ifdef UNIV_SET_MEM_TO_ZERO
      memset(ret, '\0', size);
      memset(ptr, '\0', size);
#endif
    }

+10 −0
Original line number Diff line number Diff line
@@ -131,6 +131,16 @@ void _mi_print_key(FILE *stream, register HA_KEYSEG *keyseg,
      key=end;
      break;
    }
    case HA_KEYTYPE_BIT:
    {
      uint i;
      fputs("0x",stream);
      for (i=0 ; i < keyseg->length ; i++)
        fprintf(stream, "%02x", (uint) *key++);
      key= end;
      break;
    }

#endif
    case HA_KEYTYPE_VARTEXT1:                   /* VARCHAR and TEXT */
    case HA_KEYTYPE_VARTEXT2:                   /* VARCHAR and TEXT */
+21 −21
Original line number Diff line number Diff line
@@ -314,57 +314,57 @@ insert into t2 values (1),(2);
insert into t3 values (1,1),(2,2);
show table status;
Name	Engine	Version	Row_format	Rows	Avg_row_length	Data_length	Max_data_length	Index_length	Data_free	Auto_increment	Create_time	Update_time	Check_time	Collation	Checksum	Create_options	Comment
t1	HEAP	9	Fixed	2	5	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t2	HEAP	9	Fixed	2	5	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t3	HEAP	9	Fixed	2	9	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t1	HEAP	9	Fixed	2	#	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t2	HEAP	9	Fixed	2	#	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t3	HEAP	9	Fixed	2	#	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
insert into t1 values (3),(4);
insert into t2 values (3),(4);
insert into t3 values (3,3),(4,4);
show table status;
Name	Engine	Version	Row_format	Rows	Avg_row_length	Data_length	Max_data_length	Index_length	Data_free	Auto_increment	Create_time	Update_time	Check_time	Collation	Checksum	Create_options	Comment
t1	HEAP	9	Fixed	4	5	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t2	HEAP	9	Fixed	4	5	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t3	HEAP	9	Fixed	4	9	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t1	HEAP	9	Fixed	4	#	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t2	HEAP	9	Fixed	4	#	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t3	HEAP	9	Fixed	4	#	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
insert into t1 values (5);
insert into t2 values (5);
insert into t3 values (5,5);
show table status;
Name	Engine	Version	Row_format	Rows	Avg_row_length	Data_length	Max_data_length	Index_length	Data_free	Auto_increment	Create_time	Update_time	Check_time	Collation	Checksum	Create_options	Comment
t1	HEAP	9	Fixed	5	5	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t2	HEAP	9	Fixed	5	5	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t3	HEAP	9	Fixed	5	9	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t1	HEAP	9	Fixed	5	#	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t2	HEAP	9	Fixed	5	#	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t3	HEAP	9	Fixed	5	#	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
delete from t1 where a=3;
delete from t2 where b=3;
delete from t3 where a=3;
show table status;
Name	Engine	Version	Row_format	Rows	Avg_row_length	Data_length	Max_data_length	Index_length	Data_free	Auto_increment	Create_time	Update_time	Check_time	Collation	Checksum	Create_options	Comment
t1	HEAP	9	Fixed	4	5	#	#	#	5	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t2	HEAP	9	Fixed	4	5	#	#	#	5	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t3	HEAP	9	Fixed	4	9	#	#	#	9	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t1	HEAP	9	Fixed	4	#	#	#	#	5	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t2	HEAP	9	Fixed	4	#	#	#	#	5	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t3	HEAP	9	Fixed	4	#	#	#	#	9	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
delete from t1;
delete from t2;
delete from t3;
show table status;
Name	Engine	Version	Row_format	Rows	Avg_row_length	Data_length	Max_data_length	Index_length	Data_free	Auto_increment	Create_time	Update_time	Check_time	Collation	Checksum	Create_options	Comment
t1	HEAP	9	Fixed	0	5	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t2	HEAP	9	Fixed	0	5	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t3	HEAP	9	Fixed	0	9	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t1	HEAP	9	Fixed	0	#	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t2	HEAP	9	Fixed	0	#	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t3	HEAP	9	Fixed	0	#	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
insert into t1 values (5);
insert into t2 values (5);
insert into t3 values (5,5);
show table status;
Name	Engine	Version	Row_format	Rows	Avg_row_length	Data_length	Max_data_length	Index_length	Data_free	Auto_increment	Create_time	Update_time	Check_time	Collation	Checksum	Create_options	Comment
t1	HEAP	9	Fixed	1	5	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t2	HEAP	9	Fixed	1	5	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t3	HEAP	9	Fixed	1	9	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t1	HEAP	9	Fixed	1	#	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t2	HEAP	9	Fixed	1	#	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t3	HEAP	9	Fixed	1	#	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
delete from t1 where a=5;
delete from t2 where b=5;
delete from t3 where a=5;
show table status;
Name	Engine	Version	Row_format	Rows	Avg_row_length	Data_length	Max_data_length	Index_length	Data_free	Auto_increment	Create_time	Update_time	Check_time	Collation	Checksum	Create_options	Comment
t1	HEAP	9	Fixed	0	5	#	#	#	5	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t2	HEAP	9	Fixed	0	5	#	#	#	5	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t3	HEAP	9	Fixed	0	9	#	#	#	9	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t1	HEAP	9	Fixed	0	#	#	#	#	5	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t2	HEAP	9	Fixed	0	#	#	#	#	5	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
t3	HEAP	9	Fixed	0	#	#	#	#	9	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
drop table t1, t2, t3;
create database mysqltest;
show create database mysqltest;
+6 −0
Original line number Diff line number Diff line
@@ -321,6 +321,12 @@ select a+0, b+0, c+0 from t1 where a = 4 and b = 0 limit 2;
a+0	b+0	c+0
4	0	3
4	0	23
select a+0, b+0, c+0 from t1 where a = 4 and b = 1;
a+0	b+0	c+0
4	1	100
select a+0, b+0, c+0 from t1 where a = 4 and b = 1 and c=100;
a+0	b+0	c+0
4	1	100
select a+0, b+0, c+0 from t1 order by b desc;
a+0	b+0	c+0
2	1	4
Loading