diff options
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r-- | sql/sql_show.cc | 46 |
1 files changed, 20 insertions, 26 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 4deda700070..ccc4438c39c 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2009, 2022, MariaDB + Copyright (c) 2009, 2023, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -231,6 +231,9 @@ static my_bool show_plugins(THD *thd, plugin_ref plugin, case PLUGIN_IS_DISABLED: table->field[2]->store(STRING_WITH_LEN("DISABLED"), cs); break; + case PLUGIN_IS_DYING: + table->field[2]->store(STRING_WITH_LEN("INACTIVE"), cs); + break; case PLUGIN_IS_FREED: // filtered in fill_plugins, used in fill_all_plugins table->field[2]->store(STRING_WITH_LEN("NOT INSTALLED"), cs); break; @@ -324,7 +327,7 @@ int fill_plugins(THD *thd, TABLE_LIST *tables, COND *cond) TABLE *table= tables->table; if (plugin_foreach_with_mask(thd, show_plugins, MYSQL_ANY_PLUGIN, - ~(PLUGIN_IS_FREED | PLUGIN_IS_DYING), table)) + ~PLUGIN_IS_FREED, table)) DBUG_RETURN(1); DBUG_RETURN(0); @@ -354,7 +357,7 @@ int fill_all_plugins(THD *thd, TABLE_LIST *tables, COND *cond) plugin_dl_foreach(thd, 0, show_plugins, table); const char *wstr= lookup.db_value.str, *wend= wstr + lookup.db_value.length; - for (uint i=0; i < (uint) dirp->number_of_files; i++) + for (size_t i=0; i < dirp->number_of_files; i++) { FILEINFO *file= dirp->dir_entry+i; LEX_CSTRING dl= { file->name, strlen(file->name) }; @@ -952,7 +955,7 @@ find_files(THD *thd, Dynamic_array<LEX_CSTRING*> *files, LEX_CSTRING *db, if (!db) /* Return databases */ { - for (uint i=0; i < (uint) dirp->number_of_files; i++) + for (size_t i=0; i < dirp->number_of_files; i++) { FILEINFO *file= dirp->dir_entry+i; #ifdef USE_SYMDIR @@ -2360,6 +2363,9 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list, packet->append_parenthesized((long) key_part->length / key_part->field->charset()->mbmaxlen); } + if (table->file->index_flags(i, j, 0) & HA_READ_ORDER && + key_part->key_part_flag & HA_REVERSE_SORT) /* same in SHOW KEYS */ + packet->append(STRING_WITH_LEN(" DESC")); } if (key_info->without_overlaps) @@ -2446,7 +2452,7 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list, add_table_options(thd, table, create_info_arg, table_list->schema_table != 0, 0, packet); - if (DBUG_EVALUATE_IF("sysvers_hide", 0, table->versioned())) + if (!DBUG_IF("sysvers_hide") && table->versioned()) packet->append(STRING_WITH_LEN(" WITH SYSTEM VERSIONING")); #ifdef WITH_PARTITION_STORAGE_ENGINE @@ -6754,7 +6760,7 @@ static int get_schema_stat_record(THD *thd, TABLE_LIST *tables, for (uint i=0 ; i < show_table->s->keys ; i++,key_info++) { if ((key_info->flags & HA_INVISIBLE_KEY) && - DBUG_EVALUATE_IF("test_invisible_index", 0, 1)) + !DBUG_IF("test_invisible_index")) continue; KEY_PART_INFO *key_part= key_info->key_part; LEX_CSTRING *str; @@ -6762,7 +6768,7 @@ static int get_schema_stat_record(THD *thd, TABLE_LIST *tables, for (uint j=0 ; j < key_info->user_defined_key_parts ; j++,key_part++) { if (key_part->field->invisible >= INVISIBLE_SYSTEM && - DBUG_EVALUATE_IF("test_completely_invisible", 0, 1)) + !DBUG_IF("test_completely_invisible")) { /* NOTE: we will get SEQ_IN_INDEX gap inside the result if this key_part @@ -7422,13 +7428,7 @@ static void store_schema_partitions_record(THD *thd, TABLE *schema_table, table->field[23]->store(STRING_WITH_LEN("default"), cs); table->field[24]->set_notnull(); - if (part_elem->tablespace_name) - table->field[24]->store(part_elem->tablespace_name, - strlen(part_elem->tablespace_name), cs); - else - { - table->field[24]->set_null(); - } + table->field[24]->set_null(); // Tablespace } return; } @@ -8244,7 +8244,6 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list) bool keep_row_order; TMP_TABLE_PARAM *tmp_table_param; SELECT_LEX *select_lex; - my_bitmap_map *bitmaps; DBUG_ENTER("create_schema_table"); for (; !fields->end_marker(); fields++) @@ -8265,8 +8264,9 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list) table_list->alias, !need_all_fields, keep_row_order))) DBUG_RETURN(0); - bitmaps= (my_bitmap_map*) thd->alloc(bitmap_buffer_size(field_count)); - my_bitmap_init(&table->def_read_set, bitmaps, field_count, FALSE); + my_bitmap_map* bitmaps= + (my_bitmap_map*) thd->alloc(bitmap_buffer_size(field_count)); + my_bitmap_init(&table->def_read_set, bitmaps, field_count); table->read_set= &table->def_read_set; bitmap_clear_all(table->read_set); table_list->schema_table_param= tmp_table_param; @@ -9859,23 +9859,17 @@ int initialize_schema_table(st_plugin_int *plugin) int finalize_schema_table(st_plugin_int *plugin) { + int deinit_status= 0; ST_SCHEMA_TABLE *schema_table= (ST_SCHEMA_TABLE *)plugin->data; DBUG_ENTER("finalize_schema_table"); if (schema_table) { if (plugin->plugin->deinit) - { - DBUG_PRINT("info", ("Deinitializing plugin: '%s'", plugin->name.str)); - if (plugin->plugin->deinit(NULL)) - { - DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.", - plugin->name.str)); - } - } + deinit_status= plugin->plugin->deinit(NULL); my_free(schema_table); } - DBUG_RETURN(0); + DBUG_RETURN(deinit_status); } |