diff options
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r-- | sql/sql_show.cc | 85 |
1 files changed, 65 insertions, 20 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 570a98b3aa3..697a9d42bca 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2004 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. 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 @@ -112,7 +112,6 @@ static my_bool show_plugins(THD *thd, plugin_ref plugin, make_version_string(version_buf, sizeof(version_buf), plug->version), cs); - switch (plugin_state(plugin)) { /* case PLUGIN_IS_FREED: does not happen */ case PLUGIN_IS_DELETED: @@ -124,6 +123,9 @@ static my_bool show_plugins(THD *thd, plugin_ref plugin, case PLUGIN_IS_READY: table->field[2]->store(STRING_WITH_LEN("ACTIVE"), cs); break; + case PLUGIN_IS_DISABLED: + table->field[2]->store(STRING_WITH_LEN("DISABLED"), cs); + break; default: DBUG_ASSERT(0); } @@ -471,6 +473,7 @@ find_files(THD *thd, List<LEX_STRING> *files, const char *db, if (wild && !wild[0]) wild=0; + bzero((char*) &table_list,sizeof(table_list)); if (!(dirp = my_dir(path,MYF(dir ? MY_WANT_STAT : 0)))) @@ -993,15 +996,14 @@ static bool get_field_default_value(THD *thd, TABLE *table, { bool has_default; bool has_now_default; - + enum enum_field_types field_type= field->type(); /* - We are using CURRENT_TIMESTAMP instead of NOW because it is - more standard + We are using CURRENT_TIMESTAMP instead of NOW because it is + more standard */ has_now_default= table->timestamp_field == field && field->unireg_check != Field::TIMESTAMP_UN_FIELD; - - has_default= (field->type() != FIELD_TYPE_BLOB && + has_default= (field_type != FIELD_TYPE_BLOB && !(field->flags & NO_DEFAULT_VALUE_FLAG) && field->unireg_check != Field::NEXT_NUMBER && !((thd->variables.sql_mode & (MODE_MYSQL323 | MODE_MYSQL40)) @@ -1016,7 +1018,19 @@ static bool get_field_default_value(THD *thd, TABLE *table, { // Not null by default char tmp[MAX_FIELD_WIDTH]; String type(tmp, sizeof(tmp), field->charset()); - field->val_str(&type); + if (field_type == MYSQL_TYPE_BIT) + { + longlong dec= field->val_int(); + char *ptr= longlong2str(dec, tmp + 2, 2); + uint32 length= (uint32) (ptr - tmp); + tmp[0]= 'b'; + tmp[1]= '\''; + tmp[length]= '\''; + type.length(length + 1); + quoted= 0; + } + else + field->val_str(&type); if (type.length()) { String def_val; @@ -2092,7 +2106,7 @@ static bool show_status_array(THD *thd, const char *wild, CHARSET_INFO *charset= system_charset_info; DBUG_ENTER("show_status_array"); - thd->count_cuted_fields= CHECK_FIELD_WARN; + thd->count_cuted_fields= CHECK_FIELD_WARN; null_lex_str.str= 0; // For sys_var->value_ptr() null_lex_str.length= 0; @@ -3571,6 +3585,11 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables, ptr=strxmov(ptr, " row_format=", ha_row_type[(uint) share->row_type], NullS); + if (share->key_block_size) + { + ptr= strmov(ptr, " key_block_size="); + ptr= longlong10_to_str(share->key_block_size, ptr, 10); + } #ifdef WITH_PARTITION_STORAGE_ENGINE if (is_partitioned) ptr= strmov(ptr, " partitioned"); @@ -3907,6 +3926,25 @@ static my_bool iter_schema_engines(THD *thd, plugin_ref plugin, handlerton *default_type= ha_default_handlerton(thd); DBUG_ENTER("iter_schema_engines"); + + /* Disabled plugins */ + if (plugin_state(plugin) != PLUGIN_IS_READY) + { + + struct st_mysql_plugin *plug= plugin_decl(plugin); + if (!(wild && wild[0] && + wild_case_compare(scs, plug->name,wild))) + { + restore_record(table, s->default_values); + table->field[0]->store(plug->name, strlen(plug->name), scs); + table->field[1]->store(C_STRING_WITH_LEN("NO"), scs); + table->field[2]->store(plug->descr, strlen(plug->descr), scs); + if (schema_table_store_record(thd, table)) + DBUG_RETURN(1); + } + DBUG_RETURN(0); + } + if (!(hton->flags & HTON_HIDDEN)) { LEX_STRING *name= plugin_name(plugin); @@ -3927,10 +3965,13 @@ static my_bool iter_schema_engines(THD *thd, plugin_ref plugin, strlen(plugin_decl(plugin)->descr), scs); tmp= &yesno[test(hton->commit)]; table->field[3]->store(tmp->str, tmp->length, scs); + table->field[3]->set_notnull(); tmp= &yesno[test(hton->prepare)]; table->field[4]->store(tmp->str, tmp->length, scs); + table->field[4]->set_notnull(); tmp= &yesno[test(hton->savepoint_set)]; table->field[5]->store(tmp->str, tmp->length, scs); + table->field[5]->set_notnull(); if (schema_table_store_record(thd, table)) DBUG_RETURN(1); @@ -3941,8 +3982,12 @@ static my_bool iter_schema_engines(THD *thd, plugin_ref plugin, int fill_schema_engines(THD *thd, TABLE_LIST *tables, COND *cond) { - return plugin_foreach(thd, iter_schema_engines, - MYSQL_STORAGE_ENGINE_PLUGIN, tables->table); + DBUG_ENTER("fill_schema_engines"); + if (plugin_foreach_with_mask(thd, iter_schema_engines, + MYSQL_STORAGE_ENGINE_PLUGIN, + ~PLUGIN_IS_FREED, tables->table)) + DBUG_RETURN(1); + DBUG_RETURN(0); } @@ -5362,7 +5407,7 @@ get_referential_constraints_record(THD *thd, TABLE_LIST *tables, f_key_info->referenced_table->length, cs); if (f_key_info->referenced_key_name) { - table->field[5]->store(f_key_info->referenced_key_name->str, + table->field[5]->store(f_key_info->referenced_key_name->str, f_key_info->referenced_key_name->length, cs); table->field[5]->set_notnull(); } @@ -6139,9 +6184,9 @@ ST_FIELD_INFO engines_fields_info[]= {"ENGINE", 64, MYSQL_TYPE_STRING, 0, 0, "Engine", SKIP_OPEN_TABLE}, {"SUPPORT", 8, MYSQL_TYPE_STRING, 0, 0, "Support", SKIP_OPEN_TABLE}, {"COMMENT", 80, MYSQL_TYPE_STRING, 0, 0, "Comment", SKIP_OPEN_TABLE}, - {"TRANSACTIONS", 3, MYSQL_TYPE_STRING, 0, 0, "Transactions", SKIP_OPEN_TABLE}, - {"XA", 3, MYSQL_TYPE_STRING, 0, 0, "XA", SKIP_OPEN_TABLE}, - {"SAVEPOINTS", 3 ,MYSQL_TYPE_STRING, 0, 0, "Savepoints", SKIP_OPEN_TABLE}, + {"TRANSACTIONS", 3, MYSQL_TYPE_STRING, 0, 1, "Transactions", SKIP_OPEN_TABLE}, + {"XA", 3, MYSQL_TYPE_STRING, 0, 1, "XA", SKIP_OPEN_TABLE}, + {"SAVEPOINTS", 3 ,MYSQL_TYPE_STRING, 0, 1, "Savepoints", SKIP_OPEN_TABLE}, {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} }; @@ -6641,7 +6686,7 @@ ST_SCHEMA_TABLE schema_tables[]= {"PROCESSLIST", processlist_fields_info, create_schema_table, fill_schema_processlist, make_old_format, 0, -1, -1, 0, 0}, {"PROFILING", query_profile_statistics_info, create_schema_table, - fill_query_profile_statistics_info, make_profile_table_for_show, + fill_query_profile_statistics_info, make_profile_table_for_show, NULL, -1, -1, false, 0}, {"REFERENTIAL_CONSTRAINTS", referential_constraints_fields_info, create_schema_table, get_all_tables, 0, get_referential_constraints_record, @@ -6656,12 +6701,12 @@ ST_SCHEMA_TABLE schema_tables[]= fill_status, make_old_format, 0, 0, -1, 0, 0}, {"SESSION_VARIABLES", variables_fields_info, create_schema_table, fill_variables, make_old_format, 0, 0, -1, 0, 0}, - {"STATISTICS", stat_fields_info, create_schema_table, + {"STATISTICS", stat_fields_info, create_schema_table, get_all_tables, make_old_format, get_schema_stat_record, 1, 2, 0, OPEN_TABLE_ONLY|OPTIMIZE_I_S_TABLE}, - {"STATUS", variables_fields_info, create_schema_table, fill_status, + {"STATUS", variables_fields_info, create_schema_table, fill_status, make_old_format, 0, 0, -1, 1, 0}, - {"TABLES", tables_fields_info, create_schema_table, + {"TABLES", tables_fields_info, create_schema_table, get_all_tables, make_old_format, get_schema_tables_record, 1, 2, 0, OPTIMIZE_I_S_TABLE}, {"TABLE_CONSTRAINTS", table_constraints_fields_info, create_schema_table, @@ -6677,7 +6722,7 @@ ST_SCHEMA_TABLE schema_tables[]= fill_schema_user_privileges, 0, 0, -1, -1, 0, 0}, {"VARIABLES", variables_fields_info, create_schema_table, fill_variables, make_old_format, 0, 0, -1, 1, 0}, - {"VIEWS", view_fields_info, create_schema_table, + {"VIEWS", view_fields_info, create_schema_table, get_all_tables, 0, get_schema_views_record, 1, 2, 0, OPEN_VIEW_ONLY|OPTIMIZE_I_S_TABLE}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} |