diff -r e5c14a744423 patch_info/show_patches.info --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patch_info/show_patches.info Thu Sep 04 12:47:22 2008 -0700 @@ -0,0 +1,6 @@ +File=show_patches.patch +Name=SHOW PATCHES +Version=1.0 +Author=Jeremy Cole +License=N/A +Comment diff -r e5c14a744423 sql/Makefile.am --- a/sql/Makefile.am Thu Sep 04 12:06:27 2008 -0700 +++ b/sql/Makefile.am Thu Sep 04 12:47:22 2008 -0700 @@ -144,7 +144,7 @@ @DEFS@ BUILT_MAINT_SRC = sql_yacc.cc sql_yacc.h -BUILT_SOURCES = $(BUILT_MAINT_SRC) lex_hash.h link_sources +BUILT_SOURCES = $(BUILT_MAINT_SRC) lex_hash.h patch_info.h link_sources EXTRA_DIST = udf_example.c udf_example.def $(BUILT_MAINT_SRC) \ nt_servc.cc nt_servc.h message.mc CMakeLists.txt \ udf_example.c udf_example.def @@ -179,6 +179,9 @@ udf_example_la_SOURCES= udf_example.c udf_example_la_LDFLAGS= -module -rpath $(pkglibdir) +patch_info.h: patch_info.h.pl + $(PERL) $< > $@ + # We might have some stuff not built in this build, but that we want to install install-exec-hook: $(mkinstalldirs) $(DESTDIR)$(libexecdir) $(DESTDIR)$(pkglibdir) diff -r e5c14a744423 sql/Makefile.in --- a/sql/Makefile.in Thu Sep 04 12:06:27 2008 -0700 +++ b/sql/Makefile.in Thu Sep 04 12:47:22 2008 -0700 @@ -612,7 +612,7 @@ mysql_tzinfo_to_sql_SOURCES = tztime.cc mysql_tzinfo_to_sql_CXXFLAGS = -DTZINFO2SQL BUILT_MAINT_SRC = sql_yacc.cc sql_yacc.h -BUILT_SOURCES = $(BUILT_MAINT_SRC) lex_hash.h link_sources +BUILT_SOURCES = $(BUILT_MAINT_SRC) lex_hash.h patch_info.h link_sources EXTRA_DIST = udf_example.c udf_example.def $(BUILT_MAINT_SRC) \ nt_servc.cc nt_servc.h message.mc CMakeLists.txt \ udf_example.c udf_example.def @@ -1310,6 +1310,9 @@ test ! -f mysqld-debug.sym.gz || $(INSTALL_DATA) mysqld-debug.sym.gz $(DESTDIR)$(pkglibdir) test ! -f mysqld.sym.gz || $(INSTALL_DATA) mysqld.sym.gz $(DESTDIR)$(pkglibdir) +patch_info.h: patch_info.h.pl + $(PERL) $< > $@ + # Don't update the files from bitkeeper %::SCCS/s.% # Tell versions [3.59,3.63) of GNU make to not export all variables. diff -r e5c14a744423 sql/lex.h --- a/sql/lex.h Thu Sep 04 12:06:27 2008 -0700 +++ b/sql/lex.h Thu Sep 04 12:47:22 2008 -0700 @@ -393,6 +393,7 @@ { "PARTITIONING", SYM(PARTITIONING_SYM)}, { "PARTITIONS", SYM(PARTITIONS_SYM)}, { "PASSWORD", SYM(PASSWORD)}, + { "PATCHES", SYM(PATCHES)}, { "PHASE", SYM(PHASE_SYM)}, { "PLUGIN", SYM(PLUGIN_SYM)}, { "PLUGINS", SYM(PLUGINS_SYM)}, diff -r e5c14a744423 sql/mysql_priv.h --- a/sql/mysql_priv.h Thu Sep 04 12:06:27 2008 -0700 +++ b/sql/mysql_priv.h Thu Sep 04 12:47:22 2008 -0700 @@ -1343,6 +1343,7 @@ int mysqld_show_status(THD *thd); int mysqld_show_variables(THD *thd,const char *wild); bool mysqld_show_storage_engines(THD *thd); +bool mysqld_show_patches(THD *thd); bool mysqld_show_authors(THD *thd); bool mysqld_show_contributors(THD *thd); bool mysqld_show_privileges(THD *thd); diff -r e5c14a744423 sql/mysqld.cc --- a/sql/mysqld.cc Thu Sep 04 12:06:27 2008 -0700 +++ b/sql/mysqld.cc Thu Sep 04 12:47:22 2008 -0700 @@ -3072,6 +3072,7 @@ {"show_master_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_MASTER_STAT]), SHOW_LONG_STATUS}, {"show_new_master", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_NEW_MASTER]), SHOW_LONG_STATUS}, {"show_open_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_OPEN_TABLES]), SHOW_LONG_STATUS}, + {"show_patches", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PATCHES]), SHOW_LONG_STATUS}, {"show_plugins", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PLUGINS]), SHOW_LONG_STATUS}, {"show_privileges", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PRIVILEGES]), SHOW_LONG_STATUS}, #ifndef DBUG_OFF diff -r e5c14a744423 sql/patch_info.h.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sql/patch_info.h.pl Thu Sep 04 12:47:22 2008 -0700 @@ -0,0 +1,65 @@ +use strict; + +my $patch_info_path = '../patch_info'; +my $file = ''; +my $output = ''; + + +if (opendir(PATCH_DIR, $patch_info_path)) +{ + while ((my $file = readdir(PATCH_DIR))) + { + open(PATCH_FILE, "<$patch_info_path/$file") || die("Unable to open $patch_info_path/$file ($!)"); + my %fields; + + if ($file =~ /^\./) + { + next; + } + + while () + { + chomp; + + my ($key, $value) = split(/\s*=\s*/); + $fields{lc($key)} = $value; + } + + $output .= "{\"$fields{'file'}\", \"$fields{'name'}\", \"$fields{'version'}\", \"$fields{'author'}\", \"$fields{'license'}\",\"$fields{'comment'}\"},\n" + } +} + +print < field_list; + int i = 0; + Protocol *protocol= thd->protocol; + DBUG_ENTER("mysqld_show_patches"); + + field_list.push_back(new Item_empty_string("File", 255)); + field_list.push_back(new Item_empty_string("Name", 50)); + field_list.push_back(new Item_empty_string("Version", 10)); + field_list.push_back(new Item_empty_string("Author", 50)); + field_list.push_back(new Item_empty_string("License", 50)); + field_list.push_back(new Item_empty_string("Comment", 32)); + + if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) + DBUG_RETURN(TRUE); + + for (i = 0; patches[i].file; i++) + { + protocol->prepare_for_resend(); + protocol->store(patches[i].file, system_charset_info); + protocol->store(patches[i].name, system_charset_info); + protocol->store(patches[i].version, system_charset_info); + protocol->store(patches[i].author, system_charset_info); + protocol->store(patches[i].license, system_charset_info); + protocol->store(patches[i].comment, system_charset_info); + + if (protocol->write()) + DBUG_RETURN(TRUE); + } + + + my_eof(thd); + DBUG_RETURN(FALSE); + +} /*************************************************************************** ** List all table types supported diff -r e5c14a744423 sql/sql_yacc.yy --- a/sql/sql_yacc.yy Thu Sep 04 12:06:27 2008 -0700 +++ b/sql/sql_yacc.yy Thu Sep 04 12:47:22 2008 -0700 @@ -890,6 +890,7 @@ %token PARTITIONS_SYM %token PARTITION_SYM /* SQL-2003-R */ %token PASSWORD +%token PATCHES %token PHASE_SYM %token PLUGINS_SYM %token PLUGIN_SYM @@ -9204,6 +9205,10 @@ WARN_DEPRECATED(yythd, "5.2", "SHOW TABLE TYPES", "'SHOW [STORAGE] ENGINES'"); if (prepare_schema_table(YYTHD, lex, 0, SCH_ENGINES)) MYSQL_YYABORT; + } + | PATCHES + { + Lex->sql_command= SQLCOM_SHOW_PATCHES; } | opt_storage ENGINES_SYM { @@ -10654,6 +10659,7 @@ | PARTITIONING_SYM {} | PARTITIONS_SYM {} | PASSWORD {} + | PATCHES {} | PHASE_SYM {} | PLUGIN_SYM {} | PLUGINS_SYM {}