1
diff -ruN a/patch_info/show_patches.info b/patch_info/show_patches.info
2
--- /dev/null 1970-01-01 09:00:00.000000000 +0900
3
+++ b/patch_info/show_patches.info 2010-04-28 15:29:36.000000000 +0900
5
+File=show_patches.patch
14
diff -ruN a/sql/Makefile.am b/sql/Makefile.am
15
--- a/sql/Makefile.am 2010-04-06 23:06:05.000000000 +0900
16
+++ b/sql/Makefile.am 2010-04-28 15:29:36.000000000 +0900
20
BUILT_MAINT_SRC = sql_yacc.cc sql_yacc.h
21
-BUILT_SOURCES = $(BUILT_MAINT_SRC) lex_hash.h link_sources
22
+BUILT_SOURCES = $(BUILT_MAINT_SRC) lex_hash.h patch_info.h link_sources
23
EXTRA_DIST = udf_example.c udf_example.def $(BUILT_MAINT_SRC) \
24
nt_servc.cc nt_servc.h \
25
message.mc message.h message.rc MSG00001.bin \
27
udf_example_la_SOURCES= udf_example.c
28
udf_example_la_LDFLAGS= -module -rpath $(pkglibdir)
30
+patch_info.h: patch_info.h.pl
33
# We might have some stuff not built in this build, but that we want to install
35
$(mkinstalldirs) $(DESTDIR)$(libexecdir) $(DESTDIR)$(pkglibdir)
36
diff -ruN a/sql/Makefile.in b/sql/Makefile.in
37
--- a/sql/Makefile.in 2010-04-06 23:12:51.000000000 +0900
38
+++ b/sql/Makefile.in 2010-04-28 15:29:36.000000000 +0900
40
mysql_tzinfo_to_sql_SOURCES = tztime.cc
41
mysql_tzinfo_to_sql_CXXFLAGS = -DTZINFO2SQL
42
BUILT_MAINT_SRC = sql_yacc.cc sql_yacc.h
43
-BUILT_SOURCES = $(BUILT_MAINT_SRC) lex_hash.h link_sources
44
+BUILT_SOURCES = $(BUILT_MAINT_SRC) lex_hash.h patch_info.h link_sources
45
EXTRA_DIST = udf_example.c udf_example.def $(BUILT_MAINT_SRC) \
46
nt_servc.cc nt_servc.h \
47
message.mc message.h message.rc MSG00001.bin \
49
test ! -f mysqld-debug.sym.gz || $(INSTALL_DATA) mysqld-debug.sym.gz $(DESTDIR)$(pkglibdir)
50
test ! -f mysqld.sym.gz || $(INSTALL_DATA) mysqld.sym.gz $(DESTDIR)$(pkglibdir)
52
+patch_info.h: patch_info.h.pl
55
# Don't update the files from bitkeeper
57
# Tell versions [3.59,3.63) of GNU make to not export all variables.
58
diff -ruN a/sql/lex.h b/sql/lex.h
59
--- a/sql/lex.h 2010-04-06 23:07:01.000000000 +0900
60
+++ b/sql/lex.h 2010-04-28 15:29:36.000000000 +0900
62
{ "PARTITIONING", SYM(PARTITIONING_SYM)},
63
{ "PARTITIONS", SYM(PARTITIONS_SYM)},
64
{ "PASSWORD", SYM(PASSWORD)},
65
+ { "PATCHES", SYM(PATCHES)},
66
{ "PHASE", SYM(PHASE_SYM)},
67
{ "PLUGIN", SYM(PLUGIN_SYM)},
68
{ "PLUGINS", SYM(PLUGINS_SYM)},
69
diff -ruN a/sql/mysql_priv.h b/sql/mysql_priv.h
70
--- a/sql/mysql_priv.h 2010-04-06 23:07:02.000000000 +0900
71
+++ b/sql/mysql_priv.h 2010-04-28 15:29:36.000000000 +0900
73
int mysqld_show_status(THD *thd);
74
int mysqld_show_variables(THD *thd,const char *wild);
75
bool mysqld_show_storage_engines(THD *thd);
76
+bool mysqld_show_patches(THD *thd);
77
bool mysqld_show_authors(THD *thd);
78
bool mysqld_show_contributors(THD *thd);
79
bool mysqld_show_privileges(THD *thd);
80
diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
81
--- a/sql/mysqld.cc 2010-04-06 23:07:02.000000000 +0900
82
+++ b/sql/mysqld.cc 2010-04-28 15:29:36.000000000 +0900
84
{"show_master_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_MASTER_STAT]), SHOW_LONG_STATUS},
85
{"show_new_master", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_NEW_MASTER]), SHOW_LONG_STATUS},
86
{"show_open_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_OPEN_TABLES]), SHOW_LONG_STATUS},
87
+ {"show_patches", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PATCHES]), SHOW_LONG_STATUS},
88
{"show_plugins", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PLUGINS]), SHOW_LONG_STATUS},
89
{"show_privileges", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PRIVILEGES]), SHOW_LONG_STATUS},
91
diff -ruN a/sql/patch_info.h.pl b/sql/patch_info.h.pl
92
--- /dev/null 1970-01-01 09:00:00.000000000 +0900
93
+++ b/sql/patch_info.h.pl 2010-04-28 15:29:36.000000000 +0900
97
+my $patch_info_path = '../patch_info';
102
+if (opendir(PATCH_DIR, $patch_info_path))
104
+ while ((my $file = readdir(PATCH_DIR)))
106
+ open(PATCH_FILE, "<$patch_info_path/$file") || die("Unable to open $patch_info_path/$file ($!)");
109
+ if ($file =~ /^\./)
114
+ while (<PATCH_FILE>)
118
+ my ($key, $value) = split(/\s*=\s*/);
119
+ $fields{lc($key)} = $value;
122
+ $output .= "{\"$fields{'file'}\", \"$fields{'name'}\", \"$fields{'version'}\", \"$fields{'author'}\", \"$fields{'license'}\",\"$fields{'comment'}\"},\n"
128
+/* Copyright (C) 2002-2006 MySQL AB
130
+ This program is free software; you can redistribute it and/or modify
131
+ it under the terms of the GNU General Public License as published by
132
+ the Free Software Foundation; version 2 of the License.
134
+ This program is distributed in the hope that it will be useful,
135
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
136
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
137
+ GNU General Public License for more details.
139
+ You should have received a copy of the GNU General Public License
140
+ along with this program; if not, write to the Free Software
141
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
143
+#ifdef USE_PRAGMA_INTERFACE
144
+#pragma interface /* gcc class implementation */
150
+ const char *version;
151
+ const char *author;
152
+ const char *license;
153
+ const char *comment;
156
+{NULL, NULL, NULL, NULL}
160
diff -ruN a/sql/sp_head.cc b/sql/sp_head.cc
161
--- a/sql/sp_head.cc 2010-04-06 23:07:04.000000000 +0900
162
+++ b/sql/sp_head.cc 2010-04-28 15:29:36.000000000 +0900
164
case SQLCOM_SHOW_MASTER_STAT:
165
case SQLCOM_SHOW_NEW_MASTER:
166
case SQLCOM_SHOW_OPEN_TABLES:
167
+ case SQLCOM_SHOW_PATCHES:
168
case SQLCOM_SHOW_PRIVILEGES:
169
case SQLCOM_SHOW_PROCESSLIST:
170
case SQLCOM_SHOW_PROC_CODE:
171
diff -ruN a/sql/sql_lex.h b/sql/sql_lex.h
172
--- a/sql/sql_lex.h 2010-04-06 23:07:04.000000000 +0900
173
+++ b/sql/sql_lex.h 2010-04-28 15:29:36.000000000 +0900
175
SQLCOM_SHOW_CREATE_TRIGGER,
176
SQLCOM_ALTER_DB_UPGRADE,
177
SQLCOM_SHOW_PROFILE, SQLCOM_SHOW_PROFILES,
178
+ SQLCOM_SHOW_PATCHES,
181
When a command is added here, be sure it's also added in mysqld.cc
182
diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
183
--- a/sql/sql_parse.cc 2010-04-06 23:07:05.000000000 +0900
184
+++ b/sql/sql_parse.cc 2010-04-28 15:29:36.000000000 +0900
185
@@ -3401,6 +3401,9 @@
186
case SQLCOM_SHOW_CONTRIBUTORS:
187
res= mysqld_show_contributors(thd);
189
+ case SQLCOM_SHOW_PATCHES:
190
+ res= mysqld_show_patches(thd);
192
case SQLCOM_SHOW_PRIVILEGES:
193
res= mysqld_show_privileges(thd);
195
diff -ruN a/sql/sql_prepare.cc b/sql/sql_prepare.cc
196
--- a/sql/sql_prepare.cc 2010-04-06 23:07:05.000000000 +0900
197
+++ b/sql/sql_prepare.cc 2010-04-28 15:29:36.000000000 +0900
198
@@ -1919,6 +1919,7 @@
200
case SQLCOM_SHOW_PROCESSLIST:
201
case SQLCOM_SHOW_STORAGE_ENGINES:
202
+ case SQLCOM_SHOW_PATCHES:
203
case SQLCOM_SHOW_PRIVILEGES:
204
case SQLCOM_SHOW_COLUMN_TYPES:
205
case SQLCOM_SHOW_ENGINE_LOGS:
206
diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
207
--- a/sql/sql_show.cc 2010-04-06 23:07:05.000000000 +0900
208
+++ b/sql/sql_show.cc 2010-04-28 15:29:36.000000000 +0900
212
#include "sql_trigger.h"
213
+#include "patch_info.h"
215
#include "contributors.h"
216
#ifdef HAVE_EVENT_SCHEDULER
217
@@ -7209,3 +7210,42 @@
218
status and client connection will be closed.
222
+/***************************************************************************
223
+** List patches built into this release
224
+***************************************************************************/
226
+bool mysqld_show_patches(THD *thd)
228
+ List<Item> field_list;
230
+ Protocol *protocol= thd->protocol;
231
+ DBUG_ENTER("mysqld_show_patches");
233
+ field_list.push_back(new Item_empty_string("File", 255));
234
+ field_list.push_back(new Item_empty_string("Name", 50));
235
+ field_list.push_back(new Item_empty_string("Version", 10));
236
+ field_list.push_back(new Item_empty_string("Author", 50));
237
+ field_list.push_back(new Item_empty_string("License", 50));
238
+ field_list.push_back(new Item_empty_string("Comment", 32));
240
+ if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
243
+ for (i = 0; patches[i].file; i++)
245
+ protocol->prepare_for_resend();
246
+ protocol->store(patches[i].file, system_charset_info);
247
+ protocol->store(patches[i].name, system_charset_info);
248
+ protocol->store(patches[i].version, system_charset_info);
249
+ protocol->store(patches[i].author, system_charset_info);
250
+ protocol->store(patches[i].license, system_charset_info);
251
+ protocol->store(patches[i].comment, system_charset_info);
253
+ if (protocol->write())
258
+ DBUG_RETURN(FALSE);
260
diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy
261
--- a/sql/sql_yacc.yy 2010-04-06 23:07:06.000000000 +0900
262
+++ b/sql/sql_yacc.yy 2010-04-28 15:29:36.000000000 +0900
263
@@ -1056,6 +1056,7 @@
264
%token PARTITIONS_SYM
265
%token PARTITION_SYM /* SQL-2003-R */
271
@@ -10179,6 +10180,11 @@
272
if (prepare_schema_table(YYTHD, lex, 0, SCH_ENGINES))
278
+ lex->sql_command= SQLCOM_SHOW_PATCHES;
280
| opt_storage ENGINES_SYM
283
@@ -11771,6 +11777,7 @@
284
| PARTITIONING_SYM {}