Commit ba950815 authored by unknown's avatar unknown

sql_table.cc, table.cc, table.h:

  fixed CHECKSUM TABLE to be independent from last - undefined in InnoDB - bits in the null bitmask
  bug#13710


sql/table.h:
  fixed CHECKSUM TABLE to be independent from last - undefined in InnoDB - bits in the null bitmask
  bug#13710
sql/table.cc:
  fixed CHECKSUM TABLE to be independent from last - undefined in InnoDB - bits in the null bitmask
  bug#13710
sql/sql_table.cc:
  fixed CHECKSUM TABLE to be independent from last - undefined in InnoDB - bits in the null bitmask
  bug#13710
parent aa44e79c
......@@ -4100,6 +4100,7 @@ bool mysql_checksum_table(THD *thd, TABLE_LIST *tables, HA_CHECK_OPT *check_opt)
{
/* calculating table's checksum */
ha_checksum crc= 0;
uchar null_mask=256 - (1 << t->s->last_null_bit_pos);
/* InnoDB must be told explicitly to retrieve all columns, because
this function does not set field->query_id in the columns to the
......@@ -4120,9 +4121,12 @@ bool mysql_checksum_table(THD *thd, TABLE_LIST *tables, HA_CHECK_OPT *check_opt)
continue;
break;
}
if (t->record[0] != (byte*) t->field[0]->ptr)
row_crc= my_checksum(row_crc, t->record[0],
((byte*) t->field[0]->ptr) - t->record[0]);
if (t->s->null_bytes)
{
/* fix undefined null bits */
t->record[0][t->s->null_bytes-1] |= null_mask;
row_crc= my_checksum(row_crc, t->record[0], t->s->null_bytes);
}
for (uint i= 0; i < t->s->fields; i++ )
{
......@@ -4166,9 +4170,9 @@ static bool check_engine(THD *thd, const char *table_name,
enum db_type *new_engine)
{
enum db_type req_engine= *new_engine;
bool no_substitution=
bool no_substitution=
test(thd->variables.sql_mode & MODE_NO_ENGINE_SUBSTITUTION);
if ((*new_engine=
if ((*new_engine=
ha_checktype(thd, req_engine, no_substitution, 1)) == DB_TYPE_UNKNOWN)
return TRUE;
......
......@@ -874,6 +874,7 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
/* the correct null_bytes can now be set, since bitfields have been taken into account */
share->null_bytes= null_pos - (uchar*) outparam->null_flags + (null_bit_pos + 7) / 8;
share->last_null_bit_pos= null_bit_pos;
/* The table struct is now initialized; Open the table */
error=2;
......
......@@ -141,7 +141,7 @@ typedef struct st_table_share
enum tmp_table_type tmp_table;
uint blob_ptr_size; /* 4 or 8 */
uint null_bytes;
uint null_bytes, last_null_bit_pos;
uint key_length; /* Length of table_cache_key */
uint fields; /* Number of fields */
uint rec_buff_length; /* Size of table->record[] buffer */
......
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