Skip to content
Permalink
Browse files
table_count was present twice in one class of LEX.
Remove table_count from Query_tables_list (not used, moved to MYSQL_LOCK).

Rename table_count from LEX to avoid mixing it with other counters of tables.
  • Loading branch information
sanja-byelkin committed Jul 14, 2022
1 parent 49e1400 commit 92a3280
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
@@ -1537,15 +1537,6 @@ class Query_tables_list
Sroutine_hash_entry **sroutines_list_own_last;
uint sroutines_list_own_elements;

/**
Number of tables which were open by open_tables() and to be locked
by lock_tables().
Note that we set this member only in some cases, when this value
needs to be passed from open_tables() to lock_tables() which are
separated by some amount of code.
*/
uint table_count;

/*
These constructor and destructor serve for creation/destruction
of Query_tables_list instances which are used as backup storage.
@@ -3060,7 +3051,7 @@ struct LEX: public Query_tables_list
stores total number of tables. For LEX representing multi-delete
holds number of tables from which we will delete records.
*/
uint table_count;
uint table_count_update;
uint8 describe;
bool analyze_stmt; /* TRUE<=> this is "ANALYZE $stmt" */
bool explain_json;
@@ -4758,7 +4758,7 @@ mysql_execute_command(THD *thd)
if (likely(!thd->is_fatal_error))
{
result= new (thd->mem_root) multi_delete(thd, aux_tables,
lex->table_count);
lex->table_count_update);
if (likely(result))
{
if (unlikely(select_lex->vers_setup_conds(thd, aux_tables)))
@@ -9532,12 +9532,12 @@ bool multi_delete_set_locks_and_link_aux_tables(LEX *lex)
TABLE_LIST *target_tbl;
DBUG_ENTER("multi_delete_set_locks_and_link_aux_tables");

lex->table_count= 0;
lex->table_count_update= 0;

for (target_tbl= lex->auxiliary_table_list.first;
target_tbl; target_tbl= target_tbl->next_local)
{
lex->table_count++;
lex->table_count_update++;
/* All tables in aux_tables must be found in FROM PART */
TABLE_LIST *walk= multi_delete_table_match(lex, target_tbl, tables);
if (!walk)
@@ -1446,7 +1446,7 @@ static int mysql_test_update(Prepared_statement *stmt,
DBUG_ASSERT(update_source_table || table_list->view != 0);
DBUG_PRINT("info", ("Switch to multi-update"));
/* pass counter value */
thd->lex->table_count= table_count;
thd->lex->table_count_update= table_count;
/* convert to multiupdate */
DBUG_RETURN(2);
}
@@ -365,7 +365,7 @@ int mysql_update(THD *thd,
DBUG_ASSERT(update_source_table || table_list->view != 0);
DBUG_PRINT("info", ("Switch to multi-update"));
/* pass counter value */
thd->lex->table_count= table_count;
thd->lex->table_count_update= table_count;
/* convert to multiupdate */
DBUG_RETURN(2);
}
@@ -1710,7 +1710,7 @@ int mysql_multi_update_prepare(THD *thd)
TABLE_LIST *table_list= lex->query_tables;
TABLE_LIST *tl;
Multiupdate_prelocking_strategy prelocking_strategy;
uint table_count= lex->table_count;
uint table_count= lex->table_count_update;
DBUG_ENTER("mysql_multi_update_prepare");

/*

0 comments on commit 92a3280

Please sign in to comment.