1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +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

@ -2741,7 +2741,6 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
List_iterator_fast<Create_field> it(alter_info->create_list);
List_iterator<Create_field> it2(alter_info->create_list);
uint total_uneven_bit_length= 0;
int select_field_count= C_CREATE_SELECT(create_table_mode);
bool tmp_table= create_table_mode == C_ALTER_TABLE;
const bool create_simple= thd->lex->create_simple();
bool is_hash_field_needed= false;
@ -2781,7 +2780,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
DBUG_RETURN(TRUE);
}
select_field_pos= alter_info->create_list.elements - select_field_count;
select_field_pos= alter_info->field_count();
null_fields= 0;
create_info->varchar= 0;
max_key_length= file->max_key_length();
@ -2956,7 +2955,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
from the select tables. This order may differ on master and slave. We
therefore mark it as unsafe.
*/
if (select_field_count > 0 && auto_increment)
if (alter_info->select_field_count > 0 && auto_increment)
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_CREATE_SELECT_AUTOINC);
/* Create keys */