diff options
author | pappa@c-8b0ae253.1238-1-64736c10.cust.bredbandsbolaget.se <> | 2005-07-22 17:05:16 -0400 |
---|---|---|
committer | pappa@c-8b0ae253.1238-1-64736c10.cust.bredbandsbolaget.se <> | 2005-07-22 17:05:16 -0400 |
commit | 476a4907eb853c10a6173a49059b88d19e09bc12 (patch) | |
tree | b0068a388e0fd220d2771179c31b72484a169c74 /sql | |
parent | 2061b38e641c7bcd03c847420af25e665a4ec71e (diff) | |
download | mariadb-git-476a4907eb853c10a6173a49059b88d19e09bc12.tar.gz |
Bug #12116 patch
Diffstat (limited to 'sql')
-rw-r--r-- | sql/field.h | 6 | ||||
-rw-r--r-- | sql/key.cc | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/sql/field.h b/sql/field.h index 9b6df35de43..31fa322e461 100644 --- a/sql/field.h +++ b/sql/field.h @@ -185,6 +185,12 @@ public: return test(record[(uint) (null_ptr - (uchar*) table->record[0])] & 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) { if (null_ptr) null_ptr[row_offset]|= null_bit; } inline void set_notnull(int row_offset=0) diff --git a/sql/key.cc b/sql/key.cc index f1e073a4775..731df134efa 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -473,8 +473,8 @@ int key_rec_cmp(void *key, byte *first_rec, byte *second_rec) if (key_part->null_bit) { /* The key_part can contain NULL values */ - bool first_is_null= field->is_null(first_diff); - bool sec_is_null= field->is_null(sec_diff); + bool first_is_null= field->is_null_in_record_with_offset(first_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 not then we know that we should return -1 and for the opposite |