mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-19698: Cleanup READ_RECORD::record
https://github.com/MariaDB/server/pull/777#issuecomment-496469366
This commit is contained in:
@ -3877,7 +3877,6 @@ int subselect_single_select_engine::exec()
|
|||||||
tab->save_read_record= tab->read_record.read_record_func;
|
tab->save_read_record= tab->read_record.read_record_func;
|
||||||
tab->read_record.read_record_func= rr_sequential;
|
tab->read_record.read_record_func= rr_sequential;
|
||||||
tab->read_first_record= read_first_record_seq;
|
tab->read_first_record= read_first_record_seq;
|
||||||
tab->read_record.record= tab->table->record[0];
|
|
||||||
tab->read_record.thd= join->thd;
|
tab->read_record.thd= join->thd;
|
||||||
tab->read_record.ref_length= tab->table->file->ref_length;
|
tab->read_record.ref_length= tab->table->file->ref_length;
|
||||||
tab->read_record.unlock_row= rr_unlock_row;
|
tab->read_record.unlock_row= rr_unlock_row;
|
||||||
@ -3895,7 +3894,6 @@ int subselect_single_select_engine::exec()
|
|||||||
for (JOIN_TAB **ptab= changed_tabs; ptab != last_changed_tab; ptab++)
|
for (JOIN_TAB **ptab= changed_tabs; ptab != last_changed_tab; ptab++)
|
||||||
{
|
{
|
||||||
JOIN_TAB *tab= *ptab;
|
JOIN_TAB *tab= *ptab;
|
||||||
tab->read_record.record= 0;
|
|
||||||
tab->read_record.ref_length= 0;
|
tab->read_record.ref_length= 0;
|
||||||
tab->read_first_record= tab->save_read_first_record;
|
tab->read_first_record= tab->save_read_first_record;
|
||||||
tab->read_record.read_record_func= tab->save_read_record;
|
tab->read_record.read_record_func= tab->save_read_record;
|
||||||
|
@ -77,7 +77,6 @@ bool init_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table,
|
|||||||
bzero((char*) info,sizeof(*info));
|
bzero((char*) info,sizeof(*info));
|
||||||
info->thd= thd;
|
info->thd= thd;
|
||||||
info->table= table;
|
info->table= table;
|
||||||
info->record= table->record[0];
|
|
||||||
info->print_error= print_error;
|
info->print_error= print_error;
|
||||||
info->unlock_row= rr_unlock_row;
|
info->unlock_row= rr_unlock_row;
|
||||||
|
|
||||||
@ -210,7 +209,6 @@ bool init_read_record(READ_RECORD *info,THD *thd, TABLE *table,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
empty_record(table);
|
empty_record(table);
|
||||||
info->record= table->record[0];
|
|
||||||
info->ref_length= (uint)table->file->ref_length;
|
info->ref_length= (uint)table->file->ref_length;
|
||||||
}
|
}
|
||||||
info->select=select;
|
info->select=select;
|
||||||
@ -393,7 +391,7 @@ static int rr_index_first(READ_RECORD *info)
|
|||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp= info->table->file->ha_index_first(info->record);
|
tmp= info->table->file->ha_index_first(info->record());
|
||||||
info->read_record_func= rr_index;
|
info->read_record_func= rr_index;
|
||||||
if (tmp)
|
if (tmp)
|
||||||
tmp= rr_handle_error(info, tmp);
|
tmp= rr_handle_error(info, tmp);
|
||||||
@ -416,7 +414,7 @@ static int rr_index_first(READ_RECORD *info)
|
|||||||
|
|
||||||
static int rr_index_last(READ_RECORD *info)
|
static int rr_index_last(READ_RECORD *info)
|
||||||
{
|
{
|
||||||
int tmp= info->table->file->ha_index_last(info->record);
|
int tmp= info->table->file->ha_index_last(info->record());
|
||||||
info->read_record_func= rr_index_desc;
|
info->read_record_func= rr_index_desc;
|
||||||
if (tmp)
|
if (tmp)
|
||||||
tmp= rr_handle_error(info, tmp);
|
tmp= rr_handle_error(info, tmp);
|
||||||
@ -442,7 +440,7 @@ static int rr_index_last(READ_RECORD *info)
|
|||||||
|
|
||||||
static int rr_index(READ_RECORD *info)
|
static int rr_index(READ_RECORD *info)
|
||||||
{
|
{
|
||||||
int tmp= info->table->file->ha_index_next(info->record);
|
int tmp= info->table->file->ha_index_next(info->record());
|
||||||
if (tmp)
|
if (tmp)
|
||||||
tmp= rr_handle_error(info, tmp);
|
tmp= rr_handle_error(info, tmp);
|
||||||
return tmp;
|
return tmp;
|
||||||
@ -467,7 +465,7 @@ static int rr_index(READ_RECORD *info)
|
|||||||
|
|
||||||
static int rr_index_desc(READ_RECORD *info)
|
static int rr_index_desc(READ_RECORD *info)
|
||||||
{
|
{
|
||||||
int tmp= info->table->file->ha_index_prev(info->record);
|
int tmp= info->table->file->ha_index_prev(info->record());
|
||||||
if (tmp)
|
if (tmp)
|
||||||
tmp= rr_handle_error(info, tmp);
|
tmp= rr_handle_error(info, tmp);
|
||||||
return tmp;
|
return tmp;
|
||||||
@ -477,7 +475,7 @@ static int rr_index_desc(READ_RECORD *info)
|
|||||||
int rr_sequential(READ_RECORD *info)
|
int rr_sequential(READ_RECORD *info)
|
||||||
{
|
{
|
||||||
int tmp;
|
int tmp;
|
||||||
while ((tmp= info->table->file->ha_rnd_next(info->record)))
|
while ((tmp= info->table->file->ha_rnd_next(info->record())))
|
||||||
{
|
{
|
||||||
tmp= rr_handle_error(info, tmp);
|
tmp= rr_handle_error(info, tmp);
|
||||||
break;
|
break;
|
||||||
@ -493,7 +491,7 @@ static int rr_from_tempfile(READ_RECORD *info)
|
|||||||
{
|
{
|
||||||
if (my_b_read(info->io_cache,info->ref_pos,info->ref_length))
|
if (my_b_read(info->io_cache,info->ref_pos,info->ref_length))
|
||||||
return -1; /* End of file */
|
return -1; /* End of file */
|
||||||
if (!(tmp= info->table->file->ha_rnd_pos(info->record,info->ref_pos)))
|
if (!(tmp= info->table->file->ha_rnd_pos(info->record(), info->ref_pos)))
|
||||||
break;
|
break;
|
||||||
/* The following is extremely unlikely to happen */
|
/* The following is extremely unlikely to happen */
|
||||||
if (tmp == HA_ERR_KEY_NOT_FOUND)
|
if (tmp == HA_ERR_KEY_NOT_FOUND)
|
||||||
@ -543,7 +541,7 @@ int rr_from_pointers(READ_RECORD *info)
|
|||||||
cache_pos= info->cache_pos;
|
cache_pos= info->cache_pos;
|
||||||
info->cache_pos+= info->ref_length;
|
info->cache_pos+= info->ref_length;
|
||||||
|
|
||||||
if (!(tmp= info->table->file->ha_rnd_pos(info->record,cache_pos)))
|
if (!(tmp= info->table->file->ha_rnd_pos(info->record(), cache_pos)))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* The following is extremely unlikely to happen */
|
/* The following is extremely unlikely to happen */
|
||||||
@ -638,7 +636,7 @@ static int rr_from_cache(READ_RECORD *info)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
error=0;
|
error=0;
|
||||||
memcpy(info->record,info->cache_pos,
|
memcpy(info->record(), info->cache_pos,
|
||||||
(size_t) info->table->s->reclength);
|
(size_t) info->table->s->reclength);
|
||||||
}
|
}
|
||||||
info->cache_pos+=info->reclength;
|
info->cache_pos+=info->reclength;
|
||||||
|
@ -19,9 +19,10 @@
|
|||||||
#pragma interface /* gcc class implementation */
|
#pragma interface /* gcc class implementation */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "table.h"
|
||||||
|
|
||||||
struct st_join_table;
|
struct st_join_table;
|
||||||
class handler;
|
class handler;
|
||||||
struct TABLE;
|
|
||||||
class THD;
|
class THD;
|
||||||
class SQL_SELECT;
|
class SQL_SELECT;
|
||||||
class Copy_field;
|
class Copy_field;
|
||||||
@ -58,7 +59,6 @@ struct READ_RECORD
|
|||||||
SQL_SELECT *select;
|
SQL_SELECT *select;
|
||||||
uint ref_length, reclength, rec_cache_size, error_offset;
|
uint ref_length, reclength, rec_cache_size, error_offset;
|
||||||
uchar *ref_pos; /* pointer to form->refpos */
|
uchar *ref_pos; /* pointer to form->refpos */
|
||||||
uchar *record;
|
|
||||||
uchar *rec_buf; /* to read field values after filesort */
|
uchar *rec_buf; /* to read field values after filesort */
|
||||||
uchar *cache,*cache_pos,*cache_end,*read_positions;
|
uchar *cache,*cache_pos,*cache_end,*read_positions;
|
||||||
struct st_sort_addon_field *addon_field; /* Pointer to the fields info */
|
struct st_sort_addon_field *addon_field; /* Pointer to the fields info */
|
||||||
@ -67,6 +67,7 @@ struct READ_RECORD
|
|||||||
void (*unpack)(struct st_sort_addon_field *, uchar *, uchar *);
|
void (*unpack)(struct st_sort_addon_field *, uchar *, uchar *);
|
||||||
|
|
||||||
int read_record() { return read_record_func(this); }
|
int read_record() { return read_record_func(this); }
|
||||||
|
uchar *record() const { return table->record[0]; }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
SJ-Materialization runtime may need to read fields from the materialized
|
SJ-Materialization runtime may need to read fields from the materialized
|
||||||
|
@ -20439,7 +20439,6 @@ join_read_first(JOIN_TAB *tab)
|
|||||||
tab->table->status=0;
|
tab->table->status=0;
|
||||||
tab->read_record.read_record_func= join_read_next;
|
tab->read_record.read_record_func= join_read_next;
|
||||||
tab->read_record.table=table;
|
tab->read_record.table=table;
|
||||||
tab->read_record.record=table->record[0];
|
|
||||||
if (!table->file->inited)
|
if (!table->file->inited)
|
||||||
error= table->file->ha_index_init(tab->index, tab->sorted);
|
error= table->file->ha_index_init(tab->index, tab->sorted);
|
||||||
if (likely(!error))
|
if (likely(!error))
|
||||||
@ -20459,7 +20458,7 @@ static int
|
|||||||
join_read_next(READ_RECORD *info)
|
join_read_next(READ_RECORD *info)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
if (unlikely((error= info->table->file->ha_index_next(info->record))))
|
if (unlikely((error= info->table->file->ha_index_next(info->record()))))
|
||||||
return report_error(info->table, error);
|
return report_error(info->table, error);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -20479,7 +20478,6 @@ join_read_last(JOIN_TAB *tab)
|
|||||||
tab->table->status=0;
|
tab->table->status=0;
|
||||||
tab->read_record.read_record_func= join_read_prev;
|
tab->read_record.read_record_func= join_read_prev;
|
||||||
tab->read_record.table=table;
|
tab->read_record.table=table;
|
||||||
tab->read_record.record=table->record[0];
|
|
||||||
if (!table->file->inited)
|
if (!table->file->inited)
|
||||||
error= table->file->ha_index_init(tab->index, 1);
|
error= table->file->ha_index_init(tab->index, 1);
|
||||||
if (likely(!error))
|
if (likely(!error))
|
||||||
@ -20496,7 +20494,7 @@ static int
|
|||||||
join_read_prev(READ_RECORD *info)
|
join_read_prev(READ_RECORD *info)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
if (unlikely((error= info->table->file->ha_index_prev(info->record))))
|
if (unlikely((error= info->table->file->ha_index_prev(info->record()))))
|
||||||
return report_error(info->table, error);
|
return report_error(info->table, error);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -20526,7 +20524,7 @@ static int
|
|||||||
join_ft_read_next(READ_RECORD *info)
|
join_ft_read_next(READ_RECORD *info)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
if (unlikely((error= info->table->file->ha_ft_read(info->table->record[0]))))
|
if (unlikely((error= info->table->file->ha_ft_read(info->record()))))
|
||||||
return report_error(info->table, error);
|
return report_error(info->table, error);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -898,7 +898,7 @@ public:
|
|||||||
{
|
{
|
||||||
Rowid_seq_cursor::init(info);
|
Rowid_seq_cursor::init(info);
|
||||||
table= info->table;
|
table= info->table;
|
||||||
record= info->record;
|
record= info->record();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int fetch()
|
virtual int fetch()
|
||||||
|
Reference in New Issue
Block a user