]>
Commit | Line | Data |
---|---|---|
833f2639 ER |
1 | diff -r a36b98c5e2e3 patch_info/show_patches.info |
2 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
3 | +++ b/patch_info/show_patches.info Mon Sep 08 16:38:33 2008 -0700 | |
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 | |
11 | diff -r a36b98c5e2e3 sql/Makefile.am | |
12 | --- a/sql/Makefile.am Mon Sep 08 16:37:00 2008 -0700 | |
13 | +++ b/sql/Makefile.am Mon Sep 08 16:38:33 2008 -0700 | |
14 | @@ -116,7 +116,7 @@ | |
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 \ | |
21 | message.mc examples/CMakeLists.txt CMakeLists.txt \ | |
22 | udf_example.c udf_example.def | |
23 | @@ -172,6 +172,8 @@ | |
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.% | |
32 | diff -r a36b98c5e2e3 sql/Makefile.in | |
33 | --- a/sql/Makefile.in Mon Sep 08 16:37:00 2008 -0700 | |
34 | +++ b/sql/Makefile.in Mon Sep 08 16:38:33 2008 -0700 | |
35 | @@ -556,7 +556,7 @@ | |
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 \ | |
42 | message.mc examples/CMakeLists.txt CMakeLists.txt \ | |
43 | udf_example.c udf_example.def | |
44 | @@ -1230,6 +1230,9 @@ | |
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. | |
54 | diff -r a36b98c5e2e3 sql/lex.h | |
55 | --- a/sql/lex.h Mon Sep 08 16:37:00 2008 -0700 | |
56 | +++ b/sql/lex.h Mon Sep 08 16:38:33 2008 -0700 | |
57 | @@ -359,6 +359,7 @@ | |
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)}, | |
65 | diff -r a36b98c5e2e3 sql/mysql_priv.h | |
66 | --- a/sql/mysql_priv.h Mon Sep 08 16:37:00 2008 -0700 | |
67 | +++ b/sql/mysql_priv.h Mon Sep 08 16:38:33 2008 -0700 | |
68 | @@ -948,6 +948,7 @@ | |
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); | |
76 | diff -r a36b98c5e2e3 sql/patch_info.h.pl | |
77 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
78 | +++ b/sql/patch_info.h.pl Mon Sep 08 16:38:33 2008 -0700 | |
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 | |
145 | diff -r a36b98c5e2e3 sql/sp_head.cc | |
146 | --- a/sql/sp_head.cc Mon Sep 08 16:37:00 2008 -0700 | |
147 | +++ b/sql/sp_head.cc Mon Sep 08 16:38:33 2008 -0700 | |
148 | @@ -188,6 +188,7 @@ | |
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: | |
156 | diff -r a36b98c5e2e3 sql/sql_lex.h | |
157 | --- a/sql/sql_lex.h Mon Sep 08 16:37:00 2008 -0700 | |
158 | +++ b/sql/sql_lex.h Mon Sep 08 16:38:33 2008 -0700 | |
159 | @@ -81,9 +81,9 @@ | |
160 | SQLCOM_SHOW_SLAVE_HOSTS, SQLCOM_DELETE_MULTI, SQLCOM_UPDATE_MULTI, | |
161 | SQLCOM_SHOW_BINLOG_EVENTS, SQLCOM_SHOW_NEW_MASTER, SQLCOM_DO, | |
162 | SQLCOM_SHOW_WARNS, SQLCOM_EMPTY_QUERY, SQLCOM_SHOW_ERRORS, | |
163 | - SQLCOM_SHOW_COLUMN_TYPES, SQLCOM_SHOW_STORAGE_ENGINES, SQLCOM_SHOW_PRIVILEGES, | |
164 | - SQLCOM_HELP, SQLCOM_CREATE_USER, SQLCOM_DROP_USER, SQLCOM_RENAME_USER, | |
165 | - SQLCOM_REVOKE_ALL, SQLCOM_CHECKSUM, | |
166 | + SQLCOM_SHOW_COLUMN_TYPES, SQLCOM_SHOW_PATCHES, SQLCOM_SHOW_STORAGE_ENGINES, | |
167 | + SQLCOM_SHOW_PRIVILEGES, SQLCOM_HELP, SQLCOM_CREATE_USER, SQLCOM_DROP_USER, | |
168 | + SQLCOM_RENAME_USER, SQLCOM_REVOKE_ALL, SQLCOM_CHECKSUM, | |
169 | SQLCOM_CREATE_PROCEDURE, SQLCOM_CREATE_SPFUNCTION, SQLCOM_CALL, | |
170 | SQLCOM_DROP_PROCEDURE, SQLCOM_ALTER_PROCEDURE,SQLCOM_ALTER_FUNCTION, | |
171 | SQLCOM_SHOW_CREATE_PROC, SQLCOM_SHOW_CREATE_FUNC, | |
172 | diff -r a36b98c5e2e3 sql/sql_parse.cc | |
173 | --- a/sql/sql_parse.cc Mon Sep 08 16:37:00 2008 -0700 | |
174 | +++ b/sql/sql_parse.cc Mon Sep 08 16:38:33 2008 -0700 | |
175 | @@ -3826,6 +3826,9 @@ | |
176 | break; | |
177 | case SQLCOM_SHOW_STORAGE_ENGINES: | |
178 | res= mysqld_show_storage_engines(thd); | |
179 | + break; | |
180 | + case SQLCOM_SHOW_PATCHES: | |
181 | + res= mysqld_show_patches(thd); | |
182 | break; | |
183 | case SQLCOM_SHOW_PRIVILEGES: | |
184 | res= mysqld_show_privileges(thd); | |
185 | diff -r a36b98c5e2e3 sql/sql_prepare.cc | |
186 | --- a/sql/sql_prepare.cc Mon Sep 08 16:37:00 2008 -0700 | |
187 | +++ b/sql/sql_prepare.cc Mon Sep 08 16:38:33 2008 -0700 | |
188 | @@ -1790,6 +1790,7 @@ | |
189 | case SQLCOM_SHOW_DATABASES: | |
190 | case SQLCOM_SHOW_PROCESSLIST: | |
191 | case SQLCOM_SHOW_STORAGE_ENGINES: | |
192 | + case SQLCOM_SHOW_PATCHES: | |
193 | case SQLCOM_SHOW_PRIVILEGES: | |
194 | case SQLCOM_SHOW_COLUMN_TYPES: | |
195 | case SQLCOM_SHOW_STATUS: | |
196 | diff -r a36b98c5e2e3 sql/sql_show.cc | |
197 | --- a/sql/sql_show.cc Mon Sep 08 16:37:00 2008 -0700 | |
198 | +++ b/sql/sql_show.cc Mon Sep 08 16:38:33 2008 -0700 | |
199 | @@ -22,6 +22,7 @@ | |
200 | #include "sp.h" | |
201 | #include "sp_head.h" | |
202 | #include "sql_trigger.h" | |
203 | +#include "patch_info.h" | |
204 | #include <my_dir.h> | |
205 | ||
206 | #ifdef HAVE_BERKELEY_DB | |
207 | @@ -45,6 +46,48 @@ | |
208 | static int | |
209 | view_store_create_info(THD *thd, TABLE_LIST *table, String *buff); | |
210 | static bool schema_table_store_record(THD *thd, TABLE *table); | |
211 | + | |
212 | + | |
213 | +/*************************************************************************** | |
214 | +** List patches built into this release | |
215 | +***************************************************************************/ | |
216 | + | |
217 | +bool mysqld_show_patches(THD *thd) | |
218 | +{ | |
219 | + List<Item> field_list; | |
220 | + int i = 0; | |
221 | + Protocol *protocol= thd->protocol; | |
222 | + DBUG_ENTER("mysqld_show_patches"); | |
223 | + | |
224 | + field_list.push_back(new Item_empty_string("File", 255)); | |
225 | + field_list.push_back(new Item_empty_string("Name", 50)); | |
226 | + field_list.push_back(new Item_empty_string("Version", 10)); | |
227 | + field_list.push_back(new Item_empty_string("Author", 50)); | |
228 | + field_list.push_back(new Item_empty_string("License", 50)); | |
229 | + field_list.push_back(new Item_empty_string("Comment", 32)); | |
230 | + | |
231 | + if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) | |
232 | + DBUG_RETURN(TRUE); | |
233 | + | |
234 | + for (i = 0; patches[i].file; i++) | |
235 | + { | |
236 | + protocol->prepare_for_resend(); | |
237 | + protocol->store(patches[i].file, system_charset_info); | |
238 | + protocol->store(patches[i].name, system_charset_info); | |
239 | + protocol->store(patches[i].version, system_charset_info); | |
240 | + protocol->store(patches[i].author, system_charset_info); | |
241 | + protocol->store(patches[i].license, system_charset_info); | |
242 | + protocol->store(patches[i].comment, system_charset_info); | |
243 | + | |
244 | + if (protocol->write()) | |
245 | + DBUG_RETURN(TRUE); | |
246 | + } | |
247 | + | |
248 | + | |
249 | + send_eof(thd); | |
250 | + DBUG_RETURN(FALSE); | |
251 | + | |
252 | +} | |
253 | ||
254 | ||
255 | /*************************************************************************** | |
256 | diff -r a36b98c5e2e3 sql/sql_yacc.yy | |
257 | --- a/sql/sql_yacc.yy Mon Sep 08 16:37:00 2008 -0700 | |
258 | +++ b/sql/sql_yacc.yy Mon Sep 08 16:38:33 2008 -0700 | |
259 | @@ -816,6 +816,7 @@ | |
260 | %token PACK_KEYS_SYM | |
261 | %token PARTIAL | |
262 | %token PASSWORD | |
263 | +%token PATCHES | |
264 | %token PARAM_MARKER | |
265 | %token PHASE_SYM | |
266 | %token POINTFROMTEXT | |
267 | @@ -7948,7 +7949,7 @@ | |
268 | ; | |
269 | ||
270 | show_param: | |
271 | - DATABASES wild_and_where | |
272 | + DATABASES wild_and_where | |
273 | { | |
274 | LEX *lex= Lex; | |
275 | lex->sql_command= SQLCOM_SELECT; | |
276 | @@ -8048,6 +8049,10 @@ | |
277 | LEX *lex=Lex; | |
278 | lex->sql_command= SQLCOM_SHOW_STORAGE_ENGINES; | |
279 | WARN_DEPRECATED("SHOW TABLE TYPES", "SHOW [STORAGE] ENGINES"); | |
280 | + } | |
281 | + | PATCHES | |
282 | + { | |
283 | + Lex->sql_command= SQLCOM_SHOW_PATCHES; | |
284 | } | |
285 | | opt_storage ENGINES_SYM | |
286 | { | |
287 | @@ -9466,6 +9471,7 @@ | |
288 | | PACK_KEYS_SYM {} | |
289 | | PARTIAL {} | |
290 | | PASSWORD {} | |
291 | + | PATCHES {} | |
292 | | PHASE_SYM {} | |
293 | | POINT_SYM {} | |
294 | | POLYGON {} |