diff options
author | Nirbhay Choubey <nirbhay@mariadb.com> | 2015-01-26 22:54:27 -0500 |
---|---|---|
committer | Nirbhay Choubey <nirbhay@mariadb.com> | 2015-01-26 22:54:27 -0500 |
commit | 7cda4bee0ef7c8a3ec85e94bc1443ceaba3a64e8 (patch) | |
tree | f8c1f556f36f026038015e7215ae88b0cb7b1ce5 /sql/field.h | |
parent | ea229eb6bb29ee7b11a7d28a7d4c80a593cb1d3b (diff) | |
parent | fb71449b10100e9a0f887b1585000fbfab294f3c (diff) | |
download | mariadb-git-7cda4bee0ef7c8a3ec85e94bc1443ceaba3a64e8.tar.gz |
maria-10.0.16 merge
bzr merge -r4588 maria/10.0
Diffstat (limited to 'sql/field.h')
-rw-r--r-- | sql/field.h | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/sql/field.h b/sql/field.h index dd603d41bf7..0390e95f954 100644 --- a/sql/field.h +++ b/sql/field.h @@ -656,21 +656,28 @@ public: inline bool is_null(my_ptrdiff_t row_offset= 0) const { /* + If the field is NULLable, it returns NULLity based + on null_ptr[row_offset] value. Otherwise it returns + NULL flag depending on TABLE::null_row value. + The table may have been marked as containing only NULL values for all fields if it is a NULL-complemented row of an OUTER JOIN or if the query is an implicitly grouped query (has aggregate functions but no GROUP BY clause) with no qualifying rows. If - this is the case (in which TABLE::null_row is true), the field - is considered to be NULL. + this is the case (in which TABLE::null_row is true) and the + field is not nullable, the field is considered to be NULL. + + Do not change the order of testing. Fields may be associated + with a TABLE object without being part of the current row. + For NULL value check to work for these fields, they must + have a valid null_ptr, and this pointer must be checked before + TABLE::null_row. + Note that if a table->null_row is set then also all null_bits are set for the row. - - Otherwise, if the field is NULLable, it has a valid null_ptr - pointer, and its NULLity is recorded in the "null_bit" bit of - null_ptr[row_offset]. */ - return (table->null_row ? TRUE : - null_ptr ? MY_TEST(null_ptr[row_offset] & null_bit) : 0); + return real_maybe_null() ? + MY_TEST(null_ptr[row_offset] & null_bit) : table->null_row; } inline bool is_real_null(my_ptrdiff_t row_offset= 0) const { return null_ptr ? (null_ptr[row_offset] & null_bit ? 1 : 0) : 0; } |