diff -aur --new-file mysql-5.0.37-orig/sql/lex.h mysql-5.0.37/sql/lex.h --- mysql-5.0.37-orig/sql/lex.h 2007-04-11 22:07:34.000000000 -0700 +++ mysql-5.0.37/sql/lex.h 2007-04-11 23:25:17.000000000 -0700 @@ -367,6 +367,7 @@ { "PACK_KEYS", SYM(PACK_KEYS_SYM)}, { "PARTIAL", SYM(PARTIAL)}, { "PASSWORD", SYM(PASSWORD)}, + { "PATCHES", SYM(PATCHES)}, { "PHASE", SYM(PHASE_SYM)}, { "POINT", SYM(POINT_SYM)}, { "POLYGON", SYM(POLYGON)}, diff -aur --new-file mysql-5.0.37-orig/sql/Makefile.am mysql-5.0.37/sql/Makefile.am --- mysql-5.0.37-orig/sql/Makefile.am 2007-04-11 22:07:34.000000000 -0700 +++ mysql-5.0.37/sql/Makefile.am 2007-04-11 23:25:37.000000000 -0700 @@ -117,7 +117,7 @@ -DSHAREDIR="\"$(MYSQLSHAREdir)\"" \ @DEFS@ -BUILT_SOURCES = sql_yacc.cc sql_yacc.h lex_hash.h +BUILT_SOURCES = sql_yacc.cc sql_yacc.h lex_hash.h patch_info.h EXTRA_DIST = $(BUILT_SOURCES) nt_servc.cc nt_servc.h \ message.mc examples/CMakeLists.txt CMakeLists.txt \ udf_example.c udf_example.def @@ -172,6 +172,8 @@ udf_example_la_SOURCES= udf_example.c udf_example_la_LDFLAGS= -module -rpath $(pkglibdir) +patch_info.h: patch_info.h.pl + $(PERL) $< > $@ # Don't update the files from bitkeeper %::SCCS/s.% diff -aur --new-file mysql-5.0.37-orig/sql/mysql_priv.h mysql-5.0.37/sql/mysql_priv.h --- mysql-5.0.37-orig/sql/mysql_priv.h 2007-04-11 22:07:34.000000000 -0700 +++ mysql-5.0.37/sql/mysql_priv.h 2007-04-11 23:25:17.000000000 -0700 @@ -920,6 +920,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_privileges(THD *thd); bool mysqld_show_column_types(THD *thd); bool mysqld_help (THD *thd, const char *text); diff -aur --new-file mysql-5.0.37-orig/sql/patch_info.h.pl mysql-5.0.37/sql/patch_info.h.pl --- mysql-5.0.37-orig/sql/patch_info.h.pl 1969-12-31 16:00:00.000000000 -0800 +++ mysql-5.0.37/sql/patch_info.h.pl 2007-04-11 23:25:52.000000000 -0700 @@ -0,0 +1,66 @@ + +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{'author'}\", \"$fields{'md5'}\"},\n" + } +} + +print < #ifdef HAVE_BERKELEY_DB @@ -46,6 +47,43 @@ view_store_create_info(THD *thd, TABLE_LIST *table, String *buff); bool schema_table_store_record(THD *thd, TABLE *table); +/*************************************************************************** +** List patches built into this release +***************************************************************************/ + +bool mysqld_show_patches(THD *thd) +{ + List 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("Author", 50)); + field_list.push_back(new Item_empty_string("md5", 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].author, system_charset_info); + protocol->store(patches[i].md5, system_charset_info); + + if (protocol->write()) + DBUG_RETURN(TRUE); + } + + + send_eof(thd); + DBUG_RETURN(FALSE); + +} + /*************************************************************************** ** List all table types supported diff -aur --new-file mysql-5.0.37-orig/sql/sql_yacc.yy mysql-5.0.37/sql/sql_yacc.yy --- mysql-5.0.37-orig/sql/sql_yacc.yy 2007-04-11 22:07:34.000000000 -0700 +++ mysql-5.0.37/sql/sql_yacc.yy 2007-04-11 23:25:17.000000000 -0700 @@ -683,6 +683,7 @@ %token PAGE_SYM %token PARTIAL %token PASSWORD +%token PATCHES %token PARAM_MARKER %token PHASE_SYM %token POINTFROMTEXT @@ -6772,7 +6773,7 @@ ; show_param: - DATABASES wild_and_where + DATABASES wild_and_where { LEX *lex= Lex; lex->sql_command= SQLCOM_SELECT; @@ -6873,6 +6874,10 @@ lex->sql_command= SQLCOM_SHOW_STORAGE_ENGINES; WARN_DEPRECATED("SHOW TABLE TYPES", "SHOW [STORAGE] ENGINES"); } + | PATCHES + { + Lex->sql_command= SQLCOM_SHOW_PATCHES; + } | opt_storage ENGINES_SYM { LEX *lex=Lex; @@ -8113,6 +8118,7 @@ | PAGE_SYM {} | PARTIAL {} | PASSWORD {} + | PATCHES {} | PHASE_SYM {} | POINT_SYM {} | POLYGON {}