Skip to content

Commit 424210a

Browse files
committed
cleanup: reduce code duplication
1 parent cfa8268 commit 424210a

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

sql/sql_base.cc

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4739,6 +4739,9 @@ prepare_fk_prelocking_list(THD *thd, Query_tables_list *prelocking_ctx,
47394739
Query_arena *arena, backup;
47404740
TABLE *table= table_list->table;
47414741

4742+
if (!table->file->referenced_by_foreign_key())
4743+
DBUG_RETURN(FALSE);
4744+
47424745
arena= thd->activate_stmt_arena_if_needed(&backup);
47434746

47444747
table->file->get_parent_foreign_key_list(thd, &fk_list);
@@ -4824,16 +4827,12 @@ bool DML_prelocking_strategy::handle_table(THD *thd,
48244827
return TRUE;
48254828
}
48264829

4827-
if (table->file->referenced_by_foreign_key())
4828-
{
4829-
if (prepare_fk_prelocking_list(thd, prelocking_ctx, table_list,
4830-
need_prelocking,
4831-
table_list->trg_event_map))
4832-
return TRUE;
4833-
}
4830+
if (prepare_fk_prelocking_list(thd, prelocking_ctx, table_list,
4831+
need_prelocking,
4832+
table_list->trg_event_map))
4833+
return TRUE;
48344834
}
4835-
else if (table_list->slave_fk_event_map &&
4836-
table->file->referenced_by_foreign_key())
4835+
else if (table_list->slave_fk_event_map)
48374836
{
48384837
if (prepare_fk_prelocking_list(thd, prelocking_ctx, table_list,
48394838
need_prelocking,

0 commit comments

Comments
 (0)