]>
Commit | Line | Data |
---|---|---|
36400f81 | 1 | diff -ruN /dev/null b/patch_info/show_patches.info |
833f2639 | 2 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
6f73e838 | 3 | +++ b/patch_info/show_patches.info Mon Dec 22 00:25:06 2008 -0800 |
833f2639 ER |
4 | @@ -0,0 +1,6 @@ |
5 | +File=show_patches.patch | |
6 | +Name=SHOW PATCHES | |
7 | +Version=1.0 | |
8 | +Author=Jeremy Cole | |
9 | +License=N/A | |
10 | +Comment | |
36400f81 | 11 | diff -ruN a/sql/Makefile.am b/sql/Makefile.am |
6f73e838 ER |
12 | --- a/sql/Makefile.am Mon Dec 22 00:20:06 2008 -0800 |
13 | +++ b/sql/Makefile.am Mon Dec 22 00:25:06 2008 -0800 | |
14 | @@ -118,7 +118,7 @@ | |
833f2639 ER |
15 | -DSHAREDIR="\"$(MYSQLSHAREdir)\"" \ |
16 | @DEFS@ | |
17 | ||
18 | -BUILT_SOURCES = sql_yacc.cc sql_yacc.h lex_hash.h | |
19 | +BUILT_SOURCES = sql_yacc.cc sql_yacc.h lex_hash.h patch_info.h | |
20 | EXTRA_DIST = $(BUILT_SOURCES) nt_servc.cc nt_servc.h \ | |
6f73e838 ER |
21 | message.mc message.h message.rc MSG00001.bin \ |
22 | examples/CMakeLists.txt CMakeLists.txt \ | |
23 | @@ -175,6 +175,8 @@ | |
833f2639 ER |
24 | udf_example_la_SOURCES= udf_example.c |
25 | udf_example_la_LDFLAGS= -module -rpath $(pkglibdir) | |
26 | ||
27 | +patch_info.h: patch_info.h.pl | |
28 | + $(PERL) $< > $@ | |
29 | ||
30 | # Don't update the files from bitkeeper | |
31 | %::SCCS/s.% | |
36400f81 | 32 | diff -ruN a/sql/Makefile.in b/sql/Makefile.in |
6f73e838 ER |
33 | --- a/sql/Makefile.in Mon Dec 22 00:20:06 2008 -0800 |
34 | +++ b/sql/Makefile.in Mon Dec 22 00:25:06 2008 -0800 | |
36400f81 | 35 | @@ -566,7 +566,7 @@ |
833f2639 ER |
36 | gen_lex_hash_LDADD = $(LDADD) $(CXXLDFLAGS) |
37 | mysql_tzinfo_to_sql_SOURCES = mysql_tzinfo_to_sql.cc | |
38 | mysql_tzinfo_to_sql_LDADD = @MYSQLD_EXTRA_LDFLAGS@ $(LDADD) $(CXXLDFLAGS) | |
39 | -BUILT_SOURCES = sql_yacc.cc sql_yacc.h lex_hash.h | |
40 | +BUILT_SOURCES = sql_yacc.cc sql_yacc.h lex_hash.h patch_info.h | |
41 | EXTRA_DIST = $(BUILT_SOURCES) nt_servc.cc nt_servc.h \ | |
6f73e838 ER |
42 | message.mc message.h message.rc MSG00001.bin \ |
43 | examples/CMakeLists.txt CMakeLists.txt \ | |
36400f81 | 44 | @@ -1227,6 +1227,9 @@ |
833f2639 ER |
45 | ./gen_lex_hash$(EXEEXT) > $@-t |
46 | $(MV) $@-t $@ | |
47 | ||
48 | +patch_info.h: patch_info.h.pl | |
49 | + $(PERL) $< > $@ | |
50 | + | |
51 | # Don't update the files from bitkeeper | |
52 | %::SCCS/s.% | |
53 | # Tell versions [3.59,3.63) of GNU make to not export all variables. | |
36400f81 | 54 | diff -ruN a/sql/lex.h b/sql/lex.h |
6f73e838 ER |
55 | --- a/sql/lex.h Mon Dec 22 00:20:06 2008 -0800 |
56 | +++ b/sql/lex.h Mon Dec 22 00:25:06 2008 -0800 | |
57 | @@ -367,6 +367,7 @@ | |
833f2639 ER |
58 | { "PACK_KEYS", SYM(PACK_KEYS_SYM)}, |
59 | { "PARTIAL", SYM(PARTIAL)}, | |
60 | { "PASSWORD", SYM(PASSWORD)}, | |
61 | + { "PATCHES", SYM(PATCHES)}, | |
62 | { "PHASE", SYM(PHASE_SYM)}, | |
63 | { "POINT", SYM(POINT_SYM)}, | |
64 | { "POLYGON", SYM(POLYGON)}, | |
36400f81 | 65 | diff -ruN a/sql/mysql_priv.h b/sql/mysql_priv.h |
6f73e838 ER |
66 | --- a/sql/mysql_priv.h Mon Dec 22 00:20:06 2008 -0800 |
67 | +++ b/sql/mysql_priv.h Mon Dec 22 00:25:06 2008 -0800 | |
36400f81 | 68 | @@ -987,6 +987,7 @@ |
833f2639 ER |
69 | int mysqld_show_status(THD *thd); |
70 | int mysqld_show_variables(THD *thd,const char *wild); | |
71 | bool mysqld_show_storage_engines(THD *thd); | |
72 | +bool mysqld_show_patches(THD *thd); | |
73 | bool mysqld_show_privileges(THD *thd); | |
74 | bool mysqld_show_column_types(THD *thd); | |
75 | bool mysqld_help (THD *thd, const char *text); | |
36400f81 | 76 | diff -ruN /dev/null b/sql/patch_info.h.pl |
833f2639 | 77 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
6f73e838 | 78 | +++ b/sql/patch_info.h.pl Mon Dec 22 00:25:06 2008 -0800 |
833f2639 ER |
79 | @@ -0,0 +1,65 @@ |
80 | +use strict; | |
81 | + | |
82 | +my $patch_info_path = '../patch_info'; | |
83 | +my $file = ''; | |
84 | +my $output = ''; | |
85 | + | |
86 | + | |
87 | +if (opendir(PATCH_DIR, $patch_info_path)) | |
88 | +{ | |
89 | + while ((my $file = readdir(PATCH_DIR))) | |
90 | + { | |
91 | + open(PATCH_FILE, "<$patch_info_path/$file") || die("Unable to open $patch_info_path/$file ($!)"); | |
92 | + my %fields; | |
93 | + | |
94 | + if ($file =~ /^\./) | |
95 | + { | |
96 | + next; | |
97 | + } | |
98 | + | |
99 | + while (<PATCH_FILE>) | |
100 | + { | |
101 | + chomp; | |
102 | + | |
103 | + my ($key, $value) = split(/\s*=\s*/); | |
104 | + $fields{lc($key)} = $value; | |
105 | + } | |
106 | + | |
107 | + $output .= "{\"$fields{'file'}\", \"$fields{'name'}\", \"$fields{'version'}\", \"$fields{'author'}\", \"$fields{'license'}\",\"$fields{'comment'}\"},\n" | |
108 | + } | |
109 | +} | |
110 | + | |
111 | +print <<HEADER; | |
112 | + | |
113 | +/* Copyright (C) 2002-2006 MySQL AB | |
114 | + | |
115 | + This program is free software; you can redistribute it and/or modify | |
116 | + it under the terms of the GNU General Public License as published by | |
117 | + the Free Software Foundation; version 2 of the License. | |
118 | + | |
119 | + This program is distributed in the hope that it will be useful, | |
120 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
121 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
122 | + GNU General Public License for more details. | |
123 | + | |
124 | + You should have received a copy of the GNU General Public License | |
125 | + along with this program; if not, write to the Free Software | |
126 | + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ | |
127 | + | |
128 | +#ifdef USE_PRAGMA_INTERFACE | |
129 | +#pragma interface /* gcc class implementation */ | |
130 | +#endif | |
131 | + | |
132 | +struct patch { | |
133 | + const char *file; | |
134 | + const char *name; | |
135 | + const char *version; | |
136 | + const char *author; | |
137 | + const char *license; | |
138 | + const char *comment; | |
139 | +}patches[] = { | |
140 | +$output | |
141 | +{NULL, NULL, NULL, NULL} | |
142 | +}; | |
143 | + | |
144 | +HEADER | |
36400f81 | 145 | diff -ruN a/sql/sp_head.cc b/sql/sp_head.cc |
6f73e838 ER |
146 | --- a/sql/sp_head.cc Mon Dec 22 00:20:06 2008 -0800 |
147 | +++ b/sql/sp_head.cc Mon Dec 22 00:25:06 2008 -0800 | |
148 | @@ -191,6 +191,7 @@ | |
833f2639 ER |
149 | case SQLCOM_SHOW_MUTEX_STATUS: |
150 | case SQLCOM_SHOW_NEW_MASTER: | |
151 | case SQLCOM_SHOW_OPEN_TABLES: | |
152 | + case SQLCOM_SHOW_PATCHES: | |
153 | case SQLCOM_SHOW_PRIVILEGES: | |
154 | case SQLCOM_SHOW_PROCESSLIST: | |
155 | case SQLCOM_SHOW_SLAVE_HOSTS: | |
36400f81 | 156 | diff -ruN a/sql/sql_lex.h b/sql/sql_lex.h |
6f73e838 ER |
157 | --- a/sql/sql_lex.h Mon Dec 22 00:20:06 2008 -0800 |
158 | +++ b/sql/sql_lex.h Mon Dec 22 00:25:06 2008 -0800 | |
159 | @@ -95,6 +95,7 @@ | |
160 | SQLCOM_XA_COMMIT, SQLCOM_XA_ROLLBACK, SQLCOM_XA_RECOVER, | |
161 | SQLCOM_SHOW_PROC_CODE, SQLCOM_SHOW_FUNC_CODE, | |
162 | SQLCOM_SHOW_PROFILE, SQLCOM_SHOW_PROFILES, | |
163 | + SQLCOM_SHOW_PATCHES, | |
164 | ||
165 | /* | |
166 | When a command is added here, be sure it's also added in mysqld.cc | |
36400f81 | 167 | diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc |
6f73e838 ER |
168 | --- a/sql/sql_parse.cc Mon Dec 22 00:20:06 2008 -0800 |
169 | +++ b/sql/sql_parse.cc Mon Dec 22 00:25:06 2008 -0800 | |
36400f81 | 170 | @@ -4081,6 +4081,9 @@ |
833f2639 ER |
171 | case SQLCOM_SHOW_STORAGE_ENGINES: |
172 | res= mysqld_show_storage_engines(thd); | |
36400f81 | 173 | break; |
833f2639 ER |
174 | + case SQLCOM_SHOW_PATCHES: |
175 | + res= mysqld_show_patches(thd); | |
36400f81 | 176 | + break; |
833f2639 ER |
177 | case SQLCOM_SHOW_PRIVILEGES: |
178 | res= mysqld_show_privileges(thd); | |
36400f81 ER |
179 | break; |
180 | diff -ruN a/sql/sql_prepare.cc b/sql/sql_prepare.cc | |
6f73e838 ER |
181 | --- a/sql/sql_prepare.cc Mon Dec 22 00:20:06 2008 -0800 |
182 | +++ b/sql/sql_prepare.cc Mon Dec 22 00:25:06 2008 -0800 | |
833f2639 ER |
183 | @@ -1790,6 +1790,7 @@ |
184 | case SQLCOM_SHOW_DATABASES: | |
185 | case SQLCOM_SHOW_PROCESSLIST: | |
186 | case SQLCOM_SHOW_STORAGE_ENGINES: | |
187 | + case SQLCOM_SHOW_PATCHES: | |
188 | case SQLCOM_SHOW_PRIVILEGES: | |
189 | case SQLCOM_SHOW_COLUMN_TYPES: | |
190 | case SQLCOM_SHOW_STATUS: | |
36400f81 | 191 | diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc |
6f73e838 ER |
192 | --- a/sql/sql_show.cc Mon Dec 22 00:20:06 2008 -0800 |
193 | +++ b/sql/sql_show.cc Mon Dec 22 00:25:06 2008 -0800 | |
833f2639 ER |
194 | @@ -22,6 +22,7 @@ |
195 | #include "sp.h" | |
196 | #include "sp_head.h" | |
197 | #include "sql_trigger.h" | |
198 | +#include "patch_info.h" | |
199 | #include <my_dir.h> | |
200 | ||
201 | #ifdef HAVE_BERKELEY_DB | |
36400f81 | 202 | @@ -46,6 +47,47 @@ |
833f2639 | 203 | view_store_create_info(THD *thd, TABLE_LIST *table, String *buff); |
6f73e838 | 204 | bool schema_table_store_record(THD *thd, TABLE *table); |
36400f81 | 205 | |
833f2639 ER |
206 | +/*************************************************************************** |
207 | +** List patches built into this release | |
208 | +***************************************************************************/ | |
209 | + | |
210 | +bool mysqld_show_patches(THD *thd) | |
211 | +{ | |
212 | + List<Item> field_list; | |
6f73e838 | 213 | + int i = 0; |
833f2639 ER |
214 | + Protocol *protocol= thd->protocol; |
215 | + DBUG_ENTER("mysqld_show_patches"); | |
216 | + | |
217 | + field_list.push_back(new Item_empty_string("File", 255)); | |
218 | + field_list.push_back(new Item_empty_string("Name", 50)); | |
219 | + field_list.push_back(new Item_empty_string("Version", 10)); | |
220 | + field_list.push_back(new Item_empty_string("Author", 50)); | |
221 | + field_list.push_back(new Item_empty_string("License", 50)); | |
222 | + field_list.push_back(new Item_empty_string("Comment", 32)); | |
223 | + | |
224 | + if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) | |
225 | + DBUG_RETURN(TRUE); | |
226 | + | |
6f73e838 ER |
227 | + for (i = 0; patches[i].file; i++) |
228 | + { | |
229 | + protocol->prepare_for_resend(); | |
230 | + protocol->store(patches[i].file, system_charset_info); | |
231 | + protocol->store(patches[i].name, system_charset_info); | |
232 | + protocol->store(patches[i].version, system_charset_info); | |
233 | + protocol->store(patches[i].author, system_charset_info); | |
234 | + protocol->store(patches[i].license, system_charset_info); | |
235 | + protocol->store(patches[i].comment, system_charset_info); | |
833f2639 | 236 | + |
6f73e838 ER |
237 | + if (protocol->write()) |
238 | + DBUG_RETURN(TRUE); | |
239 | + } | |
833f2639 ER |
240 | + |
241 | + | |
242 | + send_eof(thd); | |
243 | + DBUG_RETURN(FALSE); | |
244 | + | |
245 | +} | |
36400f81 | 246 | + |
833f2639 ER |
247 | |
248 | /*************************************************************************** | |
36400f81 ER |
249 | ** List all table types supported |
250 | diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy | |
6f73e838 ER |
251 | --- a/sql/sql_yacc.yy Mon Dec 22 00:20:06 2008 -0800 |
252 | +++ b/sql/sql_yacc.yy Mon Dec 22 00:25:06 2008 -0800 | |
36400f81 | 253 | @@ -858,6 +858,7 @@ |
6f73e838 | 254 | %token PAGE_SYM |
833f2639 ER |
255 | %token PARTIAL |
256 | %token PASSWORD | |
257 | +%token PATCHES | |
258 | %token PARAM_MARKER | |
259 | %token PHASE_SYM | |
260 | %token POINTFROMTEXT | |
36400f81 | 261 | @@ -8060,7 +8061,7 @@ |
833f2639 ER |
262 | ; |
263 | ||
264 | show_param: | |
265 | - DATABASES wild_and_where | |
266 | + DATABASES wild_and_where | |
267 | { | |
268 | LEX *lex= Lex; | |
269 | lex->sql_command= SQLCOM_SELECT; | |
36400f81 | 270 | @@ -8161,6 +8162,10 @@ |
833f2639 ER |
271 | lex->sql_command= SQLCOM_SHOW_STORAGE_ENGINES; |
272 | WARN_DEPRECATED("SHOW TABLE TYPES", "SHOW [STORAGE] ENGINES"); | |
36400f81 | 273 | } |
833f2639 ER |
274 | + | PATCHES |
275 | + { | |
276 | + Lex->sql_command= SQLCOM_SHOW_PATCHES; | |
36400f81 | 277 | + } |
833f2639 ER |
278 | | opt_storage ENGINES_SYM |
279 | { | |
36400f81 ER |
280 | LEX *lex=Lex; |
281 | @@ -9592,6 +9597,7 @@ | |
6f73e838 | 282 | | PAGE_SYM {} |
833f2639 ER |
283 | | PARTIAL {} |
284 | | PASSWORD {} | |
285 | + | PATCHES {} | |
286 | | PHASE_SYM {} | |
287 | | POINT_SYM {} | |
288 | | POLYGON {} |