Merge lp:~jaypipes/drizzle/captain into lp:~drizzle-trunk/drizzle/development
- captain
- Merge into development
Status: | Superseded | ||||||||
---|---|---|---|---|---|---|---|---|---|
Proposed branch: | lp:~jaypipes/drizzle/captain | ||||||||
Merge into: | lp:~drizzle-trunk/drizzle/development | ||||||||
Diff against target: | None lines | ||||||||
To merge this branch: | bzr merge lp:~jaypipes/drizzle/captain | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Drizzle Developers | Pending | ||
Review via email: mp+8996@code.launchpad.net |
This proposal has been superseded by a proposal from 2009-07-18.
Commit message
Description of the change
Jay Pipes (jaypipes) wrote : | # |
- 1098. By Brian Aker <brian@gaz>
-
Merge Jay
- 1099. By Brian Aker <brian@gaz>
-
Mege Jay
- 1100. By Brian Aker <brian@gaz>
-
Merge
- 1101. By Brian Aker <brian@gaz>
-
Merge Jay
- 1102. By Brian Aker <brian@gaz>
-
Merge Stewart
- 1103. By Brian Aker <brian@gaz>
-
Removal of all basic MRR
- 1104. By Brian Aker <brian@gaz>
-
Merge of SJ code.
- 1105. By Brian Aker <brian@gaz>
-
Merge Jay
- 1106. By Brian Aker <brian@gaz>
-
Merging Monty (which includes new replication)
- 1107. By Brian Aker <brian@gaz>
-
Collection of Valgrind fixes.
- 1108. By Brian Aker <brian@gaz>
-
Merge of Brian
- 1109. By Brian Aker <brian@gaz>
-
Merge Brian
- 1110. By Brian Aker <brian@gaz>
-
Merge of Monty
- 1111. By Brian Aker <brian@gaz>
-
Merge Brian
- 1112. By Brian Aker <brian@gaz>
-
Merge Jay
- 1113. By Brian Aker <brian@gaz>
-
Merge Monty
- 1114. By Brian Aker <brian@gaz>
-
lcov dead code removal (merge)
- 1115. By Brian Aker <brian@gaz>
-
MErge Jay
- 1116. By Jay Pipes <jpipes@serialcoder>
-
Merges Trond's fix for memory overflow error on Solaris in readdir_r
- 1117. By Jay Pipes <jpipes@serialcoder>
-
Merge Robert's small fix for client/errname.h
- 1118. By Jay Pipes <jpipes@serialcoder>
-
Merge Padraig's fix for Bug 311013
- 1119. By Jay Pipes <jpipes@serialcoder>
-
Merge Padraig's continued cleanup of exec command classes plus a couple merge conflict resolutions...
- 1120. By Jay Pipes <jpipes@serialcoder>
-
Merge with trunk
- 1121. By Jay Pipes <jpipes@serialcoder>
-
Merge Padraig's continued cleanup of execution commands
- 1122. By Jay Pipes <jpipes@serialcoder>
-
Merge trunk
- 1123. By Jay Pipes <jpipes@serialcoder>
-
Merge and resolve conflicts on pandora build fixes.
- 1124. By Jay Pipes <jpipes@serialcoder>
-
Merge Monty's bug fix for 409350. HEAP handler incorrectly does not destroy mutex.
- 1125. By Jay Pipes <jpipes@serialcoder>
-
Merge Padraig's optimizer refactoring around pulling structs into real classes...
- 1126. By Jay Pipes <jpipes@serialcoder>
-
Merge Padraig's refactoring of MY_BITMAP struct to a proper class interface.
- 1127. By Jay Pipes <jpipes@serialcoder>
-
Merge plugin slot reorganization from monty
- 1128. By Jay Pipes <jpipes@serialcoder>
-
Merge Biping's pool of thread plugin improvements.
- 1129. By Jay Pipes <jpipes@serialcoder>
-
Merge Monty's fixes for extended help and plugin initialization
- 1130. By Jay Pipes <jpipes@serialcoder>
-
Merge trunk
- 1131. By Jay Pipes <jpipes@serialcoder>
-
Merge Biping's fix for Solaris std::queue header confusion.
- 1132. By Jay Pipes <jpipes@serialcoder>
-
Merge trunk
- 1133. By Jay Pipes <jpipes@serialcoder>
-
Merge Monty's cast corrections.
- 1134. By Jay Pipes <jpipes@serialcoder>
-
Merge Diego
's fixes and enhancements for logging_x plugins - 1135. By Jay Pipes <jpipes@serialcoder>
-
Merging pandora build fixes with support for automake 1.11
- 1136. By Jay Pipes <jpipes@serialcoder>
-
Merge translations
- 1137. By Jay Pipes <jpipes@serialcoder>
-
Ignore table raw reader
- 1138. By Jay Pipes <jpipes@serialcoder>
-
Merge Padraig's continued cleanup of execution commands.
- 1139. By Jay Pipes <jpipes@serialcoder>
-
Merge pandora build fixes
- 1140. By Jay Pipes <jpipes@serialcoder>
-
Merge trunk
Preview Diff
1 | === modified file 'Makefile.am' |
2 | --- Makefile.am 2009-07-11 19:23:04 +0000 |
3 | +++ Makefile.am 2009-07-17 23:20:36 +0000 |
4 | @@ -128,7 +128,6 @@ |
5 | mysys/charset.cc \ |
6 | mysys/checksum.cc \ |
7 | mysys/default.cc \ |
8 | - mysys/default_modify.cc \ |
9 | mysys/dynamic_array.cc \ |
10 | mysys/errors.cc \ |
11 | mysys/hash.cc \ |
12 | |
13 | === modified file 'client/drizzle.1' |
14 | --- client/drizzle.1 2009-05-23 23:51:18 +0000 |
15 | +++ client/drizzle.1 2009-07-17 17:13:52 +0000 |
16 | @@ -1018,7 +1018,7 @@ |
17 | The |
18 | \fBprompt\fR |
19 | command reconfigures the default |
20 | -mysql> |
21 | +drizzle> |
22 | prompt. The string for defining the prompt can contain the following special sequences. |
23 | .TS |
24 | allbox tab(:); |
25 | @@ -1100,7 +1100,7 @@ |
26 | \\U |
27 | T}:T{ |
28 | Your full |
29 | - \fIuser_name\fR@\fIhost_name\fR |
30 | + \fIuser\fR@\fIhost\fR |
31 | account name |
32 | T} |
33 | T{ |
34 | |
35 | === modified file 'client/drizzledump.1' |
36 | --- client/drizzledump.1 2009-05-23 23:51:18 +0000 |
37 | +++ client/drizzledump.1 2009-07-17 17:13:52 +0000 |
38 | @@ -989,19 +989,20 @@ |
39 | NULL (\fIunknown value\fR) |
40 | T}:T{ |
41 | <field name="\fIcolumn_name\fR" |
42 | - xsi:nil="true" /> |
43 | + xsi:nil="true" /> |
44 | T} |
45 | T{ |
46 | \'' (\fIempty string\fR) |
47 | T}:T{ |
48 | -<field |
49 | - name="\fIcolumn_name\fR"></field> |
50 | +<field name="\fIcolumn_name\fR"> |
51 | +</field> |
52 | T} |
53 | T{ |
54 | \'NULL' (\fIstring value\fR) |
55 | T}:T{ |
56 | -<field |
57 | - name="\fIcolumn_name\fR">NULL</field> |
58 | +<field name="\fIcolumn_name\fR"> |
59 | +NULL |
60 | +</field> |
61 | T} |
62 | .TE |
63 | .sp |
64 | |
65 | === modified file 'config/uncrustify.cfg' |
66 | --- config/uncrustify.cfg 2009-07-10 21:50:02 +0000 |
67 | +++ config/uncrustify.cfg 2009-07-15 21:16:34 +0000 |
68 | @@ -60,8 +60,8 @@ |
69 | nl_create_if_one_liner=false |
70 | nl_create_for_one_liner=false |
71 | nl_create_while_one_liner=false |
72 | -ls_for_split_full=true |
73 | -ls_func_split_full=true |
74 | +ls_for_split_full=false |
75 | +ls_func_split_full=false |
76 | nl_after_multiline_comment=true |
77 | eat_blanks_after_open_brace=true |
78 | eat_blanks_before_close_brace=true |
79 | |
80 | === modified file 'drizzled/Makefile.am' |
81 | --- drizzled/Makefile.am 2009-07-12 18:36:46 +0000 |
82 | +++ drizzled/Makefile.am 2009-07-15 21:47:32 +0000 |
83 | @@ -267,8 +267,11 @@ |
84 | plugin/applier.h \ |
85 | plugin/authentication.h \ |
86 | plugin/error_message_handler.h \ |
87 | + plugin/handle.h \ |
88 | + plugin/library.h \ |
89 | plugin/listen.h \ |
90 | plugin/logging_handler.h \ |
91 | + plugin/manifest.h \ |
92 | plugin/protocol.h \ |
93 | plugin/qcache.h \ |
94 | plugin/replicator.h \ |
95 | |
96 | === modified file 'drizzled/drizzled.cc' |
97 | --- drizzled/drizzled.cc 2009-07-16 19:30:03 +0000 |
98 | +++ drizzled/drizzled.cc 2009-07-18 18:11:42 +0000 |
99 | @@ -2326,10 +2326,7 @@ |
100 | #endif |
101 | |
102 | /* Print out all the options including plugin supplied options */ |
103 | - my_print_help_inc_plugins(my_long_options, sizeof(my_long_options)/sizeof(my_option)); |
104 | - |
105 | - puts(_("\nTo see what values a running Drizzle server is using, type\n" |
106 | - "'drizzleadmin variables' instead of 'drizzled --help'.")); |
107 | + my_print_help_inc_plugins(my_long_options); |
108 | } |
109 | } |
110 | |
111 | |
112 | === modified file 'drizzled/plugin.h' |
113 | --- drizzled/plugin.h 2009-07-07 09:06:29 +0000 |
114 | +++ drizzled/plugin.h 2009-07-15 21:30:33 +0000 |
115 | @@ -31,40 +31,28 @@ |
116 | */ |
117 | |
118 | |
119 | -/* We use the following strings to define licenses for plugins */ |
120 | -enum plugin_license_type { |
121 | - PLUGIN_LICENSE_PROPRIETARY, |
122 | - PLUGIN_LICENSE_GPL, |
123 | - PLUGIN_LICENSE_BSD, |
124 | - PLUGIN_LICENSE_LGPL, |
125 | - PLUGIN_LICENSE_MAX=PLUGIN_LICENSE_LGPL |
126 | -}; |
127 | - |
128 | -const char * const PLUGIN_LICENSE_PROPRIETARY_STRING="PROPRIETARY"; |
129 | -const char * const PLUGIN_LICENSE_GPL_STRING="GPL"; |
130 | -const char * const PLUGIN_LICENSE_BSD_STRING="BSD"; |
131 | -const char * const PLUGIN_LICENSE_LGPL_STRING="LGPL"; |
132 | - |
133 | /* |
134 | Macros for beginning and ending plugin declarations. Between |
135 | drizzle_declare_plugin and drizzle_declare_plugin_end there should |
136 | - be a drizzled_plugin_manifest struct for each plugin to be declared. |
137 | + be a drizzled::plugin::Manifest for each plugin to be declared. |
138 | */ |
139 | |
140 | |
141 | #ifndef DRIZZLE_DYNAMIC_PLUGIN |
142 | #define __DRIZZLE_DECLARE_PLUGIN(NAME, DECLS) \ |
143 | -struct drizzled_plugin_manifest DECLS[]= { |
144 | +drizzled::plugin::Manifest DECLS[]= { |
145 | #else |
146 | #define __DRIZZLE_DECLARE_PLUGIN(NAME, DECLS) \ |
147 | -struct drizzled_plugin_manifest _mysql_plugin_declarations_[]= { |
148 | +drizzled::plugin::Manifest _drizzled_plugin_declaration_[]= { |
149 | #endif |
150 | |
151 | #define drizzle_declare_plugin(NAME) \ |
152 | __DRIZZLE_DECLARE_PLUGIN(NAME, \ |
153 | builtin_ ## NAME ## _plugin) |
154 | |
155 | -#define drizzle_declare_plugin_end ,{0,0,0,0,0,0,0,0,0,0}} |
156 | +#define drizzle_declare_plugin_end ,{0,0,0,0,PLUGIN_LICENSE_GPL,0,0,0,0,0}} |
157 | + |
158 | + |
159 | |
160 | /* |
161 | the following flags are valid for plugin_init() |
162 | |
163 | === added file 'drizzled/plugin/handle.h' |
164 | --- drizzled/plugin/handle.h 1970-01-01 00:00:00 +0000 |
165 | +++ drizzled/plugin/handle.h 2009-07-16 00:24:27 +0000 |
166 | @@ -0,0 +1,68 @@ |
167 | +/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
168 | + * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
169 | + * |
170 | + * Copyright (C) 2009 Sun Microsystems |
171 | + * |
172 | + * This program is free software; you can redistribute it and/or modify |
173 | + * it under the terms of the GNU General Public License as published by |
174 | + * the Free Software Foundation; version 2 of the License. |
175 | + * |
176 | + * This program is distributed in the hope that it will be useful, |
177 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
178 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
179 | + * GNU General Public License for more details. |
180 | + * |
181 | + * You should have received a copy of the GNU General Public License |
182 | + * along with this program; if not, write to the Free Software |
183 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
184 | + */ |
185 | + |
186 | +#ifndef DRIZZLED_PLUGIN_HANDLE_H |
187 | +#define DRIZZLED_PLUGIN_HANDLE_H |
188 | + |
189 | +#include <drizzled/lex_string.h> |
190 | +#include <mysys/my_alloc.h> |
191 | + |
192 | +class sys_var; |
193 | + |
194 | +namespace drizzled |
195 | +{ |
196 | +namespace plugin |
197 | +{ |
198 | + |
199 | +class Manifest; |
200 | +class Library; |
201 | + |
202 | +/* A handle of a plugin */ |
203 | +class Handle |
204 | +{ |
205 | + const std::string name; |
206 | + Manifest *manifest; |
207 | +public: |
208 | + Library *plugin_dl; |
209 | + bool isInited; |
210 | + MEM_ROOT mem_root; /* memory for dynamic plugin structures */ |
211 | + sys_var *system_vars; /* server variables for this plugin */ |
212 | + Handle(Manifest *manifest_arg, Library *library_arg) |
213 | + : name(manifest_arg->name), manifest(manifest_arg), plugin_dl(library_arg), |
214 | + mem_root(), system_vars(NULL) {} |
215 | + |
216 | + Handle(Manifest *manifest_arg) |
217 | + : name(manifest_arg->name), manifest(manifest_arg), plugin_dl(NULL), |
218 | + mem_root(), system_vars(NULL) {} |
219 | + |
220 | + const std::string& getName() const |
221 | + { |
222 | + return name; |
223 | + } |
224 | + |
225 | + const Manifest& getManifest() const |
226 | + { |
227 | + return *manifest; |
228 | + } |
229 | +}; |
230 | + |
231 | +} /* namespace plugin */ |
232 | +} /* namespace drizzled */ |
233 | + |
234 | +#endif /* DRIZZLED_PLUGIN_HANDLE_H */ |
235 | |
236 | === added file 'drizzled/plugin/library.h' |
237 | --- drizzled/plugin/library.h 1970-01-01 00:00:00 +0000 |
238 | +++ drizzled/plugin/library.h 2009-07-15 21:47:32 +0000 |
239 | @@ -0,0 +1,45 @@ |
240 | +/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
241 | + * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
242 | + * |
243 | + * Copyright (C) 2009 Sun Microsystems |
244 | + * |
245 | + * This program is free software; you can redistribute it and/or modify |
246 | + * it under the terms of the GNU General Public License as published by |
247 | + * the Free Software Foundation; version 2 of the License. |
248 | + * |
249 | + * This program is distributed in the hope that it will be useful, |
250 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
251 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
252 | + * GNU General Public License for more details. |
253 | + * |
254 | + * You should have received a copy of the GNU General Public License |
255 | + * along with this program; if not, write to the Free Software |
256 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
257 | + */ |
258 | + |
259 | +#ifndef DRIZZLED_PLUGIN_LIBRARY_H |
260 | +#define DRIZZLED_PLUGIN_LIBRARY_H |
261 | + |
262 | +#include <drizzled/lex_string.h> |
263 | + |
264 | +namespace drizzled |
265 | +{ |
266 | +namespace plugin |
267 | +{ |
268 | + |
269 | +class Manifest; |
270 | + |
271 | +/* A handle for the dynamic library containing a plugin or plugins. */ |
272 | +class Library |
273 | +{ |
274 | +public: |
275 | + LEX_STRING dl; |
276 | + void *handle; |
277 | + Manifest *plugins; |
278 | + Library() : dl(), handle(NULL), plugins(NULL) {} |
279 | +}; |
280 | + |
281 | +} /* namespace plugin */ |
282 | +} /* namespace drizzled */ |
283 | + |
284 | +#endif /* DRIZZLED_PLUGIN_LIBRARY_H */ |
285 | |
286 | === added file 'drizzled/plugin/manifest.h' |
287 | --- drizzled/plugin/manifest.h 1970-01-01 00:00:00 +0000 |
288 | +++ drizzled/plugin/manifest.h 2009-07-16 00:24:27 +0000 |
289 | @@ -0,0 +1,75 @@ |
290 | +/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
291 | + * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
292 | + * |
293 | + * Copyright (C) 2009 Sun Microsystems |
294 | + * |
295 | + * This program is free software; you can redistribute it and/or modify |
296 | + * it under the terms of the GNU General Public License as published by |
297 | + * the Free Software Foundation; version 2 of the License. |
298 | + * |
299 | + * This program is distributed in the hope that it will be useful, |
300 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
301 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
302 | + * GNU General Public License for more details. |
303 | + * |
304 | + * You should have received a copy of the GNU General Public License |
305 | + * along with this program; if not, write to the Free Software |
306 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
307 | + */ |
308 | + |
309 | +#ifndef DRIZZLED_PLUGIN_MANIFEST_H |
310 | +#define DRIZZLED_PLUGIN_MANIFEST_H |
311 | + |
312 | +#include <drizzled/plugin_registry.h> |
313 | + |
314 | +struct st_mysql_show_var; |
315 | +struct st_mysql_sys_var; |
316 | + |
317 | +/* We use the following strings to define licenses for plugins */ |
318 | +enum plugin_license_type { |
319 | + PLUGIN_LICENSE_GPL, |
320 | + PLUGIN_LICENSE_BSD, |
321 | + PLUGIN_LICENSE_LGPL, |
322 | + PLUGIN_LICENSE_PROPRIETARY, |
323 | + PLUGIN_LICENSE_MAX=PLUGIN_LICENSE_LGPL |
324 | +}; |
325 | + |
326 | + |
327 | +namespace drizzled |
328 | +{ |
329 | +namespace plugin |
330 | +{ |
331 | + |
332 | +static const std::string LICENSE_GPL_STRING("GPL"); |
333 | +static const std::string LICENSE_BSD_STRING("BSD"); |
334 | +static const std::string LICENSE_LGPL_STRING("LGPL"); |
335 | +static const std::string LICENSE_PROPRIETARY_STRING("PROPRIETARY"); |
336 | + |
337 | +typedef int (*initialize_func_t)(PluginRegistry &); |
338 | + |
339 | +/** |
340 | + * Plugin Manfiest |
341 | + * |
342 | + * One Manifest is required per plugin library which is to be dlopened |
343 | + * |
344 | + * This is a struct and not a class because it is staticly defined in the |
345 | + * plugin objects and needs to be a POD as it can, or else it won't compile. |
346 | + */ |
347 | +struct Manifest |
348 | +{ |
349 | + const char *name; /* plugin name (for SHOW PLUGINS) */ |
350 | + const char *version; /* plugin version (for SHOW PLUGINS) */ |
351 | + const char *author; /* plugin author (for SHOW PLUGINS) */ |
352 | + const char *descr; /* general descriptive text (for SHOW PLUGINS ) */ |
353 | + plugin_license_type license; /* plugin license (PLUGIN_LICENSE_XXX) */ |
354 | + initialize_func_t init; /* function to invoke when plugin is loaded */ |
355 | + initialize_func_t deinit; /* function to invoke when plugin is unloaded */ |
356 | + st_mysql_show_var *status_vars; |
357 | + st_mysql_sys_var **system_vars; |
358 | + void *reserved1; /* reserved for dependency checking */ |
359 | +}; |
360 | + |
361 | +} /* namespace plugin */ |
362 | +} /* namespace drizzled */ |
363 | + |
364 | +#endif /* DRIZZLED_PLUGIN_MANIFEST_H */ |
365 | |
366 | === modified file 'drizzled/plugin_registry.cc' |
367 | --- drizzled/plugin_registry.cc 2009-06-17 18:39:44 +0000 |
368 | +++ drizzled/plugin_registry.cc 2009-07-16 00:24:27 +0000 |
369 | @@ -45,21 +45,21 @@ |
370 | return the_registry; |
371 | } |
372 | |
373 | -st_plugin_int *PluginRegistry::find(const LEX_STRING *name) |
374 | +drizzled::plugin::Handle *PluginRegistry::find(const LEX_STRING *name) |
375 | { |
376 | string find_str(name->str,name->length); |
377 | transform(find_str.begin(), find_str.end(), find_str.begin(), ::tolower); |
378 | |
379 | - map<string, st_plugin_int *>::iterator map_iter; |
380 | + map<string, drizzled::plugin::Handle *>::iterator map_iter; |
381 | map_iter= plugin_map.find(find_str); |
382 | if (map_iter != plugin_map.end()) |
383 | return (*map_iter).second; |
384 | return(0); |
385 | } |
386 | |
387 | -void PluginRegistry::add(st_plugin_int *plugin) |
388 | +void PluginRegistry::add(drizzled::plugin::Handle *plugin) |
389 | { |
390 | - string add_str(plugin->name.str); |
391 | + string add_str(plugin->getName()); |
392 | transform(add_str.begin(), add_str.end(), |
393 | add_str.begin(), ::tolower); |
394 | |
395 | @@ -67,14 +67,14 @@ |
396 | } |
397 | |
398 | |
399 | -vector<st_plugin_int *> PluginRegistry::get_list(bool active) |
400 | +vector<drizzled::plugin::Handle *> PluginRegistry::get_list(bool active) |
401 | { |
402 | - st_plugin_int *plugin= NULL; |
403 | + drizzled::plugin::Handle *plugin= NULL; |
404 | |
405 | - vector <st_plugin_int *> plugins; |
406 | + vector <drizzled::plugin::Handle *> plugins; |
407 | plugins.reserve(plugin_map.size()); |
408 | |
409 | - map<string, st_plugin_int *>::iterator map_iter; |
410 | + map<string, drizzled::plugin::Handle *>::iterator map_iter; |
411 | for (map_iter= plugin_map.begin(); |
412 | map_iter != plugin_map.end(); |
413 | map_iter++) |
414 | |
415 | === modified file 'drizzled/plugin_registry.h' |
416 | --- drizzled/plugin_registry.h 2009-06-26 06:25:57 +0000 |
417 | +++ drizzled/plugin_registry.h 2009-07-15 21:00:16 +0000 |
418 | @@ -25,7 +25,6 @@ |
419 | #include <vector> |
420 | #include <map> |
421 | |
422 | -struct st_plugin_int; |
423 | class StorageEngine; |
424 | class InfoSchemaTable; |
425 | class Function_builder; |
426 | @@ -40,13 +39,14 @@ |
427 | namespace plugin |
428 | { |
429 | class Replicator; |
430 | +class Handle; |
431 | } |
432 | } |
433 | |
434 | class PluginRegistry |
435 | { |
436 | private: |
437 | - std::map<std::string, st_plugin_int *> |
438 | + std::map<std::string, drizzled::plugin::Handle *> |
439 | plugin_map; |
440 | |
441 | PluginRegistry(const PluginRegistry&); |
442 | @@ -54,11 +54,11 @@ |
443 | PluginRegistry() {} |
444 | |
445 | |
446 | - st_plugin_int *find(const LEX_STRING *name); |
447 | - |
448 | - void add(st_plugin_int *plugin); |
449 | - |
450 | - std::vector<st_plugin_int *> get_list(bool active); |
451 | + drizzled::plugin::Handle *find(const LEX_STRING *name); |
452 | + |
453 | + void add(drizzled::plugin::Handle *plugin); |
454 | + |
455 | + std::vector<drizzled::plugin::Handle *> get_list(bool active); |
456 | static PluginRegistry& getPluginRegistry(); |
457 | |
458 | void add(StorageEngine *engine); |
459 | |
460 | === modified file 'drizzled/sql_plugin.cc' |
461 | --- drizzled/sql_plugin.cc 2009-06-30 21:28:16 +0000 |
462 | +++ drizzled/sql_plugin.cc 2009-07-16 17:37:03 +0000 |
463 | @@ -43,19 +43,21 @@ |
464 | #define REPORT_TO_USER 2 |
465 | |
466 | using namespace std; |
467 | +using namespace drizzled; |
468 | +using namespace drizzled::plugin; |
469 | |
470 | -typedef struct drizzled_plugin_manifest builtin_plugin[]; |
471 | +typedef Manifest builtin_plugin[]; |
472 | extern builtin_plugin DRIZZLED_BUILTIN_LIST; |
473 | -static drizzled_plugin_manifest *drizzled_builtins[]= |
474 | +static Manifest *drizzled_builtins[]= |
475 | { |
476 | - DRIZZLED_BUILTIN_LIST,(struct drizzled_plugin_manifest *)0 |
477 | + DRIZZLED_BUILTIN_LIST,(Manifest *)0 |
478 | }; |
479 | |
480 | char *opt_plugin_load= NULL; |
481 | const char *opt_plugin_load_default= QUOTE_ARG(DRIZZLED_PLUGIN_LIST); |
482 | char *opt_plugin_dir_ptr; |
483 | char opt_plugin_dir[FN_REFLEN]; |
484 | -static const char *plugin_declarations_sym= "_mysql_plugin_declarations_"; |
485 | +static const char *plugin_declarations_sym= "_drizzled_plugin_declaration_"; |
486 | |
487 | /* Note that 'int version' must be the first field of every plugin |
488 | sub-structure (plugin->info). |
489 | @@ -122,7 +124,7 @@ |
490 | class sys_var_pluginvar: public sys_var |
491 | { |
492 | public: |
493 | - struct st_plugin_int *plugin; |
494 | + Handle *plugin; |
495 | struct st_mysql_sys_var *plugin_var; |
496 | |
497 | static void *operator new(size_t size, MEM_ROOT *mem_root) |
498 | @@ -154,10 +156,10 @@ |
499 | /* prototypes */ |
500 | static bool plugin_load_list(MEM_ROOT *tmp_root, int *argc, char **argv, |
501 | const char *list); |
502 | -static int test_plugin_options(MEM_ROOT *, struct st_plugin_int *, |
503 | +static int test_plugin_options(MEM_ROOT *, Handle *, |
504 | int *, char **); |
505 | -static bool register_builtin(struct st_plugin_int *, |
506 | - struct st_plugin_int **); |
507 | +static bool register_builtin(Handle *, |
508 | + Handle **); |
509 | static void unlock_variables(Session *session, struct system_variables *vars); |
510 | static void cleanup_variables(Session *session, struct system_variables *vars); |
511 | static void plugin_vars_free_values(sys_var *vars); |
512 | @@ -236,14 +238,14 @@ |
513 | Plugin support code |
514 | ****************************************************************************/ |
515 | |
516 | -static struct st_plugin_dl *plugin_dl_find(const LEX_STRING *dl) |
517 | +static Library *plugin_dl_find(const LEX_STRING *dl) |
518 | { |
519 | uint32_t i; |
520 | - struct st_plugin_dl *tmp; |
521 | + Library *tmp; |
522 | |
523 | for (i= 0; i < plugin_dl_array.elements; i++) |
524 | { |
525 | - tmp= *dynamic_element(&plugin_dl_array, i, struct st_plugin_dl **); |
526 | + tmp= *dynamic_element(&plugin_dl_array, i, Library **); |
527 | if (! my_strnncoll(files_charset_info, |
528 | (const unsigned char *)dl->str, dl->length, |
529 | (const unsigned char *)tmp->dl.str, tmp->dl.length)) |
530 | @@ -252,29 +254,29 @@ |
531 | return(0); |
532 | } |
533 | |
534 | -static st_plugin_dl *plugin_dl_insert_or_reuse(struct st_plugin_dl *plugin_dl) |
535 | +static Library *plugin_dl_insert_or_reuse(Library *plugin_dl) |
536 | { |
537 | uint32_t i; |
538 | - struct st_plugin_dl *tmp; |
539 | + Library *tmp; |
540 | |
541 | for (i= 0; i < plugin_dl_array.elements; i++) |
542 | { |
543 | - tmp= *dynamic_element(&plugin_dl_array, i, struct st_plugin_dl **); |
544 | + tmp= *dynamic_element(&plugin_dl_array, i, Library **); |
545 | { |
546 | - memcpy(tmp, plugin_dl, sizeof(struct st_plugin_dl)); |
547 | + memcpy(tmp, plugin_dl, sizeof(Library)); |
548 | return(tmp); |
549 | } |
550 | } |
551 | if (insert_dynamic(&plugin_dl_array, (unsigned char*)&plugin_dl)) |
552 | return(0); |
553 | tmp= *dynamic_element(&plugin_dl_array, plugin_dl_array.elements - 1, |
554 | - struct st_plugin_dl **)= |
555 | - (struct st_plugin_dl *) memdup_root(&plugin_mem_root, (unsigned char*)plugin_dl, |
556 | - sizeof(struct st_plugin_dl)); |
557 | + Library **)= |
558 | + (Library *) memdup_root(&plugin_mem_root, (unsigned char*)plugin_dl, |
559 | + sizeof(Library)); |
560 | return(tmp); |
561 | } |
562 | |
563 | -static inline void free_plugin_mem(struct st_plugin_dl *p) |
564 | +static inline void free_plugin_mem(Library *p) |
565 | { |
566 | if (p->handle) |
567 | dlclose(p->handle); |
568 | @@ -282,11 +284,11 @@ |
569 | } |
570 | |
571 | |
572 | -static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report) |
573 | +static Library *plugin_dl_add(const LEX_STRING *dl, int report) |
574 | { |
575 | string dlpath; |
576 | uint32_t plugin_dir_len; |
577 | - struct st_plugin_dl *tmp, plugin_dl; |
578 | + Library *tmp, plugin_dl; |
579 | void *sym; |
580 | plugin_dir_len= strlen(opt_plugin_dir); |
581 | dlpath.reserve(FN_REFLEN); |
582 | @@ -345,7 +347,7 @@ |
583 | return(0); |
584 | } |
585 | |
586 | - plugin_dl.plugins= (struct drizzled_plugin_manifest *)sym; |
587 | + plugin_dl.plugins= static_cast<Manifest *>(sym); |
588 | |
589 | /* Duplicate and convert dll name */ |
590 | plugin_dl.dl.length= dl->length * files_charset_info->mbmaxlen + 1; |
591 | @@ -364,9 +366,9 @@ |
592 | { |
593 | free_plugin_mem(&plugin_dl); |
594 | if (report & REPORT_TO_USER) |
595 | - my_error(ER_OUTOFMEMORY, MYF(0), sizeof(struct st_plugin_dl)); |
596 | + my_error(ER_OUTOFMEMORY, MYF(0), sizeof(Library)); |
597 | if (report & REPORT_TO_LOG) |
598 | - errmsg_printf(ERRMSG_LVL_ERROR, ER(ER_OUTOFMEMORY), sizeof(struct st_plugin_dl)); |
599 | + errmsg_printf(ERRMSG_LVL_ERROR, ER(ER_OUTOFMEMORY), sizeof(Library)); |
600 | return(0); |
601 | } |
602 | return(tmp); |
603 | @@ -379,8 +381,8 @@ |
604 | |
605 | for (i= 0; i < plugin_dl_array.elements; i++) |
606 | { |
607 | - struct st_plugin_dl *tmp= *dynamic_element(&plugin_dl_array, i, |
608 | - struct st_plugin_dl **); |
609 | + Library *tmp= *dynamic_element(&plugin_dl_array, i, |
610 | + Library **); |
611 | if (! my_strnncoll(files_charset_info, |
612 | (const unsigned char *)dl->str, dl->length, |
613 | (const unsigned char *)tmp->dl.str, tmp->dl.length)) |
614 | @@ -388,7 +390,7 @@ |
615 | /* Do not remove this element, unless no other plugin uses this dll. */ |
616 | { |
617 | free_plugin_mem(tmp); |
618 | - memset(tmp, 0, sizeof(struct st_plugin_dl)); |
619 | + memset(tmp, 0, sizeof(Library)); |
620 | } |
621 | break; |
622 | } |
623 | @@ -398,16 +400,13 @@ |
624 | |
625 | |
626 | |
627 | -static st_plugin_int *plugin_insert_or_reuse(struct st_plugin_int *plugin) |
628 | +static Handle *plugin_insert_or_reuse(Handle *plugin) |
629 | { |
630 | - struct st_plugin_int *tmp; |
631 | if (insert_dynamic(&plugin_array, (unsigned char*)&plugin)) |
632 | return(0); |
633 | - tmp= *dynamic_element(&plugin_array, plugin_array.elements - 1, |
634 | - struct st_plugin_int **)= |
635 | - (struct st_plugin_int *) memdup_root(&plugin_mem_root, (unsigned char*)plugin, |
636 | - sizeof(struct st_plugin_int)); |
637 | - return(tmp); |
638 | + plugin= *dynamic_element(&plugin_array, plugin_array.elements - 1, |
639 | + Handle **); |
640 | + return(plugin); |
641 | } |
642 | |
643 | |
644 | @@ -421,8 +420,7 @@ |
645 | { |
646 | PluginRegistry ®istry= PluginRegistry::getPluginRegistry(); |
647 | |
648 | - struct st_plugin_int tmp; |
649 | - struct drizzled_plugin_manifest *plugin; |
650 | + Manifest *manifest; |
651 | if (! initialized) |
652 | return(0); |
653 | |
654 | @@ -434,34 +432,32 @@ |
655 | errmsg_printf(ERRMSG_LVL_ERROR, ER(ER_UDF_EXISTS), name->str); |
656 | return(true); |
657 | } |
658 | - /* Clear the whole struct to catch future extensions. */ |
659 | - memset(&tmp, 0, sizeof(tmp)); |
660 | - if (! (tmp.plugin_dl= plugin_dl_add(dl, report))) |
661 | - return(true); |
662 | + Library *library= plugin_dl_add(dl, report); |
663 | + if (library == NULL) |
664 | + return true; |
665 | + |
666 | + Handle *tmp= NULL; |
667 | /* Find plugin by name */ |
668 | - for (plugin= tmp.plugin_dl->plugins; plugin->name; plugin++) |
669 | + for (manifest= library->plugins; manifest->name; manifest++) |
670 | { |
671 | - uint32_t name_len= strlen(plugin->name); |
672 | if (! my_strnncoll(system_charset_info, |
673 | (const unsigned char *)name->str, name->length, |
674 | - (const unsigned char *)plugin->name, |
675 | - name_len)) |
676 | + (const unsigned char *)manifest->name, |
677 | + strlen(manifest->name))) |
678 | { |
679 | - struct st_plugin_int *tmp_plugin_ptr; |
680 | + tmp= new (std::nothrow) Handle(manifest, library); |
681 | + if (tmp == NULL) |
682 | + return true; |
683 | |
684 | - tmp.plugin= plugin; |
685 | - tmp.name.str= (char *)plugin->name; |
686 | - tmp.name.length= name_len; |
687 | - tmp.isInited= false; |
688 | - if (!test_plugin_options(tmp_root, &tmp, argc, argv)) |
689 | + if (!test_plugin_options(tmp_root, tmp, argc, argv)) |
690 | { |
691 | - if ((tmp_plugin_ptr= plugin_insert_or_reuse(&tmp))) |
692 | + if ((tmp= plugin_insert_or_reuse(tmp))) |
693 | { |
694 | - registry.add(tmp_plugin_ptr); |
695 | - init_alloc_root(&tmp_plugin_ptr->mem_root, 4096, 4096); |
696 | + registry.add(tmp); |
697 | + init_alloc_root(&tmp->mem_root, 4096, 4096); |
698 | return(false); |
699 | } |
700 | - mysql_del_sys_var_chain(tmp.system_vars); |
701 | + mysql_del_sys_var_chain(tmp->system_vars); |
702 | goto err; |
703 | } |
704 | /* plugin was disabled */ |
705 | @@ -479,18 +475,18 @@ |
706 | } |
707 | |
708 | |
709 | -static void plugin_del(struct st_plugin_int *plugin) |
710 | +static void plugin_del(Handle *plugin) |
711 | { |
712 | PluginRegistry ®istry= PluginRegistry::getPluginRegistry(); |
713 | if (plugin->isInited) |
714 | { |
715 | - if (plugin->plugin->status_vars) |
716 | + if (plugin->getManifest().status_vars) |
717 | { |
718 | - remove_status_vars(plugin->plugin->status_vars); |
719 | + remove_status_vars(plugin->getManifest().status_vars); |
720 | } |
721 | |
722 | - if (plugin->plugin->deinit) |
723 | - plugin->plugin->deinit(registry); |
724 | + if (plugin->getManifest().deinit) |
725 | + plugin->getManifest().deinit(registry); |
726 | } |
727 | |
728 | /* Free allocated strings before deleting the plugin. */ |
729 | @@ -501,44 +497,44 @@ |
730 | pthread_rwlock_wrlock(&LOCK_system_variables_hash); |
731 | mysql_del_sys_var_chain(plugin->system_vars); |
732 | pthread_rwlock_unlock(&LOCK_system_variables_hash); |
733 | - free_root(&plugin->mem_root, MYF(0)); |
734 | + delete plugin; |
735 | } |
736 | |
737 | static void reap_plugins(void) |
738 | { |
739 | size_t count; |
740 | uint32_t idx; |
741 | - struct st_plugin_int *plugin; |
742 | + drizzled::plugin::Handle *plugin; |
743 | |
744 | count= plugin_array.elements; |
745 | |
746 | for (idx= 0; idx < count; idx++) |
747 | { |
748 | - plugin= *dynamic_element(&plugin_array, idx, struct st_plugin_int **); |
749 | + plugin= *dynamic_element(&plugin_array, idx, drizzled::plugin::Handle **); |
750 | plugin_del(plugin); |
751 | } |
752 | } |
753 | |
754 | -static bool plugin_initialize(struct st_plugin_int *plugin) |
755 | +static bool plugin_initialize(drizzled::plugin::Handle *plugin) |
756 | { |
757 | assert(plugin->isInited == false); |
758 | |
759 | PluginRegistry ®istry= PluginRegistry::getPluginRegistry(); |
760 | - if (plugin->plugin->init) |
761 | + if (plugin->getManifest().init) |
762 | { |
763 | - if (plugin->plugin->init(registry)) |
764 | + if (plugin->getManifest().init(registry)) |
765 | { |
766 | errmsg_printf(ERRMSG_LVL_ERROR, |
767 | _("Plugin '%s' init function returned error.\n"), |
768 | - plugin->name.str); |
769 | + plugin->getName().c_str()); |
770 | goto err; |
771 | } |
772 | } |
773 | plugin->isInited= true; |
774 | |
775 | - if (plugin->plugin->status_vars) |
776 | + if (plugin->getManifest().status_vars) |
777 | { |
778 | - add_status_vars(plugin->plugin->status_vars); // add_status_vars makes a copy |
779 | + add_status_vars(plugin->getManifest().status_vars); // add_status_vars makes a copy |
780 | } |
781 | |
782 | /* |
783 | @@ -584,9 +580,9 @@ |
784 | int plugin_init(int *argc, char **argv, int flags) |
785 | { |
786 | uint32_t idx; |
787 | - struct drizzled_plugin_manifest **builtins; |
788 | - struct drizzled_plugin_manifest *plugin; |
789 | - struct st_plugin_int tmp, *plugin_ptr; |
790 | + Manifest **builtins; |
791 | + Manifest *manifest; |
792 | + Handle *handle; |
793 | MEM_ROOT tmp_root; |
794 | |
795 | if (initialized) |
796 | @@ -601,9 +597,9 @@ |
797 | |
798 | |
799 | if (my_init_dynamic_array(&plugin_dl_array, |
800 | - sizeof(struct st_plugin_dl *),16,16) || |
801 | + sizeof(Library *),16,16) || |
802 | my_init_dynamic_array(&plugin_array, |
803 | - sizeof(struct st_plugin_int *),16,16)) |
804 | + sizeof(Handle *),16,16)) |
805 | goto err; |
806 | |
807 | initialized= 1; |
808 | @@ -613,21 +609,20 @@ |
809 | */ |
810 | for (builtins= drizzled_builtins; *builtins; builtins++) |
811 | { |
812 | - for (plugin= *builtins; plugin->name; plugin++) |
813 | + for (manifest= *builtins; manifest->name; manifest++) |
814 | { |
815 | - memset(&tmp, 0, sizeof(tmp)); |
816 | - tmp.plugin= plugin; |
817 | - tmp.name.str= (char *)plugin->name; |
818 | - tmp.name.length= strlen(plugin->name); |
819 | + handle= new (std::nothrow) Handle(manifest); |
820 | + if (handle == NULL) |
821 | + return true; |
822 | |
823 | free_root(&tmp_root, MYF(MY_MARK_BLOCKS_FREE)); |
824 | - if (test_plugin_options(&tmp_root, &tmp, argc, argv)) |
825 | + if (test_plugin_options(&tmp_root, handle, argc, argv)) |
826 | continue; |
827 | |
828 | - if (register_builtin(&tmp, &plugin_ptr)) |
829 | + if (register_builtin(handle, &handle)) |
830 | goto err_unlock; |
831 | |
832 | - if (plugin_initialize(plugin_ptr)) |
833 | + if (plugin_initialize(handle)) |
834 | goto err_unlock; |
835 | |
836 | } |
837 | @@ -649,11 +644,11 @@ |
838 | */ |
839 | for (idx= 0; idx < plugin_array.elements; idx++) |
840 | { |
841 | - plugin_ptr= *dynamic_element(&plugin_array, idx, struct st_plugin_int **); |
842 | - if (plugin_ptr->isInited == false) |
843 | + handle= *dynamic_element(&plugin_array, idx, Handle **); |
844 | + if (handle->isInited == false) |
845 | { |
846 | - if (plugin_initialize(plugin_ptr)) |
847 | - plugin_del(plugin_ptr); |
848 | + if (plugin_initialize(handle)) |
849 | + plugin_del(handle); |
850 | } |
851 | } |
852 | |
853 | @@ -670,8 +665,8 @@ |
854 | } |
855 | |
856 | |
857 | -static bool register_builtin(struct st_plugin_int *tmp, |
858 | - struct st_plugin_int **ptr) |
859 | +static bool register_builtin(Handle *tmp, |
860 | + Handle **ptr) |
861 | { |
862 | |
863 | PluginRegistry ®istry= PluginRegistry::getPluginRegistry(); |
864 | @@ -683,9 +678,7 @@ |
865 | return(1); |
866 | |
867 | *ptr= *dynamic_element(&plugin_array, plugin_array.elements - 1, |
868 | - struct st_plugin_int **)= |
869 | - (struct st_plugin_int *) memdup_root(&plugin_mem_root, (unsigned char*)tmp, |
870 | - sizeof(struct st_plugin_int)); |
871 | + Handle **); |
872 | |
873 | registry.add(*ptr); |
874 | |
875 | @@ -701,8 +694,8 @@ |
876 | { |
877 | char buffer[FN_REFLEN]; |
878 | LEX_STRING name= {buffer, 0}, dl= {NULL, 0}, *str= &name; |
879 | - struct st_plugin_dl *plugin_dl; |
880 | - struct drizzled_plugin_manifest *plugin; |
881 | + Library *plugin_dl; |
882 | + Manifest *plugin; |
883 | char *p= buffer; |
884 | while (list) |
885 | { |
886 | @@ -778,8 +771,8 @@ |
887 | { |
888 | uint32_t idx; |
889 | size_t count= plugin_array.elements; |
890 | - vector<st_plugin_int *> plugins; |
891 | - vector<st_plugin_dl *> dl; |
892 | + vector<Handle *> plugins; |
893 | + vector<Library *> dl; |
894 | |
895 | if (initialized) |
896 | { |
897 | @@ -803,7 +796,7 @@ |
898 | dl.reserve(count); |
899 | for (idx= 0; idx < count; idx++) |
900 | dl.push_back(*dynamic_element(&plugin_dl_array, idx, |
901 | - struct st_plugin_dl **)); |
902 | + Library **)); |
903 | for (idx= 0; idx < count; idx++) |
904 | free_plugin_mem(dl[idx]); |
905 | delete_dynamic(&plugin_dl_array); |
906 | @@ -1123,7 +1116,7 @@ |
907 | { |
908 | sys_var *var; |
909 | sys_var_pluginvar *pi= NULL; |
910 | - st_plugin_int *plugin; |
911 | + Handle *plugin; |
912 | |
913 | pthread_rwlock_rdlock(&LOCK_system_variables_hash); |
914 | if ((var= intern_find_sys_var(str, length, false)) && |
915 | @@ -1867,10 +1860,10 @@ |
916 | } |
917 | |
918 | |
919 | -static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp, |
920 | +static int construct_options(MEM_ROOT *mem_root, Handle *tmp, |
921 | my_option *options, bool can_disable) |
922 | { |
923 | - const char *plugin_name= tmp->plugin->name; |
924 | + const char *plugin_name= tmp->getManifest().name; |
925 | uint32_t namelen= strlen(plugin_name), optnamelen; |
926 | uint32_t buffer_length= namelen * 4 + (can_disable ? 75 : 10); |
927 | char *name= (char*) alloc_root(mem_root, buffer_length) + 1; |
928 | @@ -1916,7 +1909,7 @@ |
929 | by my_getopt and register_var() in the first pass uses realloc |
930 | */ |
931 | |
932 | - for (plugin_option= tmp->plugin->system_vars; |
933 | + for (plugin_option= tmp->getManifest().system_vars; |
934 | plugin_option && *plugin_option; plugin_option++, index++) |
935 | { |
936 | opt= *plugin_option; |
937 | @@ -1953,7 +1946,7 @@ |
938 | }; |
939 | } |
940 | |
941 | - for (plugin_option= tmp->plugin->system_vars; |
942 | + for (plugin_option= tmp->getManifest().system_vars; |
943 | plugin_option && *plugin_option; plugin_option++, index++) |
944 | { |
945 | switch ((opt= *plugin_option)->flags & PLUGIN_VAR_TYPEMASK) { |
946 | @@ -2082,24 +2075,24 @@ |
947 | } |
948 | |
949 | |
950 | -static my_option *construct_help_options(MEM_ROOT *mem_root, |
951 | - struct st_plugin_int *p) |
952 | +static my_option *construct_help_options(MEM_ROOT *mem_root, Handle *p) |
953 | { |
954 | st_mysql_sys_var **opt; |
955 | my_option *opts; |
956 | bool can_disable; |
957 | uint32_t count= EXTRA_OPTIONS; |
958 | |
959 | - for (opt= p->plugin->system_vars; opt && *opt; opt++, count+= 2) {}; |
960 | + for (opt= p->getManifest().system_vars; opt && *opt; opt++, count+= 2) {}; |
961 | |
962 | - if (!(opts= (my_option*) alloc_root(mem_root, sizeof(my_option) * count))) |
963 | + opts= (my_option*)alloc_root(mem_root, (sizeof(my_option) * count)); |
964 | + if (opts == NULL) |
965 | return NULL; |
966 | |
967 | memset(opts, 0, sizeof(my_option) * count); |
968 | |
969 | - if ((my_strcasecmp(&my_charset_utf8_general_ci, p->name.str, "MyISAM") == 0)) |
970 | + if ((my_strcasecmp(&my_charset_utf8_general_ci, p->getName().c_str(), "MyISAM") == 0)) |
971 | can_disable= false; |
972 | - else if ((my_strcasecmp(&my_charset_utf8_general_ci, p->name.str, "MEMORY") == 0)) |
973 | + else if ((my_strcasecmp(&my_charset_utf8_general_ci, p->getName().c_str(), "MEMORY") == 0)) |
974 | can_disable= false; |
975 | else |
976 | can_disable= true; |
977 | @@ -2125,7 +2118,7 @@ |
978 | NOTE: |
979 | Requires that a write-lock is held on LOCK_system_variables_hash |
980 | */ |
981 | -static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp, |
982 | +static int test_plugin_options(MEM_ROOT *tmp_root, Handle *tmp, |
983 | int *argc, char **argv) |
984 | { |
985 | struct sys_var_chain chain= { NULL, NULL }; |
986 | @@ -2140,14 +2133,13 @@ |
987 | sys_var *v; |
988 | struct st_bookmark *var; |
989 | uint32_t len, count= EXTRA_OPTIONS; |
990 | - assert(tmp->plugin && tmp->name.str); |
991 | |
992 | - for (opt= tmp->plugin->system_vars; opt && *opt; opt++) |
993 | + for (opt= tmp->getManifest().system_vars; opt && *opt; opt++) |
994 | count+= 2; /* --{plugin}-{optname} and --plugin-{plugin}-{optname} */ |
995 | |
996 | - if ((my_strcasecmp(&my_charset_utf8_general_ci, tmp->name.str, "MyISAM") == 0)) |
997 | + if ((my_strcasecmp(&my_charset_utf8_general_ci, tmp->getName().c_str(), "MyISAM") == 0)) |
998 | can_disable= false; |
999 | - else if ((my_strcasecmp(&my_charset_utf8_general_ci, tmp->name.str, "MEMORY") == 0)) |
1000 | + else if ((my_strcasecmp(&my_charset_utf8_general_ci, tmp->getName().c_str(), "MEMORY") == 0)) |
1001 | can_disable= false; |
1002 | else |
1003 | can_disable= true; |
1004 | @@ -2156,14 +2148,14 @@ |
1005 | { |
1006 | if (!(opts= (my_option*) alloc_root(tmp_root, sizeof(my_option) * count))) |
1007 | { |
1008 | - errmsg_printf(ERRMSG_LVL_ERROR, _("Out of memory for plugin '%s'."), tmp->name.str); |
1009 | + errmsg_printf(ERRMSG_LVL_ERROR, _("Out of memory for plugin '%s'."), tmp->getName().c_str()); |
1010 | return(-1); |
1011 | } |
1012 | memset(opts, 0, sizeof(my_option) * count); |
1013 | |
1014 | if (construct_options(tmp_root, tmp, opts, can_disable)) |
1015 | { |
1016 | - errmsg_printf(ERRMSG_LVL_ERROR, _("Bad options for plugin '%s'."), tmp->name.str); |
1017 | + errmsg_printf(ERRMSG_LVL_ERROR, _("Bad options for plugin '%s'."), tmp->getName().c_str()); |
1018 | return(-1); |
1019 | } |
1020 | |
1021 | @@ -2173,7 +2165,7 @@ |
1022 | if (error) |
1023 | { |
1024 | errmsg_printf(ERRMSG_LVL_ERROR, _("Parsing options for plugin '%s' failed."), |
1025 | - tmp->name.str); |
1026 | + tmp->getName().c_str()); |
1027 | goto err; |
1028 | } |
1029 | } |
1030 | @@ -2181,18 +2173,18 @@ |
1031 | error= 1; |
1032 | |
1033 | { |
1034 | - for (opt= tmp->plugin->system_vars; opt && *opt; opt++) |
1035 | + for (opt= tmp->getManifest().system_vars; opt && *opt; opt++) |
1036 | { |
1037 | if (((o= *opt)->flags & PLUGIN_VAR_NOSYSVAR)) |
1038 | continue; |
1039 | |
1040 | - if ((var= find_bookmark(tmp->name.str, o->name, o->flags))) |
1041 | + if ((var= find_bookmark(tmp->getName().c_str(), o->name, o->flags))) |
1042 | v= new (mem_root) sys_var_pluginvar(var->key + 1, o); |
1043 | else |
1044 | { |
1045 | - len= tmp->name.length + strlen(o->name) + 2; |
1046 | + len= tmp->getName().length() + strlen(o->name) + 2; |
1047 | varname= (char*) alloc_root(mem_root, len); |
1048 | - sprintf(varname,"%s-%s",tmp->name.str,o->name); |
1049 | + sprintf(varname,"%s-%s",tmp->getName().c_str(),o->name); |
1050 | my_casedn_str(&my_charset_utf8_general_ci, varname); |
1051 | |
1052 | for (p= varname; *p; p++) |
1053 | @@ -2216,7 +2208,7 @@ |
1054 | if (mysql_add_sys_var_chain(chain.first, NULL)) |
1055 | { |
1056 | errmsg_printf(ERRMSG_LVL_ERROR, _("Plugin '%s' has conflicting system variables"), |
1057 | - tmp->name.str); |
1058 | + tmp->getName().c_str()); |
1059 | goto err; |
1060 | } |
1061 | tmp->system_vars= chain.first; |
1062 | @@ -2235,49 +2227,69 @@ |
1063 | Help Verbose text with Plugin System Variables |
1064 | ****************************************************************************/ |
1065 | |
1066 | -static int option_cmp(my_option *a, my_option *b) |
1067 | -{ |
1068 | - return my_strcasecmp(&my_charset_utf8_general_ci, a->name, b->name); |
1069 | -} |
1070 | - |
1071 | - |
1072 | -void my_print_help_inc_plugins(my_option *main_options, uint32_t size) |
1073 | -{ |
1074 | - DYNAMIC_ARRAY all_options; |
1075 | - struct st_plugin_int *p; |
1076 | +class OptionCmp |
1077 | +{ |
1078 | +public: |
1079 | + bool operator() (const my_option &a, const my_option &b) |
1080 | + { |
1081 | + return my_strcasecmp(&my_charset_utf8_general_ci, a.name, b.name); |
1082 | + } |
1083 | +}; |
1084 | + |
1085 | + |
1086 | +void my_print_help_inc_plugins(my_option *main_options) |
1087 | +{ |
1088 | + vector<my_option> all_options; |
1089 | + Handle *p; |
1090 | MEM_ROOT mem_root; |
1091 | - my_option *opt; |
1092 | + my_option *opt= NULL; |
1093 | |
1094 | init_alloc_root(&mem_root, 4096, 4096); |
1095 | - my_init_dynamic_array(&all_options, sizeof(my_option), size, size/4); |
1096 | |
1097 | if (initialized) |
1098 | for (uint32_t idx= 0; idx < plugin_array.elements; idx++) |
1099 | { |
1100 | - p= *dynamic_element(&plugin_array, idx, struct st_plugin_int **); |
1101 | - |
1102 | - if (!p->plugin->system_vars || |
1103 | - !(opt= construct_help_options(&mem_root, p))) |
1104 | + p= *dynamic_element(&plugin_array, idx, Handle **); |
1105 | + |
1106 | + if (p->getManifest().system_vars == NULL) |
1107 | + continue; |
1108 | + |
1109 | + opt= construct_help_options(&mem_root, p); |
1110 | + if (opt == NULL) |
1111 | continue; |
1112 | |
1113 | /* Only options with a non-NULL comment are displayed in help text */ |
1114 | for (;opt->id; opt++) |
1115 | + { |
1116 | if (opt->comment) |
1117 | - insert_dynamic(&all_options, (unsigned char*) opt); |
1118 | + { |
1119 | + all_options.push_back(*opt); |
1120 | + |
1121 | + } |
1122 | + } |
1123 | } |
1124 | |
1125 | for (;main_options->id; main_options++) |
1126 | - insert_dynamic(&all_options, (unsigned char*) main_options); |
1127 | + { |
1128 | + if (main_options->comment) |
1129 | + { |
1130 | + all_options.push_back(*main_options); |
1131 | + } |
1132 | + } |
1133 | |
1134 | - sort_dynamic(&all_options, (qsort_cmp) option_cmp); |
1135 | + /** |
1136 | + * @TODO: Fix the my_option building so that it doens't break sort |
1137 | + * |
1138 | + * sort(all_options.begin(), all_options.end(), OptionCmp()); |
1139 | + */ |
1140 | |
1141 | /* main_options now points to the empty option terminator */ |
1142 | - insert_dynamic(&all_options, (unsigned char*) main_options); |
1143 | - |
1144 | - my_print_help((my_option*) all_options.buffer); |
1145 | - my_print_variables((my_option*) all_options.buffer); |
1146 | - |
1147 | - delete_dynamic(&all_options); |
1148 | + all_options.push_back(*main_options); |
1149 | + |
1150 | + my_print_help(&*(all_options.begin())); |
1151 | + my_print_variables(&*(all_options.begin())); |
1152 | + |
1153 | free_root(&mem_root, MYF(0)); |
1154 | + |
1155 | } |
1156 | |
1157 | |
1158 | === modified file 'drizzled/sql_plugin.h' |
1159 | --- drizzled/sql_plugin.h 2009-07-07 09:06:29 +0000 |
1160 | +++ drizzled/sql_plugin.h 2009-07-16 17:37:03 +0000 |
1161 | @@ -36,63 +36,15 @@ |
1162 | #ifndef DRIZZLE_SERVER_PLUGIN_H |
1163 | #define DRIZZLE_SERVER_PLUGIN_H |
1164 | |
1165 | -#include <drizzled/lex_string.h> |
1166 | -#include <mysys/my_alloc.h> |
1167 | -#include <drizzled/plugin_registry.h> |
1168 | #include <drizzled/plugin.h> |
1169 | +#include <drizzled/plugin/manifest.h> |
1170 | +#include <drizzled/plugin/library.h> |
1171 | +#include <drizzled/plugin/handle.h> |
1172 | |
1173 | +class Session; |
1174 | class sys_var; |
1175 | -class Session; |
1176 | - |
1177 | - |
1178 | -/* A handle for the dynamic library containing a plugin or plugins. */ |
1179 | -struct drizzled_plugin_manifest; |
1180 | - |
1181 | -struct st_plugin_dl |
1182 | -{ |
1183 | - LEX_STRING dl; |
1184 | - void *handle; |
1185 | - struct drizzled_plugin_manifest *plugins; |
1186 | -}; |
1187 | - |
1188 | -/* A handle of a plugin */ |
1189 | - |
1190 | -struct st_plugin_int |
1191 | -{ |
1192 | - LEX_STRING name; |
1193 | - struct drizzled_plugin_manifest *plugin; |
1194 | - struct st_plugin_dl *plugin_dl; |
1195 | - bool isInited; |
1196 | - MEM_ROOT mem_root; /* memory for dynamic plugin structures */ |
1197 | - sys_var *system_vars; /* server variables for this plugin */ |
1198 | -}; |
1199 | - |
1200 | - |
1201 | -#define plugin_decl(pi) ((pi)->plugin) |
1202 | -#define plugin_data(pi,cast) (static_cast<cast>((pi)->data)) |
1203 | -#define plugin_name(pi) (&((pi)->name)) |
1204 | -#define plugin_equals(p1,p2) ((p1) && (p2) && (p1) == (p2)) |
1205 | - |
1206 | - |
1207 | -typedef int (*plugin_type_init)(PluginRegistry &); |
1208 | - |
1209 | -/* |
1210 | - Plugin description structure. |
1211 | -*/ |
1212 | - |
1213 | -struct drizzled_plugin_manifest |
1214 | -{ |
1215 | - const char *name; /* plugin name (for SHOW PLUGINS) */ |
1216 | - const char *version; /* plugin version (for SHOW PLUGINS) */ |
1217 | - const char *author; /* plugin author (for SHOW PLUGINS) */ |
1218 | - const char *descr; /* general descriptive text (for SHOW PLUGINS ) */ |
1219 | - int license; /* plugin license (PLUGIN_LICENSE_XXX) */ |
1220 | - plugin_type_init init; /* function to invoke when plugin is loaded */ |
1221 | - plugin_type_init deinit; /* function to invoke when plugin is unloaded */ |
1222 | - struct st_mysql_show_var *status_vars; |
1223 | - struct st_mysql_sys_var **system_vars; |
1224 | - void *reserved1; /* reserved for dependency checking */ |
1225 | -}; |
1226 | +typedef struct st_mysql_lex_string LEX_STRING; |
1227 | +struct my_option; |
1228 | |
1229 | extern char *opt_plugin_load; |
1230 | extern char *opt_plugin_dir_ptr; |
1231 | @@ -100,12 +52,12 @@ |
1232 | |
1233 | extern int plugin_init(int *argc, char **argv, int init_flags); |
1234 | extern void plugin_shutdown(void); |
1235 | -extern void my_print_help_inc_plugins(struct my_option *options, uint32_t size); |
1236 | +extern void my_print_help_inc_plugins(my_option *options); |
1237 | extern bool plugin_is_ready(const LEX_STRING *name, int type); |
1238 | extern bool mysql_install_plugin(Session *session, const LEX_STRING *name, |
1239 | const LEX_STRING *dl); |
1240 | extern bool mysql_uninstall_plugin(Session *session, const LEX_STRING *name); |
1241 | -extern bool plugin_register_builtin(struct drizzled_plugin_manifest *plugin); |
1242 | +extern bool plugin_register_builtin(drizzled::plugin::Manifest *plugin); |
1243 | extern void plugin_sessionvar_init(Session *session); |
1244 | extern void plugin_sessionvar_cleanup(Session *session); |
1245 | extern sys_var *intern_find_sys_var(const char *str, uint32_t, bool no_error); |
1246 | |
1247 | === modified file 'extra/clean_source.sh' |
1248 | --- extra/clean_source.sh 2009-07-10 21:50:02 +0000 |
1249 | +++ extra/clean_source.sh 2009-07-15 21:16:34 +0000 |
1250 | @@ -15,8 +15,8 @@ |
1251 | # along with this program; if not, write to the Free Software |
1252 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
1253 | |
1254 | -for file in `ack-grep -f | grep -v innobase | grep -v '\.pb\.'| grep -v bak-header | grep -v '^intl' | grep -v '^config' `; do |
1255 | +for file in `ack-grep -f | grep -v innobase | grep -v '\.pb\.'| grep -v bak-header | grep -v '^intl' | grep -v '^config' | grep -v '\.am$' | grep -v '\.ac$' | grep -v m4 | grep -v sql_yacc.yy | grep -v '.gperf$' `; do |
1256 | grep Copyright $file >/dev/null 2>&1 || echo "No copyright header in $file" |
1257 | - uncrustify -c ../config/uncrustify.cfg --replace $file |
1258 | + uncrustify -c config/uncrustify.cfg --replace $file |
1259 | done |
1260 | |
1261 | |
1262 | === modified file 'm4/pandora_warnings.m4' |
1263 | --- m4/pandora_warnings.m4 2009-07-15 19:22:16 +0000 |
1264 | +++ m4/pandora_warnings.m4 2009-07-17 23:20:36 +0000 |
1265 | @@ -125,7 +125,7 @@ |
1266 | ]) |
1267 | |
1268 | NO_STRICT_ALIASING="-fno-strict-aliasing -Wno-strict-aliasing" |
1269 | - NO_SHADOW="-Wno-shadow" |
1270 | + NO_SHADOW="-Wno-shadow -Wno-conversion" |
1271 | |
1272 | AS_IF([test "$INTELCC" = "yes"],[ |
1273 | m4_if(PW_LESS_WARNINGS,[no],[ |
1274 | |
1275 | === modified file 'mysys/base64.cc' |
1276 | --- mysys/base64.cc 2009-05-03 15:58:12 +0000 |
1277 | +++ mysys/base64.cc 2009-07-17 22:25:54 +0000 |
1278 | @@ -213,9 +213,9 @@ |
1279 | i++; |
1280 | |
1281 | end: |
1282 | - b[0]= (c >> 16) & 0xff; |
1283 | - b[1]= (c >> 8) & 0xff; |
1284 | - b[2]= (c >> 0) & 0xff; |
1285 | + b[0]= char((c >> 16) & 0xff); |
1286 | + b[1]= char((c >> 8) & 0xff); |
1287 | + b[2]= char((c >> 0) & 0xff); |
1288 | |
1289 | for (j=0; j<3-mark; j++) |
1290 | *d++= b[j]; |
1291 | @@ -228,7 +228,7 @@ |
1292 | The variable 'i' is set to 'len' when padding has been read, so it |
1293 | does not actually reflect the number of bytes read from 'src'. |
1294 | */ |
1295 | - return i != len ? -1 : d - dst_base; |
1296 | + return (i != len) ? -1 : int(d - dst_base); |
1297 | } |
1298 | |
1299 | |
1300 | |
1301 | === modified file 'mysys/checksum.cc' |
1302 | --- mysys/checksum.cc 2009-04-17 21:01:47 +0000 |
1303 | +++ mysys/checksum.cc 2009-07-17 22:25:54 +0000 |
1304 | @@ -30,6 +30,6 @@ |
1305 | |
1306 | ha_checksum my_checksum(ha_checksum crc, const unsigned char *pos, size_t length) |
1307 | { |
1308 | - return (ha_checksum)crc32((uint32_t)crc, pos, length); |
1309 | + return ha_checksum(crc32((uint32_t)crc, pos, uInt(length))); |
1310 | } |
1311 | |
1312 | |
1313 | === modified file 'mysys/default.cc' |
1314 | --- mysys/default.cc 2009-07-10 21:19:35 +0000 |
1315 | +++ mysys/default.cc 2009-07-17 23:20:36 +0000 |
1316 | @@ -164,7 +164,7 @@ |
1317 | /* Handle --defaults-group-suffix= */ |
1318 | uint32_t i; |
1319 | const char **extra_groups; |
1320 | - const uint32_t instance_len= strlen(my_defaults_group_suffix); |
1321 | + const size_t instance_len= strlen(my_defaults_group_suffix); |
1322 | struct handle_option_ctx *ctx= (struct handle_option_ctx*) func_ctx; |
1323 | char *ptr; |
1324 | TYPELIB *group= ctx->group; |
1325 | @@ -176,7 +176,7 @@ |
1326 | |
1327 | for (i= 0; i < group->count; i++) |
1328 | { |
1329 | - uint32_t len; |
1330 | + size_t len; |
1331 | extra_groups[i]= group->type_names[i]; /** copy group */ |
1332 | |
1333 | len= strlen(extra_groups[i]); |
1334 | @@ -455,8 +455,8 @@ |
1335 | memcpy(res+1+args.elements, *argv + 1, (*argc-1)*sizeof(char*)); |
1336 | res[args.elements+ *argc]=0; /* last null */ |
1337 | |
1338 | - (*argc)+=args.elements; |
1339 | - *argv= (char**) res; |
1340 | + (*argc)+=int(args.elements); |
1341 | + *argv= static_cast<char**>(res); |
1342 | *(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */ |
1343 | delete_dynamic(&args); |
1344 | if (found_print_defaults) |
1345 | |
1346 | === removed file 'mysys/default_modify.cc' |
1347 | --- mysys/default_modify.cc 2009-06-30 21:28:16 +0000 |
1348 | +++ mysys/default_modify.cc 1970-01-01 00:00:00 +0000 |
1349 | @@ -1,252 +0,0 @@ |
1350 | -/* Copyright (C) 2005 MySQL AB |
1351 | - |
1352 | - This program is free software; you can redistribute it and/or modify |
1353 | - it under the terms of the GNU General Public License as published by |
1354 | - the Free Software Foundation; version 2 of the License. |
1355 | - |
1356 | - This program is distributed in the hope that it will be useful, |
1357 | - but WITHOUT ANY WARRANTY; without even the implied warranty of |
1358 | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1359 | - GNU General Public License for more details. |
1360 | - |
1361 | - You should have received a copy of the GNU General Public License |
1362 | - along with this program; if not, write to the Free Software |
1363 | - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ |
1364 | - |
1365 | -#include "mysys/mysys_priv.h" |
1366 | -#include <mystrings/m_string.h> |
1367 | -#include <mysys/my_dir.h> |
1368 | - |
1369 | -#include <stdio.h> |
1370 | -#include <algorithm> |
1371 | - |
1372 | -using namespace std; |
1373 | - |
1374 | -#define BUFF_SIZE 1024 |
1375 | -#define RESERVE 1024 /* Extend buffer with this extent */ |
1376 | - |
1377 | -#define NEWLINE "\n" |
1378 | -#define NEWLINE_LEN 1 |
1379 | - |
1380 | -static char *add_option(char *dst, const char *option_value, |
1381 | - const char *option, int remove_option); |
1382 | - |
1383 | - |
1384 | -/* |
1385 | - Add/remove option to the option file section. |
1386 | - |
1387 | - SYNOPSYS |
1388 | - modify_defaults_file() |
1389 | - file_location The location of configuration file to edit |
1390 | - option The name of the option to look for (can be NULL) |
1391 | - option value The value of the option we would like to set (can be NULL) |
1392 | - section_name The name of the section (must be NOT NULL) |
1393 | - remove_option This defines what we want to remove: |
1394 | - - MY_REMOVE_NONE -- nothing to remove; |
1395 | - - MY_REMOVE_OPTION -- remove the specified option; |
1396 | - - MY_REMOVE_SECTION -- remove the specified section; |
1397 | - IMPLEMENTATION |
1398 | - We open the option file first, then read the file line-by-line, |
1399 | - looking for the section we need. At the same time we put these lines |
1400 | - into a buffer. Then we look for the option within this section and |
1401 | - change/remove it. In the end we get a buffer with modified version of the |
1402 | - file. Then we write it to the file, truncate it if needed and close it. |
1403 | - Note that there is a small time gap, when the file is incomplete, |
1404 | - and this theoretically might introduce a problem. |
1405 | - |
1406 | - RETURN |
1407 | - 0 - ok |
1408 | - 1 - some error has occured. Probably due to the lack of resourses |
1409 | - 2 - cannot open the file |
1410 | -*/ |
1411 | - |
1412 | -int modify_defaults_file(const char *file_location, const char *option, |
1413 | - const char *option_value, |
1414 | - const char *section_name, int remove_option) |
1415 | -{ |
1416 | - FILE *cnf_file; |
1417 | - struct stat file_stat; |
1418 | - char linebuff[BUFF_SIZE], *src_ptr, *dst_ptr, *file_buffer; |
1419 | - size_t opt_len= 0, optval_len= 0, sect_len; |
1420 | - uint32_t nr_newlines= 0; |
1421 | - size_t buffer_size; |
1422 | - bool in_section= false, opt_applied= 0; |
1423 | - size_t reserve_extended; |
1424 | - uint32_t new_opt_len; |
1425 | - int reserve_occupied= 0; |
1426 | - |
1427 | - if (!(cnf_file= fopen(file_location, "r+"))) |
1428 | - return(2); |
1429 | - |
1430 | - if (fstat(fileno(cnf_file), &file_stat)) |
1431 | - goto malloc_err; |
1432 | - |
1433 | - if (option && option_value) |
1434 | - { |
1435 | - opt_len= strlen(option); |
1436 | - optval_len= strlen(option_value); |
1437 | - } |
1438 | - |
1439 | - new_opt_len= opt_len + 1 + optval_len + NEWLINE_LEN; |
1440 | - |
1441 | - /* calculate the size of the buffer we need */ |
1442 | - reserve_extended= (opt_len + |
1443 | - 1 + /* For '=' char */ |
1444 | - optval_len + /* Option value len */ |
1445 | - NEWLINE_LEN + /* Space for newline */ |
1446 | - RESERVE); /* Some additional space */ |
1447 | - |
1448 | - buffer_size= (size_t)max((uint64_t)file_stat.st_size + 1, (uint64_t)SIZE_MAX); |
1449 | - |
1450 | - /* |
1451 | - Reserve space to read the contents of the file and some more |
1452 | - for the option we want to add. |
1453 | - */ |
1454 | - if (!(file_buffer= (char*) malloc(max(buffer_size + reserve_extended, |
1455 | - (size_t)SIZE_MAX)))) |
1456 | - goto malloc_err; |
1457 | - |
1458 | - sect_len= strlen(section_name); |
1459 | - |
1460 | - for (dst_ptr= file_buffer; fgets(linebuff, BUFF_SIZE, cnf_file); ) |
1461 | - { |
1462 | - /* Skip over whitespaces */ |
1463 | - for (src_ptr= linebuff; my_isspace(&my_charset_utf8_general_ci, *src_ptr); |
1464 | - src_ptr++) |
1465 | - {} |
1466 | - |
1467 | - if (!*src_ptr) /* Empty line */ |
1468 | - { |
1469 | - nr_newlines++; |
1470 | - continue; |
1471 | - } |
1472 | - |
1473 | - /* correct the option (if requested) */ |
1474 | - if (option && in_section && !strncmp(src_ptr, option, opt_len) && |
1475 | - (*(src_ptr + opt_len) == '=' || |
1476 | - my_isspace(&my_charset_utf8_general_ci, *(src_ptr + opt_len)) || |
1477 | - *(src_ptr + opt_len) == '\0')) |
1478 | - { |
1479 | - char *old_src_ptr= src_ptr; |
1480 | - src_ptr= strchr(src_ptr+ opt_len, '\0'); /* Find the end of the line */ |
1481 | - |
1482 | - /* could be negative */ |
1483 | - reserve_occupied+= (int) new_opt_len - (int) (src_ptr - old_src_ptr); |
1484 | - if (reserve_occupied >= (int) reserve_extended) |
1485 | - { |
1486 | - reserve_extended= (uint32_t) reserve_occupied + RESERVE; |
1487 | - if (!(file_buffer= (char*) realloc(file_buffer, buffer_size + |
1488 | - reserve_extended))) |
1489 | - goto malloc_err; |
1490 | - } |
1491 | - opt_applied= 1; |
1492 | - dst_ptr= add_option(dst_ptr, option_value, option, remove_option); |
1493 | - } |
1494 | - else |
1495 | - { |
1496 | - /* |
1497 | - If we are going to the new group and have an option to apply, do |
1498 | - it now. If we are removing a single option or the whole section |
1499 | - this will only trigger opt_applied flag. |
1500 | - */ |
1501 | - |
1502 | - if (in_section && !opt_applied && *src_ptr == '[') |
1503 | - { |
1504 | - dst_ptr= add_option(dst_ptr, option_value, option, remove_option); |
1505 | - opt_applied= 1; /* set the flag to do write() later */ |
1506 | - reserve_occupied= new_opt_len+ opt_len + 1 + NEWLINE_LEN; |
1507 | - } |
1508 | - |
1509 | - for (; nr_newlines; nr_newlines--) |
1510 | - dst_ptr= strcpy(dst_ptr, NEWLINE)+NEWLINE_LEN; |
1511 | - |
1512 | - /* Skip the section if MY_REMOVE_SECTION was given */ |
1513 | - if (!in_section || remove_option != MY_REMOVE_SECTION) |
1514 | - dst_ptr= strcpy(dst_ptr, linebuff); |
1515 | - dst_ptr+= strlen(linebuff); |
1516 | - } |
1517 | - /* Look for a section */ |
1518 | - if (*src_ptr == '[') |
1519 | - { |
1520 | - /* Copy the line to the buffer */ |
1521 | - if (!strncmp(++src_ptr, section_name, sect_len)) |
1522 | - { |
1523 | - src_ptr+= sect_len; |
1524 | - /* Skip over whitespaces. They are allowed after section name */ |
1525 | - for (; my_isspace(&my_charset_utf8_general_ci, *src_ptr); src_ptr++) |
1526 | - {} |
1527 | - |
1528 | - if (*src_ptr != ']') |
1529 | - { |
1530 | - in_section= false; |
1531 | - continue; /* Missing closing parenthesis. Assume this was no group */ |
1532 | - } |
1533 | - |
1534 | - if (remove_option == MY_REMOVE_SECTION) |
1535 | - dst_ptr= dst_ptr - strlen(linebuff); |
1536 | - |
1537 | - in_section= true; |
1538 | - } |
1539 | - else |
1540 | - in_section= false; /* mark that this section is of no interest to us */ |
1541 | - } |
1542 | - } |
1543 | - |
1544 | - /* |
1545 | - File ended. Apply an option or set opt_applied flag (in case of |
1546 | - MY_REMOVE_SECTION) so that the changes are saved. Do not do anything |
1547 | - if we are removing non-existent option. |
1548 | - */ |
1549 | - |
1550 | - if (!opt_applied && in_section && (remove_option != MY_REMOVE_OPTION)) |
1551 | - { |
1552 | - /* New option still remains to apply at the end */ |
1553 | - if (!remove_option && *(dst_ptr - 1) != '\n') |
1554 | - dst_ptr= strcpy(dst_ptr, NEWLINE)+NEWLINE_LEN; |
1555 | - dst_ptr= add_option(dst_ptr, option_value, option, remove_option); |
1556 | - opt_applied= 1; |
1557 | - } |
1558 | - for (; nr_newlines; nr_newlines--) |
1559 | - dst_ptr= strcpy(dst_ptr, NEWLINE)+NEWLINE_LEN; |
1560 | - |
1561 | - if (opt_applied) |
1562 | - { |
1563 | - /* Don't write the file if there are no changes to be made */ |
1564 | - if (ftruncate(fileno(cnf_file), (size_t) (dst_ptr - file_buffer)) || |
1565 | - fseeko(cnf_file, 0, SEEK_SET) || |
1566 | - fwrite(file_buffer, 1, (size_t) (dst_ptr - file_buffer), cnf_file)) |
1567 | - goto err; |
1568 | - } |
1569 | - if (fclose(cnf_file)) |
1570 | - return(1); |
1571 | - |
1572 | - free(file_buffer); |
1573 | - return(0); |
1574 | - |
1575 | -err: |
1576 | - free(file_buffer); |
1577 | -malloc_err: |
1578 | - fclose(cnf_file); |
1579 | - |
1580 | - return 1; /* out of resources */ |
1581 | -} |
1582 | - |
1583 | - |
1584 | -static char *add_option(char *dst, const char *option_value, |
1585 | - const char *option, int remove_option) |
1586 | -{ |
1587 | - if (!remove_option) |
1588 | - { |
1589 | - dst= strcpy(dst, option); |
1590 | - dst+= strlen(option); |
1591 | - if (*option_value) |
1592 | - { |
1593 | - *dst++= '='; |
1594 | - dst= strcpy(dst, option_value); |
1595 | - dst+= strlen(option_value); |
1596 | - } |
1597 | - /* add a newline */ |
1598 | - dst= strcpy(dst, NEWLINE)+NEWLINE_LEN; |
1599 | - } |
1600 | - return dst; |
1601 | -} |
1602 | |
1603 | === modified file 'mysys/my_bitmap.h' |
1604 | --- mysys/my_bitmap.h 2009-05-23 00:05:52 +0000 |
1605 | +++ mysys/my_bitmap.h 2009-07-17 22:25:54 +0000 |
1606 | @@ -80,7 +80,7 @@ |
1607 | |
1608 | static inline void bitmap_set_bit(MY_BITMAP const *map, uint32_t bit) |
1609 | { |
1610 | - ((unsigned char *)map->bitmap)[bit / 8] |= (1 << ((bit) & 7)); |
1611 | + ((unsigned char *)map->bitmap)[bit / 8] |= (unsigned char)(1 << ((bit) & 7)); |
1612 | } |
1613 | |
1614 | static inline void bitmap_flip_bit(MY_BITMAP const *map, uint32_t bit) |
1615 | |
1616 | === modified file 'mysys/my_sys.h' |
1617 | --- mysys/my_sys.h 2009-07-11 06:24:19 +0000 |
1618 | +++ mysys/my_sys.h 2009-07-17 23:20:36 +0000 |
1619 | @@ -71,10 +71,6 @@ |
1620 | #define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */ |
1621 | #define MY_GIVE_INFO 2 /* Give time info about process*/ |
1622 | |
1623 | -#define MY_REMOVE_NONE 0 /* Params for modify_defaults_file */ |
1624 | -#define MY_REMOVE_OPTION 1 |
1625 | -#define MY_REMOVE_SECTION 2 |
1626 | - |
1627 | #define ME_HIGHBYTE 8 /* Shift for colours */ |
1628 | #define ME_NOCUR 1 /* Don't use curses message */ |
1629 | #define ME_OLDWIN 2 /* Use old window */ |
1630 | @@ -401,9 +397,6 @@ |
1631 | char **group_suffix); |
1632 | extern int load_defaults(const char *conf_file, const char **groups, |
1633 | int *argc, char ***argv); |
1634 | -extern int modify_defaults_file(const char *file_location, const char *option, |
1635 | - const char *option_value, |
1636 | - const char *section_name, int remove_option); |
1637 | extern int my_search_option_files(const char *conf_file, int *argc, |
1638 | char ***argv, uint32_t *args_used, |
1639 | Process_option_func func, void *func_ctx); |
1640 | |
1641 | === modified file 'plugin/info_schema/info_schema_methods.cc' |
1642 | --- plugin/info_schema/info_schema_methods.cc 2009-07-09 01:35:10 +0000 |
1643 | +++ plugin/info_schema/info_schema_methods.cc 2009-07-18 18:11:42 +0000 |
1644 | @@ -330,7 +330,7 @@ |
1645 | return (0); |
1646 | } |
1647 | |
1648 | -class ShowPlugins : public unary_function<st_plugin_int *, bool> |
1649 | +class ShowPlugins : public unary_function<drizzled::plugin::Handle *, bool> |
1650 | { |
1651 | Session *session; |
1652 | Table *table; |
1653 | @@ -340,17 +340,17 @@ |
1654 | |
1655 | result_type operator() (argument_type plugin) |
1656 | { |
1657 | - struct drizzled_plugin_manifest *plug= plugin_decl(plugin); |
1658 | + const drizzled::plugin::Manifest &manifest= plugin->getManifest(); |
1659 | const CHARSET_INFO * const cs= system_charset_info; |
1660 | |
1661 | table->restoreRecordAsDefault(); |
1662 | |
1663 | - table->field[0]->store(plugin_name(plugin)->str, |
1664 | - plugin_name(plugin)->length, cs); |
1665 | + table->field[0]->store(plugin->getName().c_str(), |
1666 | + plugin->getName().size(), cs); |
1667 | |
1668 | - if (plug->version) |
1669 | + if (manifest.version) |
1670 | { |
1671 | - table->field[1]->store(plug->version, strlen(plug->version), cs); |
1672 | + table->field[1]->store(manifest.version, strlen(manifest.version), cs); |
1673 | table->field[1]->set_notnull(); |
1674 | } |
1675 | else |
1676 | @@ -365,9 +365,9 @@ |
1677 | table->field[2]->store(STRING_WITH_LEN("INACTIVE"), cs); |
1678 | } |
1679 | |
1680 | - if (plug->author) |
1681 | + if (manifest.author) |
1682 | { |
1683 | - table->field[3]->store(plug->author, strlen(plug->author), cs); |
1684 | + table->field[3]->store(manifest.author, strlen(manifest.author), cs); |
1685 | table->field[3]->set_notnull(); |
1686 | } |
1687 | else |
1688 | @@ -375,9 +375,9 @@ |
1689 | table->field[3]->set_null(); |
1690 | } |
1691 | |
1692 | - if (plug->descr) |
1693 | + if (manifest.descr) |
1694 | { |
1695 | - table->field[4]->store(plug->descr, strlen(plug->descr), cs); |
1696 | + table->field[4]->store(manifest.descr, strlen(manifest.descr), cs); |
1697 | table->field[4]->set_notnull(); |
1698 | } |
1699 | else |
1700 | @@ -385,22 +385,23 @@ |
1701 | table->field[4]->set_null(); |
1702 | } |
1703 | |
1704 | - switch (plug->license) { |
1705 | + switch (manifest.license) { |
1706 | case PLUGIN_LICENSE_GPL: |
1707 | - table->field[5]->store(PLUGIN_LICENSE_GPL_STRING, |
1708 | - strlen(PLUGIN_LICENSE_GPL_STRING), cs); |
1709 | + table->field[5]->store(drizzled::plugin::LICENSE_GPL_STRING.c_str(), |
1710 | + drizzled::plugin::LICENSE_GPL_STRING.size(), cs); |
1711 | break; |
1712 | case PLUGIN_LICENSE_BSD: |
1713 | - table->field[5]->store(PLUGIN_LICENSE_BSD_STRING, |
1714 | - strlen(PLUGIN_LICENSE_BSD_STRING), cs); |
1715 | + table->field[5]->store(drizzled::plugin::LICENSE_BSD_STRING.c_str(), |
1716 | + drizzled::plugin::LICENSE_BSD_STRING.size(), cs); |
1717 | break; |
1718 | case PLUGIN_LICENSE_LGPL: |
1719 | - table->field[5]->store(PLUGIN_LICENSE_LGPL_STRING, |
1720 | - strlen(PLUGIN_LICENSE_LGPL_STRING), cs); |
1721 | + table->field[5]->store(drizzled::plugin::LICENSE_LGPL_STRING.c_str(), |
1722 | + drizzled::plugin::LICENSE_LGPL_STRING.size(), cs); |
1723 | break; |
1724 | default: |
1725 | - table->field[5]->store(PLUGIN_LICENSE_PROPRIETARY_STRING, |
1726 | - strlen(PLUGIN_LICENSE_PROPRIETARY_STRING), cs); |
1727 | + table->field[5]->store(drizzled::plugin::LICENSE_PROPRIETARY_STRING.c_str(), |
1728 | + drizzled::plugin::LICENSE_PROPRIETARY_STRING.size(), |
1729 | + cs); |
1730 | break; |
1731 | } |
1732 | table->field[5]->set_notnull(); |
1733 | @@ -414,8 +415,8 @@ |
1734 | Table *table= tables->table; |
1735 | |
1736 | PluginRegistry ®istry= PluginRegistry::getPluginRegistry(); |
1737 | - vector<st_plugin_int *> plugins= registry.get_list(true); |
1738 | - vector<st_plugin_int *>::iterator iter= |
1739 | + vector<drizzled::plugin::Handle *> plugins= registry.get_list(true); |
1740 | + vector<drizzled::plugin::Handle *>::iterator iter= |
1741 | find_if(plugins.begin(), plugins.end(), ShowPlugins(session, table)); |
1742 | if (iter != plugins.end()) |
1743 | { |
1744 | |
1745 | === modified file 'plugin/innobase/handler/ha_innodb.cc' |
1746 | --- plugin/innobase/handler/ha_innodb.cc 2009-07-07 09:06:29 +0000 |
1747 | +++ plugin/innobase/handler/ha_innodb.cc 2009-07-15 21:00:16 +0000 |
1748 | @@ -131,7 +131,7 @@ |
1749 | #ifdef DRIZZLE_DYNAMIC_PLUGIN |
1750 | /* These must be weak global variables in the dynamic plugin. */ |
1751 | #ifdef __WIN__ |
1752 | -struct drizzled_plugin_manifest* builtin_innobase_plugin_ptr; |
1753 | +struct drizzled::plugin::Manifest* builtin_innobase_plugin_ptr; |
1754 | #else |
1755 | int builtin_innobase_plugin; |
1756 | #endif /* __WIN__ */ |
1757 | @@ -9063,9 +9063,9 @@ |
1758 | |
1759 | /* Copy the system variables. */ |
1760 | |
1761 | - struct drizzled_plugin_manifest* builtin; |
1762 | - struct st_mysql_sys_var** sta; /* static parameters */ |
1763 | - struct st_mysql_sys_var** dyn; /* dynamic parameters */ |
1764 | + drizzled::plugin::Manifest* builtin; |
1765 | + st_mysql_sys_var** sta; /* static parameters */ |
1766 | + st_mysql_sys_var** dyn; /* dynamic parameters */ |
1767 | |
1768 | #ifdef __WIN__ |
1769 | if (!builtin_innobase_plugin_ptr) { |
1770 | @@ -9076,7 +9076,7 @@ |
1771 | builtin = builtin_innobase_plugin_ptr; |
1772 | #else |
1773 | |
1774 | - builtin = (struct drizzled_plugin_manifest*) &builtin_innobase_plugin; |
1775 | + builtin = (drizzled::plugin::Manifest*) &builtin_innobase_plugin; |
1776 | #endif |
1777 | |
1778 | for (sta = builtin->system_vars; *sta != NULL; sta++) { |
1779 | |
1780 | === modified file 'plugin/innobase/handler/win_delay_loader.cc' |
1781 | --- plugin/innobase/handler/win_delay_loader.cc 2009-04-11 00:30:51 +0000 |
1782 | +++ plugin/innobase/handler/win_delay_loader.cc 2009-07-15 21:00:16 +0000 |
1783 | @@ -76,7 +76,7 @@ |
1784 | The following is defined in ha_innodb.cc. It is used for copying the |
1785 | system variables from the builtin innodb plugin to the dynamic plugin. |
1786 | */ |
1787 | -extern struct drizzled_plugin_manifest* builtin_innobase_plugin_ptr; |
1788 | +extern drizzled::plugin::Manifest* builtin_innobase_plugin_ptr; |
1789 | |
1790 | /*********************************************************************** |
1791 | The preffered load-address defined in PE (portable executable format).*/ |
1792 | @@ -644,7 +644,7 @@ |
1793 | wdl_binlog_format_names, char*); |
1794 | |
1795 | /* It is fine if builtin_innobase_plugin is not available. */ |
1796 | - builtin_innobase_plugin_ptr = (struct drizzled_plugin_manifest*) |
1797 | + builtin_innobase_plugin_ptr = (drizzled::plugin::Manifest*) |
1798 | wdl_get_varaddr_from_map( |
1799 | hmod, |
1800 | "?builtin_innobase_plugin@@3PAUdrizzled_plugin_manifest@@A"); |
Contains Monty's build-cleanup and plugin class cleanup branches. All tests pass on Linux64, Solaris64, and MacOSX64, with only known exception of drizzledump failure on Solaris and myisamcheck failure on MacOSX.