| 7427 | |
| 7428 | |
| 7429 | static int get_schema_stat_record(THD *thd, TABLE_LIST *tables, TABLE *table, |
| 7430 | bool res, const LEX_CSTRING *db_name, |
| 7431 | const LEX_CSTRING *table_name) |
| 7432 | { |
| 7433 | CHARSET_INFO *cs= system_charset_info; |
| 7434 | DBUG_ENTER("get_schema_stat_record"); |
| 7435 | if (!tables->view) |
| 7436 | { |
| 7437 | TABLE *show_table= tables->table; |
| 7438 | KEY *key_info= show_table->s->key_info; |
| 7439 | if (show_table->file) |
| 7440 | { |
| 7441 | (void) read_statistics_for_tables(thd, tables, false); |
| 7442 | show_table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK | |
| 7443 | HA_STATUS_CONST | HA_STATUS_TIME); |
| 7444 | set_statistics_for_table(thd, show_table); |
| 7445 | } |
| 7446 | |
| 7447 | bool need_column_checks= !get_schema_privileges_for_show(thd, tables, |
| 7448 | TABLE_ACLS, false); |
| 7449 | |
| 7450 | for (uint i=0 ; i < show_table->s->total_keys ; i++,key_info++) |
| 7451 | { |
| 7452 | if ((key_info->flags & HA_INVISIBLE_KEY) && |
| 7453 | !DBUG_IF("test_invisible_index")) |
| 7454 | continue; |
| 7455 | KEY_PART_INFO *key_part= key_info->key_part; |
| 7456 | LEX_CSTRING *str; |
| 7457 | LEX_CSTRING unknown= {STRING_WITH_LEN("?unknown field?") }; |
| 7458 | |
| 7459 | if (need_column_checks) |
| 7460 | { |
| 7461 | uint j; |
| 7462 | for (j=0 ; j < key_info->user_defined_key_parts ; j++,key_part++) |
| 7463 | { |
| 7464 | auto access= get_column_grant(thd, &tables->grant, db_name->str, |
| 7465 | table_name->str, |
| 7466 | key_part->field->field_name); |
| 7467 | |
| 7468 | if (!access) |
| 7469 | break; |
| 7470 | } |
| 7471 | if (j != key_info->user_defined_key_parts) |
| 7472 | continue; |
| 7473 | key_part= key_info->key_part; |
| 7474 | } |
| 7475 | |
| 7476 | for (uint j=0 ; j < key_info->user_defined_key_parts ; j++,key_part++) |
| 7477 | { |
| 7478 | if (key_part->field->invisible >= INVISIBLE_SYSTEM && |
| 7479 | !DBUG_IF("test_completely_invisible")) |
| 7480 | { |
| 7481 | /* |
| 7482 | NOTE: we will get SEQ_IN_INDEX gap inside the result if this key_part |
| 7483 | is not last (currently not possible). Though nothing is wrong with |
| 7484 | that probably. |
| 7485 | */ |
| 7486 | continue; |
nothing calls this directly
no test coverage detected