summaryrefslogtreecommitdiff
path: root/sql/sql_join_cache.cc
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2010-11-29 19:00:32 +0300
committerSergey Petrunya <psergey@askmonty.org>2010-11-29 19:00:32 +0300
commitd1afc20e137984f1e6edd225be6da106b008da52 (patch)
tree720e62954134661e9c630f85e933d1ddec0e596a /sql/sql_join_cache.cc
parentcee6e4565dc6b5b71ef059f8e8ed48c2c1212393 (diff)
parent4e05898f539f299bbb12c49834502c1e471f2fc9 (diff)
downloadmariadb-git-d1afc20e137984f1e6edd225be6da106b008da52.tar.gz
Merge maria-5.3-mwl128 -> maria-5.2-mwl128-dsmrr-cpk
Diffstat (limited to 'sql/sql_join_cache.cc')
-rw-r--r--sql/sql_join_cache.cc19
1 files changed, 16 insertions, 3 deletions
diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc
index e8999699b62..88f95142686 100644
--- a/sql/sql_join_cache.cc
+++ b/sql/sql_join_cache.cc
@@ -1776,7 +1776,13 @@ uint JOIN_CACHE::read_record_field(CACHE_FIELD *copy, bool blob_in_rec_buff)
If the value of *len is 0 then the function sets it to the total
length of the record fields including possible trailing offset
values. Otherwise *len is supposed to provide this value that
- has been obtained earlier.
+ has been obtained earlier.
+
+ NOTE
+ If the value of the referenced field is null then the offset
+ for the value is set to 0. If the value of a field can be null
+ then the value of flag_fields is always positive. So the offset
+ for any non-null value cannot be 0 in this case.
RETURN VALUE
TRUE 'copy' points to a data descriptor of this join cache
@@ -1805,14 +1811,21 @@ bool JOIN_CACHE::read_referenced_field(CACHE_FIELD *copy,
size_of_fld_ofs*
(referenced_fields+1-copy->referenced_field_no));
bool is_null= FALSE;
+ Field *field= copy->field;
if (offset == 0 && flag_fields)
is_null= TRUE;
if (is_null)
- copy->field->set_null();
+ {
+ field->set_null();
+ if (!field->real_maybe_null())
+ field->table->null_row= 1;
+ }
else
{
uchar *save_pos= pos;
- copy->field->set_notnull();
+ field->set_notnull();
+ if (!field->real_maybe_null())
+ field->table->null_row= 0;
pos= rec_ptr+offset;
read_record_field(copy, blob_data_is_in_rec_buff(rec_ptr));
pos= save_pos;