Corrected last fix for

  Bug #13152 bit fields and fields that follow become corrupted when dumped from NDB tables
parent 65427708
...@@ -287,8 +287,6 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, ...@@ -287,8 +287,6 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
keynames=(char*) key_part; keynames=(char*) key_part;
strpos+= (strmov(keynames, (char *) strpos) - keynames)+1; strpos+= (strmov(keynames, (char *) strpos) - keynames)+1;
share->null_bytes= null_pos - (uchar*) outparam->null_flags + (null_bit_pos + 7) / 8;
share->reclength = uint2korr((head+16)); share->reclength = uint2korr((head+16));
if (*(head+26) == 1) if (*(head+26) == 1)
share->system= 1; /* one-record-database */ share->system= 1; /* one-record-database */
...@@ -459,6 +457,9 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, ...@@ -459,6 +457,9 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
{ {
outparam->null_flags=null_pos=(uchar*) record+1; outparam->null_flags=null_pos=(uchar*) record+1;
null_bit_pos= (db_create_options & HA_OPTION_PACK_RECORD) ? 0 : 1; null_bit_pos= (db_create_options & HA_OPTION_PACK_RECORD) ? 0 : 1;
/* null_bytes below is only correct under the condition that
there are no bit fields. Correct values is set below after the
table struct is initialized */
share->null_bytes= (share->null_fields + null_bit_pos + 7) / 8; share->null_bytes= (share->null_fields + null_bit_pos + 7) / 8;
} }
else else
...@@ -871,6 +872,9 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, ...@@ -871,6 +872,9 @@ 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;
/* The table struct is now initialized; Open the table */ /* The table struct is now initialized; Open the table */
error=2; error=2;
if (db_stat) if (db_stat)
......
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