1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00
The function JOIN_CACHE::read_all_record_fields could return 0
for an incremental join cache in two cases:
1. there were no more records in the associated join buffer
2. there was no table fields stored in the join buffer.
As a result the function JOIN_CACHE::get_record() could
return prematurely and did not read all needed fields from
join buffers into the record buffer.

Now the function JOIN_CACHE::read_all_record_fields returns
-1 if there are no more records in the associated join buffer.
This commit is contained in:
Igor Babaev
2010-03-06 11:14:55 -08:00
parent 3ccc1d6b1e
commit 1c7ba7ba2f
3 changed files with 73 additions and 3 deletions

View File

@@ -31,6 +31,8 @@
#include "sql_select.h"
#include "opt_subselect.h"
#define NO_MORE_RECORDS_IN_BUFFER (uint)(-1)
/*****************************************************************************
* Join cache module
@@ -1237,7 +1239,7 @@ bool JOIN_CACHE::get_record()
prev_rec_ptr= prev_cache->get_rec_ref(pos);
}
curr_rec_pos= pos;
if (!(res= read_all_record_fields() == 0))
if (!(res= read_all_record_fields() == NO_MORE_RECORDS_IN_BUFFER))
{
pos+= referenced_fields*size_of_fld_ofs;
if (prev_cache)
@@ -1326,7 +1328,8 @@ bool JOIN_CACHE::get_match_flag_by_pos(uchar *rec_ptr)
read data.
RETURN
length of the data read from the join buffer
(-1) - if there is no more records in the join buffer
length of the data read from the join buffer - otherwise
*/
uint JOIN_CACHE::read_all_record_fields()
@@ -1334,7 +1337,7 @@ uint JOIN_CACHE::read_all_record_fields()
uchar *init_pos= pos;
if (pos > last_rec_pos || !records)
return 0;
return NO_MORE_RECORDS_IN_BUFFER;
/* First match flag, read null bitmaps and null_row flag for each table */
read_flag_fields();