Skip to content

Commit 5dd8e1b

Browse files
kevgssvoj
authored andcommitted
simplify READ_RECORD usage NFC
READ_RECORD read_record; ... // this // read_record.read_record(&read_record); // becomes just read_record.read_record();
1 parent e105159 commit 5dd8e1b

19 files changed

+64
-62
lines changed

sql/event_db_repository.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ Event_db_repository::table_scan_all_for_i_s(THD *thd, TABLE *schema_table,
499499
*/
500500
do
501501
{
502-
ret= read_record_info.read_record(&read_record_info);
502+
ret= read_record_info.read_record();
503503
if (ret == 0)
504504
ret= copy_event_to_schema_table(thd, schema_table, event_table);
505505
} while (ret == 0);
@@ -1008,7 +1008,7 @@ Event_db_repository::drop_schema_events(THD *thd, const LEX_CSTRING *schema)
10081008
if (init_read_record(&read_record_info, thd, table, NULL, NULL, 1, 0, FALSE))
10091009
goto end;
10101010

1011-
while (!ret && !(read_record_info.read_record(&read_record_info)) )
1011+
while (!ret && !(read_record_info.read_record()))
10121012
{
10131013
char *et_field= get_field(thd->mem_root, table->field[field]);
10141014

sql/events.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1156,7 +1156,7 @@ Events::load_events_from_db(THD *thd)
11561156
DBUG_RETURN(TRUE);
11571157
}
11581158

1159-
while (!(read_record_info.read_record(&read_record_info)))
1159+
while (!(read_record_info.read_record()))
11601160
{
11611161
Event_queue_element *et;
11621162
bool created, dropped;

sql/item_subselect.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3828,8 +3828,8 @@ int subselect_single_select_engine::exec()
38283828
{
38293829
/* Change the access method to full table scan */
38303830
tab->save_read_first_record= tab->read_first_record;
3831-
tab->save_read_record= tab->read_record.read_record;
3832-
tab->read_record.read_record= rr_sequential;
3831+
tab->save_read_record= tab->read_record.read_record_func;
3832+
tab->read_record.read_record_func= rr_sequential;
38333833
tab->read_first_record= read_first_record_seq;
38343834
tab->read_record.record= tab->table->record[0];
38353835
tab->read_record.thd= join->thd;
@@ -3851,8 +3851,8 @@ int subselect_single_select_engine::exec()
38513851
JOIN_TAB *tab= *ptab;
38523852
tab->read_record.record= 0;
38533853
tab->read_record.ref_length= 0;
3854-
tab->read_first_record= tab->save_read_first_record;
3855-
tab->read_record.read_record= tab->save_read_record;
3854+
tab->read_first_record= tab->save_read_first_record;
3855+
tab->read_record.read_record_func= tab->save_read_record;
38563856
}
38573857
executed= 1;
38583858
if (!(uncacheable() & ~UNCACHEABLE_EXPLAIN) &&

sql/opt_range.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11042,7 +11042,7 @@ int QUICK_INDEX_MERGE_SELECT::get_next()
1104211042
if (doing_pk_scan)
1104311043
DBUG_RETURN(pk_quick_select->get_next());
1104411044

11045-
if ((result= read_record.read_record(&read_record)) == -1)
11045+
if ((result= read_record.read_record()) == -1)
1104611046
{
1104711047
result= HA_ERR_END_OF_FILE;
1104811048
end_read_record(&read_record);
@@ -11078,7 +11078,7 @@ int QUICK_INDEX_INTERSECT_SELECT::get_next()
1107811078
int result;
1107911079
DBUG_ENTER("QUICK_INDEX_INTERSECT_SELECT::get_next");
1108011080

11081-
if ((result= read_record.read_record(&read_record)) == -1)
11081+
if ((result= read_record.read_record()) == -1)
1108211082
{
1108311083
result= HA_ERR_END_OF_FILE;
1108411084
end_read_record(&read_record);

sql/opt_subselect.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3872,7 +3872,7 @@ bool setup_sj_materialization_part2(JOIN_TAB *sjm_tab)
38723872
sjm_tab->read_record.copy_field= sjm->copy_field;
38733873
sjm_tab->read_record.copy_field_end= sjm->copy_field +
38743874
sjm->sjm_table_cols.elements;
3875-
sjm_tab->read_record.read_record= rr_sequential_and_unpack;
3875+
sjm_tab->read_record.read_record_func= rr_sequential_and_unpack;
38763876
}
38773877

38783878
sjm_tab->bush_children->end[-1].next_select= end_sj_materialize;

sql/records.cc

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ bool init_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table,
8989
table->file->print_error(error, MYF(0));
9090
}
9191

92-
/* read_record will be changed to rr_index in rr_index_first */
93-
info->read_record= reverse ? rr_index_last : rr_index_first;
92+
/* read_record_func will be changed to rr_index in rr_index_first */
93+
info->read_record_func= reverse ? rr_index_last : rr_index_first;
9494
DBUG_RETURN(error != 0);
9595
}
9696

@@ -229,8 +229,8 @@ bool init_read_record(READ_RECORD *info,THD *thd, TABLE *table,
229229
if (tempfile && !(select && select->quick))
230230
{
231231
DBUG_PRINT("info",("using rr_from_tempfile"));
232-
info->read_record= (addon_field ?
233-
rr_unpack_from_tempfile : rr_from_tempfile);
232+
info->read_record_func=
233+
addon_field ? rr_unpack_from_tempfile : rr_from_tempfile;
234234
info->io_cache= tempfile;
235235
reinit_io_cache(info->io_cache,READ_CACHE,0L,0,0);
236236
info->ref_pos=table->file->ref;
@@ -260,14 +260,14 @@ bool init_read_record(READ_RECORD *info,THD *thd, TABLE *table,
260260
if (! init_rr_cache(thd, info))
261261
{
262262
DBUG_PRINT("info",("using rr_from_cache"));
263-
info->read_record=rr_from_cache;
263+
info->read_record_func= rr_from_cache;
264264
}
265265
}
266266
}
267267
else if (select && select->quick)
268268
{
269269
DBUG_PRINT("info",("using rr_quick"));
270-
info->read_record=rr_quick;
270+
info->read_record_func= rr_quick;
271271
}
272272
else if (filesort && filesort->record_pointers)
273273
{
@@ -277,13 +277,13 @@ bool init_read_record(READ_RECORD *info,THD *thd, TABLE *table,
277277
info->cache_pos= filesort->record_pointers;
278278
info->cache_end= (info->cache_pos+
279279
filesort->return_rows * info->ref_length);
280-
info->read_record= (addon_field ?
281-
rr_unpack_from_buffer : rr_from_pointers);
280+
info->read_record_func=
281+
addon_field ? rr_unpack_from_buffer : rr_from_pointers;
282282
}
283283
else if (table->file->keyread_enabled())
284284
{
285285
int error;
286-
info->read_record= rr_index_first;
286+
info->read_record_func= rr_index_first;
287287
if (!table->file->inited &&
288288
(error= table->file->ha_index_init(table->file->keyread, 1)))
289289
{
@@ -295,7 +295,7 @@ bool init_read_record(READ_RECORD *info,THD *thd, TABLE *table,
295295
else
296296
{
297297
DBUG_PRINT("info",("using rr_sequential"));
298-
info->read_record=rr_sequential;
298+
info->read_record_func= rr_sequential;
299299
if (table->file->ha_rnd_init_with_error(1))
300300
DBUG_RETURN(1);
301301
/* We can use record cache if we don't update dynamic length tables */
@@ -331,7 +331,7 @@ void end_read_record(READ_RECORD *info)
331331
{
332332
if (info->table->is_created())
333333
(void) info->table->file->extra(HA_EXTRA_NO_CACHE);
334-
if (info->read_record != rr_quick) // otherwise quick_range does it
334+
if (info->read_record_func != rr_quick) // otherwise quick_range does it
335335
(void) info->table->file->ha_index_or_rnd_end();
336336
info->table=0;
337337
}
@@ -399,7 +399,7 @@ static int rr_index_first(READ_RECORD *info)
399399
}
400400

401401
tmp= info->table->file->ha_index_first(info->record);
402-
info->read_record= rr_index;
402+
info->read_record_func= rr_index;
403403
if (tmp)
404404
tmp= rr_handle_error(info, tmp);
405405
return tmp;
@@ -422,7 +422,7 @@ static int rr_index_first(READ_RECORD *info)
422422
static int rr_index_last(READ_RECORD *info)
423423
{
424424
int tmp= info->table->file->ha_index_last(info->record);
425-
info->read_record= rr_index_desc;
425+
info->read_record_func= rr_index_desc;
426426
if (tmp)
427427
tmp= rr_handle_error(info, tmp);
428428
return tmp;

sql/records.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct READ_RECORD
5555
//handler *file;
5656
TABLE **forms; /* head and ref forms */
5757
Unlock_row_func unlock_row;
58-
Read_func read_record;
58+
Read_func read_record_func;
5959
THD *thd;
6060
SQL_SELECT *select;
6161
uint cache_records;
@@ -70,6 +70,8 @@ struct READ_RECORD
7070
bool print_error, ignore_not_found_rows;
7171
void (*unpack)(struct st_sort_addon_field *, uchar *, uchar *);
7272

73+
int read_record() { return read_record_func(this); }
74+
7375
/*
7476
SJ-Materialization runtime may need to read fields from the materialized
7577
table and unpack them into original table fields:

sql/sql_acl.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1828,7 +1828,7 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
18281828
{
18291829
if (host_table.init_read_record(&read_record_info, thd))
18301830
DBUG_RETURN(true);
1831-
while (!(read_record_info.read_record(&read_record_info)))
1831+
while (!(read_record_info.read_record()))
18321832
{
18331833
ACL_HOST host;
18341834
update_hostname(&host.host, get_field(&acl_memroot, host_table.host()));
@@ -1932,7 +1932,7 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
19321932
}
19331933

19341934
allow_all_hosts=0;
1935-
while (!(read_record_info.read_record(&read_record_info)))
1935+
while (!(read_record_info.read_record()))
19361936
{
19371937
ACL_USER user;
19381938
bool is_role= FALSE;
@@ -2144,7 +2144,7 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
21442144
const Db_table& db_table= tables.db_table();
21452145
if (db_table.init_read_record(&read_record_info, thd))
21462146
DBUG_RETURN(TRUE);
2147-
while (!(read_record_info.read_record(&read_record_info)))
2147+
while (!(read_record_info.read_record()))
21482148
{
21492149
ACL_DB db;
21502150
char *db_name;
@@ -2211,7 +2211,7 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
22112211
{
22122212
if (proxies_priv_table.init_read_record(&read_record_info, thd))
22132213
DBUG_RETURN(TRUE);
2214-
while (!(read_record_info.read_record(&read_record_info)))
2214+
while (!(read_record_info.read_record()))
22152215
{
22162216
ACL_PROXY_USER proxy;
22172217
proxy.init(proxies_priv_table, &acl_memroot);
@@ -2240,7 +2240,7 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
22402240

22412241
MEM_ROOT temp_root;
22422242
init_alloc_root(&temp_root, ACL_ALLOC_BLOCK_SIZE, 0, MYF(0));
2243-
while (!(read_record_info.read_record(&read_record_info)))
2243+
while (!(read_record_info.read_record()))
22442244
{
22452245
char *hostname= safe_str(get_field(&temp_root, roles_mapping_table.host()));
22462246
char *username= safe_str(get_field(&temp_root, roles_mapping_table.user()));

sql/sql_delete.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
588588
deltempfile= new (thd->mem_root) Unique (refpos_order_cmp, table->file,
589589
table->file->ref_length,
590590
MEM_STRIP_BUF_SIZE);
591-
while (!(error=info.read_record(&info)) && !thd->killed &&
591+
while (!(error=info.read_record()) && !thd->killed &&
592592
! thd->is_error())
593593
{
594594
if (record_should_be_deleted(thd, table, select, explain))
@@ -613,7 +613,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
613613
delete_record= true;
614614
}
615615

616-
while (!(error=info.read_record(&info)) && !thd->killed &&
616+
while (!(error=info.read_record()) && !thd->killed &&
617617
! thd->is_error())
618618
{
619619
if (delete_while_scanning)
@@ -1286,7 +1286,7 @@ int multi_delete::do_table_deletes(TABLE *table, SORT_INFO *sort_info,
12861286
*/
12871287
info.ignore_not_found_rows= 1;
12881288
bool will_batch= !table->file->start_bulk_delete();
1289-
while (!(local_error= info.read_record(&info)) && !thd->killed)
1289+
while (!(local_error= info.read_record()) && !thd->killed)
12901290
{
12911291
if (table->triggers &&
12921292
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,

sql/sql_help.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ int search_topics(THD *thd, TABLE *topics, struct st_find_field *find_fields,
202202
FALSE))
203203
DBUG_RETURN(0);
204204

205-
while (!read_record_info.read_record(&read_record_info))
205+
while (!read_record_info.read_record())
206206
{
207207
if (!select->cond->val_int()) // Doesn't match like
208208
continue;
@@ -246,7 +246,7 @@ int search_keyword(THD *thd, TABLE *keywords,
246246
FALSE))
247247
DBUG_RETURN(0);
248248

249-
while (!read_record_info.read_record(&read_record_info) && count<2)
249+
while (!read_record_info.read_record() && count<2)
250250
{
251251
if (!select->cond->val_int()) // Dosn't match like
252252
continue;
@@ -380,7 +380,7 @@ int search_categories(THD *thd, TABLE *categories,
380380
if (init_read_record(&read_record_info, thd, categories, select, NULL,
381381
1, 0, FALSE))
382382
DBUG_RETURN(0);
383-
while (!read_record_info.read_record(&read_record_info))
383+
while (!read_record_info.read_record())
384384
{
385385
if (select && !select->cond->val_int())
386386
continue;
@@ -418,7 +418,7 @@ void get_all_items_for_category(THD *thd, TABLE *items, Field *pfname,
418418
FALSE))
419419
DBUG_VOID_RETURN;
420420

421-
while (!read_record_info.read_record(&read_record_info))
421+
while (!read_record_info.read_record())
422422
{
423423
if (!select->cond->val_int())
424424
continue;

0 commit comments

Comments
 (0)