1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

cleanup: mainly formatting, plus one helper

This commit is contained in:
Sergei Golubchik
2023-10-19 16:55:16 +02:00
parent 1fe4a71b67
commit 2eee0e9b89
7 changed files with 74 additions and 90 deletions

View File

@ -6778,10 +6778,8 @@ static int get_schema_stat_record(THD *thd, TABLE_LIST *tables,
if (show_table->file)
{
(void) read_statistics_for_tables(thd, tables);
show_table->file->info(HA_STATUS_VARIABLE |
HA_STATUS_NO_LOCK |
HA_STATUS_CONST |
HA_STATUS_TIME);
show_table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK |
HA_STATUS_CONST | HA_STATUS_TIME);
set_statistics_for_table(thd, show_table);
}
for (uint i=0 ; i < show_table->s->keys ; i++,key_info++)
@ -7108,14 +7106,10 @@ static int get_schema_constraints_record(THD *thd, TABLE_LIST *tables,
TABLE *show_table= tables->table;
KEY *key_info=show_table->s->key_info;
uint primary_key= show_table->s->primary_key;
show_table->file->info(HA_STATUS_VARIABLE |
HA_STATUS_NO_LOCK |
show_table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK |
HA_STATUS_TIME);
for (uint i=0 ; i < show_table->s->keys ; i++, key_info++)
{
if (i != primary_key && !(key_info->flags & HA_NOSAME))
continue;
if (i == primary_key && !strcmp(key_info->name.str, primary_key_name))
{
if (store_constraints(thd, table, db_name, table_name,
@ -7133,16 +7127,14 @@ static int get_schema_constraints_record(THD *thd, TABLE_LIST *tables,
}
// Table check constraints
for ( uint i = 0; i < show_table->s->table_check_constraints; i++ )
for (uint i = 0; i < show_table->s->table_check_constraints; i++)
{
Virtual_column_info *check = show_table->check_constraints[ i ];
Virtual_column_info *check = show_table->check_constraints[i];
if ( store_constraints( thd, table, db_name, table_name, check->name.str,
check->name.length,
STRING_WITH_LEN( "CHECK" ) ) )
{
DBUG_RETURN( 1 );
}
if (store_constraints(thd, table, db_name, table_name,
check->name.str, check->name.length,
STRING_WITH_LEN("CHECK")))
DBUG_RETURN(1);
}
show_table->file->get_foreign_key_list(thd, &f_key_list);
@ -7153,7 +7145,7 @@ static int get_schema_constraints_record(THD *thd, TABLE_LIST *tables,
if (store_constraints(thd, table, db_name, table_name,
f_key_info->foreign_id->str,
strlen(f_key_info->foreign_id->str),
"FOREIGN KEY", 11))
STRING_WITH_LEN("FOREIGN KEY")))
DBUG_RETURN(1);
}
}
@ -7284,8 +7276,7 @@ store_key_column_usage(TABLE *table, const LEX_CSTRING *db_name,
}
static int get_schema_key_column_usage_record(THD *thd,
TABLE_LIST *tables,
static int get_schema_key_column_usage_record(THD *thd, TABLE_LIST *tables,
TABLE *table, bool res,
const LEX_CSTRING *db_name,
const LEX_CSTRING *table_name)
@ -7306,8 +7297,7 @@ static int get_schema_key_column_usage_record(THD *thd,
TABLE *show_table= tables->table;
KEY *key_info=show_table->s->key_info;
uint primary_key= show_table->s->primary_key;
show_table->file->info(HA_STATUS_VARIABLE |
HA_STATUS_NO_LOCK |
show_table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK |
HA_STATUS_TIME);
for (uint i=0 ; i < show_table->s->keys ; i++, key_info++)
{
@ -7317,18 +7307,15 @@ static int get_schema_key_column_usage_record(THD *thd,
KEY_PART_INFO *key_part= key_info->key_part;
for (uint j=0 ; j < key_info->user_defined_key_parts ; j++,key_part++)
{
if (key_part->field)
{
f_idx++;
restore_record(table, s->default_values);
store_key_column_usage(table, db_name, table_name,
key_info->name.str, key_info->name.length,
key_part->field->field_name.str,
key_part->field->field_name.length,
(longlong) f_idx);
if (schema_table_store_record(thd, table))
DBUG_RETURN(1);
}
f_idx++;
restore_record(table, s->default_values);
store_key_column_usage(table, db_name, table_name,
key_info->name.str, key_info->name.length,
key_part->field->field_name.str,
key_part->field->field_name.length,
(longlong) f_idx);
if (schema_table_store_record(thd, table))
DBUG_RETURN(1);
}
}
@ -8189,8 +8176,7 @@ get_referential_constraints_record(THD *thd, TABLE_LIST *tables,
{
List<FOREIGN_KEY_INFO> f_key_list;
TABLE *show_table= tables->table;
show_table->file->info(HA_STATUS_VARIABLE |
HA_STATUS_NO_LOCK |
show_table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK |
HA_STATUS_TIME);
show_table->file->get_foreign_key_list(thd, &f_key_list);