Commit 183caf2e authored by unknown's avatar unknown

Bug #12116 patch


sql/field.h:
  64-bit safe is_null with offset
sql/key.cc:
  64-bit safe is_null with offset
parent 828a7021
...@@ -185,6 +185,12 @@ class Field ...@@ -185,6 +185,12 @@ class Field
return test(record[(uint) (null_ptr - (uchar*) table->record[0])] & return test(record[(uint) (null_ptr - (uchar*) table->record[0])] &
null_bit); null_bit);
} }
inline bool is_null_in_record_with_offset(my_ptrdiff_t offset)
{
if (!null_ptr)
return 0;
return test(null_ptr[offset] & null_bit);
}
inline void set_null(int row_offset=0) inline void set_null(int row_offset=0)
{ if (null_ptr) null_ptr[row_offset]|= null_bit; } { if (null_ptr) null_ptr[row_offset]|= null_bit; }
inline void set_notnull(int row_offset=0) inline void set_notnull(int row_offset=0)
......
...@@ -473,8 +473,8 @@ int key_rec_cmp(void *key, byte *first_rec, byte *second_rec) ...@@ -473,8 +473,8 @@ int key_rec_cmp(void *key, byte *first_rec, byte *second_rec)
if (key_part->null_bit) if (key_part->null_bit)
{ {
/* The key_part can contain NULL values */ /* The key_part can contain NULL values */
bool first_is_null= field->is_null(first_diff); bool first_is_null= field->is_null_in_record_with_offset(first_diff);
bool sec_is_null= field->is_null(sec_diff); bool sec_is_null= field->is_null_in_record_with_offset(sec_diff);
/* /*
NULL is smaller then everything so if first is NULL and the other NULL is smaller then everything so if first is NULL and the other
not then we know that we should return -1 and for the opposite not then we know that we should return -1 and for the opposite
......
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