diff -r c3e57b0c22c4 patch_info/show_patches.info --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patch_info/show_patches.info Mon Dec 22 00:25:06 2008 -0800 @@ -0,0 +1,6 @@ +File=show_patches.patch +Name=SHOW PATCHES +Version=1.0 +Author=Jeremy Cole +License=N/A +Comment diff -r c3e57b0c22c4 sql/Makefile.am --- a/sql/Makefile.am Mon Dec 22 00:20:06 2008 -0800 +++ b/sql/Makefile.am Mon Dec 22 00:25:06 2008 -0800 @@ -118,7 +118,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 message.h message.rc MSG00001.bin \ examples/CMakeLists.txt CMakeLists.txt \ @@ -175,6 +175,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 -r c3e57b0c22c4 sql/Makefile.in --- a/sql/Makefile.in Mon Dec 22 00:20:06 2008 -0800 +++ b/sql/Makefile.in Mon Dec 22 00:25:06 2008 -0800 @@ -561,7 +561,7 @@ gen_lex_hash_LDADD = $(LDADD) $(CXXLDFLAGS) mysql_tzinfo_to_sql_SOURCES = mysql_tzinfo_to_sql.cc mysql_tzinfo_to_sql_LDADD = @MYSQLD_EXTRA_LDFLAGS@ $(LDADD) $(CXXLDFLAGS) -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 message.h message.rc MSG00001.bin \ examples/CMakeLists.txt CMakeLists.txt \ @@ -1237,6 +1237,9 @@ ./gen_lex_hash$(EXEEXT) > $@-t $(MV) $@-t $@ +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 c3e57b0c22c4 sql/lex.h --- a/sql/lex.h Mon Dec 22 00:20:06 2008 -0800 +++ b/sql/lex.h Mon Dec 22 00:25:06 2008 -0800 @@ -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 -r c3e57b0c22c4 sql/mysql_priv.h --- a/sql/mysql_priv.h Mon Dec 22 00:20:06 2008 -0800 +++ b/sql/mysql_priv.h Mon Dec 22 00:25:06 2008 -0800 @@ -968,6 +968,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 -r c3e57b0c22c4 sql/patch_info.h.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sql/patch_info.h.pl Mon Dec 22 00:25:06 2008 -0800 @@ -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 < #ifdef HAVE_BERKELEY_DB @@ -45,6 +46,47 @@ static int 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("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); + } + + + send_eof(thd); + DBUG_RETURN(FALSE); + +} /*************************************************************************** diff -r c3e57b0c22c4 sql/sql_yacc.yy --- a/sql/sql_yacc.yy Mon Dec 22 00:20:06 2008 -0800 +++ b/sql/sql_yacc.yy Mon Dec 22 00:25:06 2008 -0800 @@ -824,6 +824,7 @@ %token PAGE_SYM %token PARTIAL %token PASSWORD +%token PATCHES %token PARAM_MARKER %token PHASE_SYM %token POINTFROMTEXT @@ -8019,7 +8020,7 @@ ; show_param: - DATABASES wild_and_where + DATABASES wild_and_where { LEX *lex= Lex; lex->sql_command= SQLCOM_SELECT; @@ -8119,6 +8120,10 @@ LEX *lex=Lex; 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 { @@ -9554,6 +9559,7 @@ | PAGE_SYM {} | PARTIAL {} | PASSWORD {} + | PATCHES {} | PHASE_SYM {} | POINT_SYM {} | POLYGON {}