1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +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.

Merged and updated by: Monty
This commit is contained in:
Aleksey Midenkov
2022-08-31 11:55:02 +03:00
committed by Monty
parent f8ba5ced55
commit 1f85eeeb53
7 changed files with 24 additions and 25 deletions

View File

@@ -8856,11 +8856,10 @@ bool Table_scope_and_contents_source_st::vers_fix_system_fields(
}
int get_select_field_pos(Alter_info *alter_info, int select_field_count,
bool versioned)
int get_select_field_pos(Alter_info *alter_info, bool versioned)
{
int select_field_pos= alter_info->create_list.elements - select_field_count;
if (select_field_count && versioned &&
int select_field_pos= alter_info->field_count();
if (alter_info->select_field_count && versioned &&
/*
ALTER_PARSER_ADD_COLUMN indicates system fields was created implicitly,
select_field_count guarantees it's not ALTER TABLE
@@ -8873,7 +8872,7 @@ int get_select_field_pos(Alter_info *alter_info, int select_field_count,
bool Table_scope_and_contents_source_st::vers_check_system_fields(
THD *thd, Alter_info *alter_info, const Lex_ident_table &table_name,
const Lex_ident_db &db, int select_count)
const Lex_ident_db &db)
{
if (!(options & HA_VERSIONED_TABLE))
return false;
@@ -8884,8 +8883,7 @@ bool Table_scope_and_contents_source_st::vers_check_system_fields(
{
uint fieldnr= 0;
List_iterator<Create_field> field_it(alter_info->create_list);
uint select_field_pos= (uint) get_select_field_pos(alter_info, select_count,
true);
uint select_field_pos= (uint) get_select_field_pos(alter_info, true);
while (Create_field *f= field_it++)
{
/*
@@ -9322,10 +9320,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_ident_table &table_name, const Lex_ident_db &db, int select_count)
const Lex_ident_table &table_name, const Lex_ident_db &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);
}