1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

MDEV-25292 Refactoring: moved select_field_count into Alter_info.

There is a need in MDEV-25292 to have both C_ALTER_TABLE and
select_field_count in one call. Semantically creation mode and field
count are two different things. Making creation mode negative
constants and field count positive variable into one parameter seems
to be a lazy hack for not making the second parameter.

select_count does not make sense without alter_info->create_list, so
the natural way is to hold it in Alter_info too. select_count is now
stored in member select_field_count.
This commit is contained in:
Aleksey Midenkov
2022-08-31 11:55:02 +03:00
parent 5369df741b
commit f02af1d229
6 changed files with 22 additions and 20 deletions

View File

@ -8187,7 +8187,7 @@ bool Table_scope_and_contents_source_st::vers_fix_system_fields(
bool Table_scope_and_contents_source_st::vers_check_system_fields(
THD *thd, Alter_info *alter_info, const Lex_table_name &table_name,
const Lex_table_name &db, int select_count)
const Lex_table_name &db)
{
if (!(options & HA_VERSIONED_TABLE))
return false;
@ -8208,7 +8208,7 @@ bool Table_scope_and_contents_source_st::vers_check_system_fields(
SELECT go last there.
*/
bool is_dup= false;
if (fieldnr >= alter_info->create_list.elements - select_count)
if (fieldnr >= alter_info->field_count())
{
List_iterator<Create_field> dup_it(alter_info->create_list);
for (Create_field *dup= dup_it++; !is_dup && dup != f; dup= dup_it++)
@ -8616,10 +8616,9 @@ bool Table_period_info::check_field(const Create_field* f,
bool Table_scope_and_contents_source_st::check_fields(
THD *thd, Alter_info *alter_info,
const Lex_table_name &table_name, const Lex_table_name &db, int select_count)
const Lex_table_name &table_name, const Lex_table_name &db)
{
return vers_check_system_fields(thd, alter_info,
table_name, db, select_count) ||
return vers_check_system_fields(thd, alter_info, table_name, db) ||
check_period_fields(thd, alter_info);
}