Merge lp:~mordred/drizzle/plugin-slot-reorg into lp:~drizzle-trunk/drizzle/development
- plugin-slot-reorg
- Merge into development
Status: | Superseded |
---|---|
Proposed branch: | lp:~mordred/drizzle/plugin-slot-reorg |
Merge into: | lp:~drizzle-trunk/drizzle/development |
Diff against target: |
12726 lines 99 files modified
.bzrignore (+1/-0) drizzled/Makefile.am (+137/-132) drizzled/db.cc (+4/-2) drizzled/definitions.h (+1/-0) drizzled/drizzled.cc (+10/-8) drizzled/errmsg_print.cc (+5/-2) drizzled/ha_trx_info.cc (+4/-2) drizzled/ha_trx_info.h (+10/-3) drizzled/handler.cc (+15/-16) drizzled/handler.h (+11/-20) drizzled/handler_structs.h (+9/-2) drizzled/plugin.h (+33/-4) drizzled/plugin/authentication.h (+8/-0) drizzled/plugin/error_message.h (+14/-7) drizzled/plugin/info_schema_table.h (+10/-3) drizzled/plugin/listen_tcp.cc (+5/-1) drizzled/plugin/loader.cc (+0/-5) drizzled/plugin/logging.h (+15/-9) drizzled/plugin/query_cache.h (+8/-0) drizzled/plugin/registry.cc (+3/-98) drizzled/plugin/registry.h (+21/-32) drizzled/plugin/storage_engine.cc (+14/-683) drizzled/plugin/storage_engine.h (+22/-22) drizzled/registry.h (+1/-0) drizzled/replication_services.cc (+0/-22) drizzled/replication_services.h (+12/-9) drizzled/server_includes.h (+4/-4) drizzled/session.cc (+9/-6) drizzled/session.h (+3/-4) drizzled/set_var.cc (+6/-5) drizzled/set_var.h (+3/-3) drizzled/show.cc (+33/-117) drizzled/show.h (+9/-4) drizzled/slot/authentication.cc (+34/-23) drizzled/slot/authentication.h (+36/-10) drizzled/slot/command_applier.cc (+39/-0) drizzled/slot/command_applier.h (+46/-0) drizzled/slot/command_replicator.cc (+40/-0) drizzled/slot/command_replicator.h (+47/-0) drizzled/slot/error_message.cc (+31/-21) drizzled/slot/error_message.h (+34/-11) drizzled/slot/info_schema.cc (+150/-0) drizzled/slot/info_schema.h (+59/-0) drizzled/slot/logging.cc (+27/-17) drizzled/slot/logging.h (+30/-10) drizzled/slot/query_cache.cc (+113/-98) drizzled/slot/query_cache.h (+41/-21) drizzled/slot/scheduler.cc (+16/-18) drizzled/slot/scheduler.h (+43/-13) drizzled/slot/storage_engine.cc (+772/-0) drizzled/slot/storage_engine.h (+132/-0) drizzled/sql_base.cc (+4/-4) drizzled/sql_delete.cc (+3/-1) drizzled/sql_lex.h (+1/-1) drizzled/sql_parse.cc (+8/-5) drizzled/sql_plugin.h (+0/-65) drizzled/sql_select.cc (+1/-1) drizzled/sql_table.cc (+19/-14) drizzled/sql_table.h (+1/-1) drizzled/sql_yacc.yy (+4/-4) drizzled/statement/alter_table.cc (+9/-7) drizzled/statement/rename_table.cc (+4/-3) drizzled/table.cc (+3/-1) drizzled/table_list.h (+10/-3) drizzled/table_proto_write.cc (+1/-1) drizzled/table_share.h (+2/-2) drizzled/xid.h (+1/-1) plugin/archive/ha_archive.cc (+12/-10) plugin/archive/ha_archive.h (+1/-1) plugin/auth_http/auth_http.cc (+4/-4) plugin/auth_pam/auth_pam.cc (+4/-4) plugin/blackhole/ha_blackhole.cc (+6/-6) plugin/blackhole/ha_blackhole.h (+1/-1) plugin/command_log/command_log.cc (+8/-7) plugin/csv/ha_tina.cc (+5/-5) plugin/csv/ha_tina.h (+1/-1) plugin/default_replicator/default_replicator.cc (+2/-2) plugin/errmsg_stderr/errmsg_stderr.cc (+4/-4) plugin/filtered_replicator/filtered_replicator.cc (+2/-2) plugin/heap/ha_heap.cc (+8/-5) plugin/heap/ha_heap.h (+1/-1) plugin/info_schema/info_schema.cc (+188/-187) plugin/info_schema/info_schema_columns.cc (+145/-145) plugin/info_schema/info_schema_columns.h (+33/-33) plugin/info_schema/info_schema_methods.cc (+13/-13) plugin/info_schema/info_schema_methods.h (+25/-21) plugin/innobase/handler/ha_innodb.cc (+20/-18) plugin/innobase/handler/ha_innodb.h (+2/-1) plugin/innobase/handler/i_s.cc (+65/-65) plugin/innobase/handler/i_s.h (+48/-48) plugin/logging_gearman/logging_gearman.cc (+9/-7) plugin/logging_query/logging_query.cc (+7/-5) plugin/logging_syslog/logging_syslog.cc (+7/-5) plugin/multi_thread/multi_thread.cc (+2/-2) plugin/myisam/ha_myisam.cc (+21/-19) plugin/myisam/ha_myisam.h (+1/-1) plugin/pool_of_threads/pool_of_threads.cc (+2/-2) plugin/single_thread/single_thread.cc (+2/-2) po/de.po (+695/-704) |
To merge this branch: | bzr merge lp:~mordred/drizzle/plugin-slot-reorg |
Related bugs: | |
Related blueprints: |
Finish plugin to slot reorganization
(Essential)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jay Pipes (community) | Needs Fixing | ||
Review via email: mp+12368@code.launchpad.net |
This proposal supersedes a proposal from 2009-09-23.
This proposal has been superseded by a proposal from 2009-09-24.
Commit message
Description of the change
Monty Taylor (mordred) wrote : Posted in a previous version of this proposal | # |
Jay Pipes (jaypipes) wrote : Posted in a previous version of this proposal | # |
Please merge with trunk :)
Jay Pipes (jaypipes) wrote : | # |
Overall, the patch is fantastic and cleans up a crap-ton of code.
However, there is *one* thing that I'd like to see changed. You changed InfoSchemaTable to plugin::InfoSchema. I find this confusing, especially given the slot::InfoSchema.
Basically, slot::InfoSchema is correct, but plugin::InfoSchema should, IMHO, be plugin:
Monty Taylor (mordred) wrote : | # |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jay Pipes wrote:
> Review: Needs Fixing Overall, the patch is fantastic and cleans up a
> crap-ton of code.
>
> However, there is *one* thing that I'd like to see changed. You
> changed InfoSchemaTable to plugin::InfoSchema. I find this
> confusing, especially given the slot::InfoSchema.
>
> Basically, slot::InfoSchema is correct, but plugin::InfoSchema
> should, IMHO, be plugin:
> Because plugin::InfoSchema is actually the table/view, not the schema
> itself.
Fair enough.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAkq
RQAAoJpUT5y4whs
=KDz2
-----END PGP SIGNATURE-----
- 1137. By Monty Taylor
-
Renamed plugin::InfoSchema to plugin:
:InfoSchemaTabl e as per Jay. - 1138. By Monty Taylor
-
Added polymorphic add/remove methods around slot add/remove methods.
- 1139. By Monty Taylor
-
Changed some plugins from including slots to include plugins. Oops.
- 1140. By Monty Taylor
-
Renamed namespace slot to namespace service.
- 1141. By Monty Taylor
-
Merged with trunk.
- 1142. By Monty Taylor
-
Moved service stuff into plugin/
- 1143. By Monty Taylor
-
Moved some simple methods back into header to they can be inlined. Removed a couple wrapper methods.
- 1144. By Monty Taylor
-
Merged in trunk.
- 1145. By Monty Taylor
-
Merged trunk.
- 1146. By Monty Taylor
-
Fixed naming issue.
- 1147. By Monty Taylor
-
Fixed query_cache naming.
- 1148. By Monty Taylor
-
Changed ::add() and ::remove() to ::addPlugin() and ::removePlugin() so that
we don't co-opt useful names "add" and "remove". - 1149. By Monty Taylor
-
Added error reporting to plugin registration.
Unmerged revisions
Preview Diff
1 | === modified file '.bzrignore' |
2 | --- .bzrignore 2009-08-03 14:23:22 +0000 |
3 | +++ .bzrignore 2009-09-24 21:11:10 +0000 |
4 | @@ -275,3 +275,4 @@ |
5 | drizzled/message/command_reader |
6 | TAGS |
7 | *replication.pb.* |
8 | +drizzled/message/table_raw_reader |
9 | |
10 | === modified file 'drizzled/Makefile.am' |
11 | --- drizzled/Makefile.am 2009-09-23 17:01:21 +0000 |
12 | +++ drizzled/Makefile.am 2009-09-24 21:11:10 +0000 |
13 | @@ -38,53 +38,10 @@ |
14 | atomic/pthread_traits.h \ |
15 | atomic/sun_studio.h \ |
16 | atomics.h \ |
17 | - authentication.h \ |
18 | base.h \ |
19 | cached_item.h \ |
20 | calendar.h \ |
21 | check_stack_overrun.h \ |
22 | - statement.h \ |
23 | - statement/alter_schema.h \ |
24 | - statement/alter_table.h \ |
25 | - statement/analyze.h \ |
26 | - statement/change_schema.h \ |
27 | - statement/check.h \ |
28 | - statement/checksum.h \ |
29 | - statement/commit.h \ |
30 | - statement/create_index.h \ |
31 | - statement/create_schema.h \ |
32 | - statement/create_table.h \ |
33 | - statement/delete.h \ |
34 | - statement/drop_index.h \ |
35 | - statement/drop_schema.h \ |
36 | - statement/drop_table.h \ |
37 | - statement/empty_query.h \ |
38 | - statement/flush.h \ |
39 | - statement/insert.h \ |
40 | - statement/insert_select.h \ |
41 | - statement/kill.h \ |
42 | - statement/load.h \ |
43 | - statement/optimize.h \ |
44 | - statement/release_savepoint.h \ |
45 | - statement/rename_table.h \ |
46 | - statement/replace.h \ |
47 | - statement/replace_select.h \ |
48 | - statement/rollback.h \ |
49 | - statement/rollback_to_savepoint.h \ |
50 | - statement/savepoint.h \ |
51 | - statement/select.h \ |
52 | - statement/set_option.h \ |
53 | - statement/show_create.h \ |
54 | - statement/show_create_schema.h \ |
55 | - statement/show_engine_status.h \ |
56 | - statement/show_errors.h \ |
57 | - statement/show_processlist.h \ |
58 | - statement/show_status.h \ |
59 | - statement/show_warnings.h \ |
60 | - statement/start_transaction.h \ |
61 | - statement/truncate.h \ |
62 | - statement/unlock_tables.h \ |
63 | - statement/update.h \ |
64 | common.h \ |
65 | comp_creator.h \ |
66 | cost_vect.h \ |
67 | @@ -98,7 +55,6 @@ |
68 | dtcollation.h \ |
69 | enum.h \ |
70 | enum_nested_loop_state.h \ |
71 | - errmsg.h \ |
72 | errmsg_print.h \ |
73 | error.h \ |
74 | field.h \ |
75 | @@ -240,7 +196,6 @@ |
76 | hybrid_type_traits_decimal.h \ |
77 | hybrid_type_traits_integer.h \ |
78 | index_hint.h \ |
79 | - info_schema.h \ |
80 | internal_error_handler.h \ |
81 | item.h \ |
82 | item/basic_constant.h \ |
83 | @@ -293,7 +248,6 @@ |
84 | lex_string.h \ |
85 | lex_symbol.h \ |
86 | lock.h \ |
87 | - logging.h \ |
88 | lookup_symbol.h \ |
89 | my_decimal.h\ |
90 | my_var.h \ |
91 | @@ -302,36 +256,35 @@ |
92 | natural_join_column.h \ |
93 | nested_join.h \ |
94 | open_tables_state.h \ |
95 | + opt_range.h \ |
96 | optimizer/key_field.h \ |
97 | optimizer/position.h \ |
98 | optimizer/sargable_param.h \ |
99 | - opt_range.h \ |
100 | order.h \ |
101 | plugin.h \ |
102 | - plugin/registry.h \ |
103 | + plugin/authentication.h \ |
104 | + plugin/client.h \ |
105 | plugin/command_applier.h \ |
106 | plugin/command_reader.h \ |
107 | plugin/command_replicator.h \ |
108 | - plugin/authentication.h \ |
109 | - plugin/client.h \ |
110 | - plugin/error_message_handler.h \ |
111 | + plugin/error_message.h \ |
112 | plugin/function.h \ |
113 | plugin/handle.h \ |
114 | + plugin/info_schema_table.h \ |
115 | plugin/library.h \ |
116 | plugin/listen.h \ |
117 | plugin/listen_tcp.h \ |
118 | - plugin/logging_handler.h \ |
119 | + plugin/logging.h \ |
120 | plugin/manifest.h \ |
121 | plugin/null_client.h \ |
122 | - plugin/qcache.h \ |
123 | + plugin/query_cache.h \ |
124 | + plugin/registry.h \ |
125 | plugin/scheduler.h \ |
126 | plugin/storage_engine.h \ |
127 | probes.h \ |
128 | - qcache.h \ |
129 | query_id.h \ |
130 | registry.h \ |
131 | replication_services.h \ |
132 | - scheduling.h \ |
133 | security_context.h \ |
134 | select_create.h \ |
135 | select_dump.h \ |
136 | @@ -350,8 +303,17 @@ |
137 | session.h \ |
138 | set_var.h \ |
139 | show.h \ |
140 | + slot/authentication.h \ |
141 | + slot/command_replicator.h \ |
142 | + slot/command_applier.h \ |
143 | + slot/error_message.h \ |
144 | slot/function.h \ |
145 | + slot/info_schema.h \ |
146 | slot/listen.h \ |
147 | + slot/logging.h \ |
148 | + slot/query_cache.h \ |
149 | + slot/scheduler.h \ |
150 | + slot/storage_engine.h \ |
151 | sql_alloc.h \ |
152 | sql_array.h \ |
153 | sql_base.h \ |
154 | @@ -362,7 +324,6 @@ |
155 | sql_load.h \ |
156 | sql_locale.h \ |
157 | sql_parse.h \ |
158 | - sql_plugin.h \ |
159 | sql_select.h \ |
160 | sql_sort.h \ |
161 | sql_state.h \ |
162 | @@ -370,6 +331,48 @@ |
163 | sql_table.h \ |
164 | sql_union.h \ |
165 | stacktrace.h \ |
166 | + statement.h \ |
167 | + statement/alter_schema.h \ |
168 | + statement/alter_table.h \ |
169 | + statement/analyze.h \ |
170 | + statement/change_schema.h \ |
171 | + statement/check.h \ |
172 | + statement/checksum.h \ |
173 | + statement/commit.h \ |
174 | + statement/create_index.h \ |
175 | + statement/create_schema.h \ |
176 | + statement/create_table.h \ |
177 | + statement/delete.h \ |
178 | + statement/drop_index.h \ |
179 | + statement/drop_schema.h \ |
180 | + statement/drop_table.h \ |
181 | + statement/empty_query.h \ |
182 | + statement/flush.h \ |
183 | + statement/insert.h \ |
184 | + statement/insert_select.h \ |
185 | + statement/kill.h \ |
186 | + statement/load.h \ |
187 | + statement/optimize.h \ |
188 | + statement/release_savepoint.h \ |
189 | + statement/rename_table.h \ |
190 | + statement/replace.h \ |
191 | + statement/replace_select.h \ |
192 | + statement/rollback.h \ |
193 | + statement/rollback_to_savepoint.h \ |
194 | + statement/savepoint.h \ |
195 | + statement/select.h \ |
196 | + statement/set_option.h \ |
197 | + statement/show_create.h \ |
198 | + statement/show_create_schema.h \ |
199 | + statement/show_engine_status.h \ |
200 | + statement/show_errors.h \ |
201 | + statement/show_processlist.h \ |
202 | + statement/show_status.h \ |
203 | + statement/show_warnings.h \ |
204 | + statement/start_transaction.h \ |
205 | + statement/truncate.h \ |
206 | + statement/unlock_tables.h \ |
207 | + statement/update.h \ |
208 | stored_key.h \ |
209 | structs.h \ |
210 | symbol_hash.h \ |
211 | @@ -377,8 +380,8 @@ |
212 | table_ident.h \ |
213 | table_list.h \ |
214 | table_map_iterator.h \ |
215 | + table_proto.h \ |
216 | table_reference.h \ |
217 | - table_proto.h \ |
218 | table_share.h \ |
219 | temporal.h \ |
220 | temporal_format.h \ |
221 | @@ -388,11 +391,11 @@ |
222 | tztime.h \ |
223 | unique.h \ |
224 | unireg.h \ |
225 | + user_var_entry.h \ |
226 | utf8.h \ |
227 | utf8/checked.h \ |
228 | utf8/core.h \ |
229 | utf8/unchecked.h \ |
230 | - user_var_entry.h \ |
231 | xid.h |
232 | |
233 | noinst_LTLIBRARIES = \ |
234 | @@ -423,66 +426,24 @@ |
235 | |
236 | drizzled_SOURCES = \ |
237 | alter_info.cc \ |
238 | - authentication.cc \ |
239 | cached_item.cc \ |
240 | calendar.cc \ |
241 | check_stack_overrun.cc \ |
242 | - statement/alter_schema.cc \ |
243 | - statement/alter_table.cc \ |
244 | - statement/analyze.cc \ |
245 | - statement/change_schema.cc \ |
246 | - statement/check.cc \ |
247 | - statement/checksum.cc \ |
248 | - statement/commit.cc \ |
249 | - statement/create_index.cc \ |
250 | - statement/create_schema.cc \ |
251 | - statement/create_table.cc \ |
252 | - statement/delete.cc \ |
253 | - statement/drop_index.cc \ |
254 | - statement/drop_schema.cc \ |
255 | - statement/drop_table.cc \ |
256 | - statement/empty_query.cc \ |
257 | - statement/flush.cc \ |
258 | - statement/insert.cc \ |
259 | - statement/insert_select.cc \ |
260 | - statement/kill.cc \ |
261 | - statement/load.cc \ |
262 | - statement/optimize.cc \ |
263 | - statement/release_savepoint.cc \ |
264 | - statement/rename_table.cc \ |
265 | - statement/replace.cc \ |
266 | - statement/replace_select.cc \ |
267 | - statement/rollback.cc \ |
268 | - statement/rollback_to_savepoint.cc \ |
269 | - statement/savepoint.cc \ |
270 | - statement/select.cc \ |
271 | - statement/set_option.cc \ |
272 | - statement/show_create.cc \ |
273 | - statement/show_create_schema.cc \ |
274 | - statement/show_engine_status.cc \ |
275 | - statement/show_errors.cc \ |
276 | - statement/show_processlist.cc \ |
277 | - statement/show_status.cc \ |
278 | - statement/show_warnings.cc \ |
279 | - statement/start_transaction.cc \ |
280 | - statement/truncate.cc \ |
281 | - statement/unlock_tables.cc \ |
282 | - statement/update.cc \ |
283 | comp_creator.cc \ |
284 | create_field.cc \ |
285 | current_session.cc \ |
286 | diagnostics_area.cc \ |
287 | drizzled.cc \ |
288 | dtcollation.cc \ |
289 | - errmsg.cc \ |
290 | + errmsg_print.cc \ |
291 | error.cc \ |
292 | - errmsg_print.cc \ |
293 | + field.cc \ |
294 | field/blob.cc \ |
295 | field/date.cc \ |
296 | field/datetime.cc \ |
297 | - field/enum.cc \ |
298 | field/decimal.cc \ |
299 | field/double.cc \ |
300 | + field/enum.cc \ |
301 | field/int64_t.cc \ |
302 | field/long.cc \ |
303 | field/null.cc \ |
304 | @@ -491,7 +452,6 @@ |
305 | field/str.cc \ |
306 | field/timestamp.cc \ |
307 | field/varstring.cc \ |
308 | - field.cc \ |
309 | field_conv.cc \ |
310 | field_iterator.cc \ |
311 | filesort.cc \ |
312 | @@ -507,17 +467,6 @@ |
313 | function/get_user_var.cc \ |
314 | function/last_insert.cc \ |
315 | function/locate.cc \ |
316 | - function/min_max.cc \ |
317 | - function/num1.cc \ |
318 | - function/numhybrid.cc \ |
319 | - function/num_op.cc \ |
320 | - function/row_count.cc \ |
321 | - function/set_user_var.cc \ |
322 | - function/sign.cc \ |
323 | - function/signed.cc \ |
324 | - function/units.cc \ |
325 | - function/unsigned.cc \ |
326 | - function/user_var_as_out_param.cc \ |
327 | function/math/abs.cc \ |
328 | function/math/acos.cc \ |
329 | function/math/asin.cc \ |
330 | @@ -528,10 +477,10 @@ |
331 | function/math/divide.cc \ |
332 | function/math/exp.cc \ |
333 | function/math/floor.cc \ |
334 | + function/math/int.cc \ |
335 | function/math/int_divide.cc \ |
336 | + function/math/int_val.cc \ |
337 | function/math/integer.cc \ |
338 | - function/math/int.cc \ |
339 | - function/math/int_val.cc \ |
340 | function/math/ln.cc \ |
341 | function/math/log.cc \ |
342 | function/math/minus.cc \ |
343 | @@ -547,6 +496,14 @@ |
344 | function/math/sin.cc \ |
345 | function/math/sqrt.cc \ |
346 | function/math/tan.cc \ |
347 | + function/min_max.cc \ |
348 | + function/num1.cc \ |
349 | + function/num_op.cc \ |
350 | + function/numhybrid.cc \ |
351 | + function/row_count.cc \ |
352 | + function/set_user_var.cc \ |
353 | + function/sign.cc \ |
354 | + function/signed.cc \ |
355 | function/str/alloc_buffer.cc \ |
356 | function/str/binary.cc \ |
357 | function/str/char.cc \ |
358 | @@ -583,8 +540,8 @@ |
359 | function/time/date_format.cc \ |
360 | function/time/dayname.cc \ |
361 | function/time/dayofmonth.cc \ |
362 | + function/time/dayofyear.cc \ |
363 | function/time/extract.cc \ |
364 | - function/time/dayofyear.cc \ |
365 | function/time/from_days.cc \ |
366 | function/time/from_unixtime.cc \ |
367 | function/time/hour.cc \ |
368 | @@ -594,9 +551,9 @@ |
369 | function/time/minute.cc \ |
370 | function/time/month.cc \ |
371 | function/time/now.cc \ |
372 | - function/time/quarter.cc \ |
373 | function/time/period_add.cc \ |
374 | function/time/period_diff.cc \ |
375 | + function/time/quarter.cc \ |
376 | function/time/second.cc \ |
377 | function/time/sysdate_local.cc \ |
378 | function/time/timestamp_diff.cc \ |
379 | @@ -605,11 +562,15 @@ |
380 | function/time/unix_timestamp.cc \ |
381 | function/time/weekday.cc \ |
382 | function/time/year.cc \ |
383 | + function/units.cc \ |
384 | + function/unsigned.cc \ |
385 | + function/user_var_as_out_param.cc \ |
386 | ha_trx_info.cc \ |
387 | hybrid_type_traits.cc \ |
388 | hybrid_type_traits_decimal.cc \ |
389 | hybrid_type_traits_integer.cc \ |
390 | index_hint.cc \ |
391 | + item.cc \ |
392 | item/bin_string.cc \ |
393 | item/cache.cc \ |
394 | item/cache_decimal.cc \ |
395 | @@ -627,10 +588,10 @@ |
396 | item/field.cc \ |
397 | item/float.cc \ |
398 | item/hex_string.cc \ |
399 | + item/ident.cc \ |
400 | item/insert_value.cc \ |
401 | + item/int.cc \ |
402 | item/int_with_ref.cc \ |
403 | - item/ident.cc \ |
404 | - item/int.cc \ |
405 | item/null.cc \ |
406 | item/num.cc \ |
407 | item/outer_ref.cc \ |
408 | @@ -643,32 +604,40 @@ |
409 | item/sum.cc \ |
410 | item/type_holder.cc \ |
411 | item/uint.cc \ |
412 | - item.cc \ |
413 | join.cc \ |
414 | join_cache.cc \ |
415 | join_table.cc \ |
416 | key.cc \ |
417 | key_map.cc \ |
418 | lock.cc \ |
419 | - logging.cc \ |
420 | lookup_symbol.cc \ |
421 | my_decimal.cc \ |
422 | name_resolution_context_state.cc \ |
423 | natural_join_column.cc \ |
424 | - optimizer/key_field.cc \ |
425 | opt_range.cc \ |
426 | opt_sum.cc \ |
427 | + optimizer/key_field.cc \ |
428 | plugin/listen_tcp.cc \ |
429 | + plugin/loader.cc \ |
430 | plugin/registry.cc \ |
431 | - qcache.cc \ |
432 | query_id.cc \ |
433 | records.cc \ |
434 | - scheduling.cc \ |
435 | + replication_services.cc \ |
436 | session.cc \ |
437 | set_var.cc \ |
438 | show.cc \ |
439 | + slot/authentication.cc \ |
440 | + slot/command_replicator.cc \ |
441 | + slot/command_applier.cc \ |
442 | + slot/error_message.cc \ |
443 | slot/function.cc \ |
444 | + slot/info_schema.cc \ |
445 | slot/listen.cc \ |
446 | + slot/logging.cc \ |
447 | + slot/query_cache.cc \ |
448 | + slot/scheduler.cc \ |
449 | + slot/storage_engine.cc \ |
450 | + sql_alloc.cc \ |
451 | sql_base.cc \ |
452 | sql_delete.cc \ |
453 | sql_derived.cc \ |
454 | @@ -679,7 +648,6 @@ |
455 | sql_load.cc \ |
456 | sql_locale.cc \ |
457 | sql_parse.cc \ |
458 | - sql_plugin.cc \ |
459 | sql_select.cc \ |
460 | sql_state.cc \ |
461 | sql_string.cc \ |
462 | @@ -688,17 +656,56 @@ |
463 | sql_update.cc \ |
464 | sql_yacc.yy \ |
465 | stacktrace.cc \ |
466 | + statement/alter_schema.cc \ |
467 | + statement/alter_table.cc \ |
468 | + statement/analyze.cc \ |
469 | + statement/change_schema.cc \ |
470 | + statement/check.cc \ |
471 | + statement/checksum.cc \ |
472 | + statement/commit.cc \ |
473 | + statement/create_index.cc \ |
474 | + statement/create_schema.cc \ |
475 | + statement/create_table.cc \ |
476 | + statement/delete.cc \ |
477 | + statement/drop_index.cc \ |
478 | + statement/drop_schema.cc \ |
479 | + statement/drop_table.cc \ |
480 | + statement/empty_query.cc \ |
481 | + statement/flush.cc \ |
482 | + statement/insert.cc \ |
483 | + statement/insert_select.cc \ |
484 | + statement/kill.cc \ |
485 | + statement/load.cc \ |
486 | + statement/optimize.cc \ |
487 | + statement/release_savepoint.cc \ |
488 | + statement/rename_table.cc \ |
489 | + statement/replace.cc \ |
490 | + statement/replace_select.cc \ |
491 | + statement/rollback.cc \ |
492 | + statement/rollback_to_savepoint.cc \ |
493 | + statement/savepoint.cc \ |
494 | + statement/select.cc \ |
495 | + statement/set_option.cc \ |
496 | + statement/show_create.cc \ |
497 | + statement/show_create_schema.cc \ |
498 | + statement/show_engine_status.cc \ |
499 | + statement/show_errors.cc \ |
500 | + statement/show_processlist.cc \ |
501 | + statement/show_status.cc \ |
502 | + statement/show_warnings.cc \ |
503 | + statement/start_transaction.cc \ |
504 | + statement/truncate.cc \ |
505 | + statement/unlock_tables.cc \ |
506 | + statement/update.cc \ |
507 | strfunc.cc \ |
508 | table.cc \ |
509 | table_list.cc \ |
510 | - table_map_iterator.cc \ |
511 | + table_map_iterator.cc \ |
512 | table_share.cc \ |
513 | temporal.cc \ |
514 | temporal_format.cc \ |
515 | temporal_interval.cc \ |
516 | - thr_malloc.cc \ |
517 | time.cc \ |
518 | - replication_services.cc \ |
519 | tztime.cc \ |
520 | uniques.cc \ |
521 | user_var_entry.cc \ |
522 | @@ -719,7 +726,6 @@ |
523 | plugin/storage_engine.h.gch \ |
524 | sql_base.h.gch \ |
525 | sql_parse.h.gch \ |
526 | - sql_plugin.h.gch \ |
527 | util/convert.h.gch \ |
528 | util/test.h.gch |
529 | else |
530 | @@ -735,7 +741,6 @@ |
531 | $(PCHHEADERS) |
532 | |
533 | EXTRA_DIST = \ |
534 | - plugin/config.h.in \ |
535 | $(BUILT_MAINT_SRC) \ |
536 | symbol_hash.gperf \ |
537 | function_hash.gperf \ |
538 | |
539 | === modified file 'drizzled/db.cc' |
540 | --- drizzled/db.cc 2009-08-19 23:35:29 +0000 |
541 | +++ drizzled/db.cc 2009-09-24 21:11:10 +0000 |
542 | @@ -38,8 +38,6 @@ |
543 | |
544 | using namespace drizzled; |
545 | |
546 | -extern drizzled::ReplicationServices replication_services; |
547 | - |
548 | #define MY_DB_OPT_FILE "db.opt" |
549 | #define MAX_DROP_TABLE_Q_LEN 1024 |
550 | |
551 | @@ -190,6 +188,7 @@ |
552 | |
553 | bool mysql_create_db(Session *session, const char *db, HA_CREATE_INFO *create_info) |
554 | { |
555 | + ReplicationServices &replication_services= ReplicationServices::singleton(); |
556 | char path[FN_REFLEN+16]; |
557 | long result= 1; |
558 | int error_erno; |
559 | @@ -277,6 +276,7 @@ |
560 | |
561 | bool mysql_alter_db(Session *session, const char *db, HA_CREATE_INFO *create_info) |
562 | { |
563 | + ReplicationServices &replication_services= ReplicationServices::singleton(); |
564 | long result=1; |
565 | int error= 0; |
566 | char path[FN_REFLEN+16]; |
567 | @@ -420,6 +420,7 @@ |
568 | query= session->query; |
569 | query_length= session->query_length; |
570 | } |
571 | + ReplicationServices &replication_services= ReplicationServices::singleton(); |
572 | replication_services.rawStatement(session, session->getQueryString(), session->getQueryLength()); |
573 | session->clear_error(); |
574 | session->server_status|= SERVER_STATUS_DB_DROPPED; |
575 | @@ -438,6 +439,7 @@ |
576 | query_end= query + MAX_DROP_TABLE_Q_LEN; |
577 | db_len= strlen(db); |
578 | |
579 | + ReplicationServices &replication_services= ReplicationServices::singleton(); |
580 | for (tbl= dropped_tables; tbl; tbl= tbl->next_local) |
581 | { |
582 | uint32_t tbl_name_len; |
583 | |
584 | === modified file 'drizzled/definitions.h' |
585 | --- drizzled/definitions.h 2009-08-22 02:06:02 +0000 |
586 | +++ drizzled/definitions.h 2009-09-24 21:11:10 +0000 |
587 | @@ -329,6 +329,7 @@ |
588 | typedef uint64_t query_id_t; |
589 | typedef void *range_seq_t; |
590 | |
591 | +enum ha_stat_type { HA_ENGINE_STATUS, HA_ENGINE_LOGS, HA_ENGINE_MUTEX }; |
592 | // the following is for checking tables |
593 | |
594 | #define HA_ADMIN_ALREADY_DONE 1 |
595 | |
596 | === modified file 'drizzled/drizzled.cc' |
597 | --- drizzled/drizzled.cc 2009-09-23 21:40:36 +0000 |
598 | +++ drizzled/drizzled.cc 2009-09-24 21:11:10 +0000 |
599 | @@ -39,12 +39,12 @@ |
600 | #include <drizzled/session.h> |
601 | #include <drizzled/db.h> |
602 | #include <drizzled/item/create.h> |
603 | -#include <drizzled/errmsg.h> |
604 | #include <drizzled/unireg.h> |
605 | -#include <drizzled/scheduling.h> |
606 | #include "drizzled/temporal_format.h" /* For init_temporal_formats() */ |
607 | #include "drizzled/slot/listen.h" |
608 | +#include "drizzled/slot/error_message.h" |
609 | #include "drizzled/plugin/client.h" |
610 | +#include "drizzled/plugin/scheduler.h" |
611 | #include "drizzled/probes.h" |
612 | |
613 | #include <google/protobuf/stubs/common.h> |
614 | @@ -243,10 +243,10 @@ |
615 | size_t my_thread_stack_size= 65536; |
616 | |
617 | /* |
618 | - Legacy global StorageEngine. These will be removed (please do not add more). |
619 | + Legacy global plugin::StorageEngine. These will be removed (please do not add more). |
620 | */ |
621 | -StorageEngine *heap_engine; |
622 | -StorageEngine *myisam_engine; |
623 | +plugin::StorageEngine *heap_engine; |
624 | +plugin::StorageEngine *myisam_engine; |
625 | |
626 | char* opt_secure_file_priv= 0; |
627 | |
628 | @@ -1391,7 +1391,7 @@ |
629 | scheduler_name= opt_scheduler_default; |
630 | } |
631 | |
632 | - if (set_scheduler_factory(scheduler_name)) |
633 | + if (plugins.scheduler.setFactory(scheduler_name)) |
634 | { |
635 | errmsg_printf(ERRMSG_LVL_ERROR, |
636 | _("No scheduler found, cannot continue!\n")); |
637 | @@ -1420,7 +1420,7 @@ |
638 | if (default_storage_engine_str) |
639 | { |
640 | const std::string name(default_storage_engine_str); |
641 | - StorageEngine *engine; |
642 | + plugin::StorageEngine *engine; |
643 | |
644 | engine= ha_resolve_by_name(0, name); |
645 | if (engine == NULL) |
646 | @@ -2403,13 +2403,15 @@ |
647 | |
648 | void option_error_reporter(enum loglevel level, const char *format, ...) |
649 | { |
650 | + plugin::Registry &plugins= plugin::Registry::singleton(); |
651 | + |
652 | va_list args; |
653 | va_start(args, format); |
654 | |
655 | /* Don't print warnings for --loose options during bootstrap */ |
656 | if (level == ERROR_LEVEL || global_system_variables.log_warnings) |
657 | { |
658 | - errmsg_vprintf (current_session, ERROR_LEVEL, format, args); |
659 | + plugins.error_message.vprintf(current_session, ERROR_LEVEL, format, args); |
660 | } |
661 | va_end(args); |
662 | } |
663 | |
664 | === modified file 'drizzled/errmsg_print.cc' |
665 | --- drizzled/errmsg_print.cc 2009-07-07 09:06:29 +0000 |
666 | +++ drizzled/errmsg_print.cc 2009-09-24 21:11:10 +0000 |
667 | @@ -23,13 +23,15 @@ |
668 | */ |
669 | |
670 | #include <drizzled/server_includes.h> |
671 | -#include <drizzled/errmsg.h> |
672 | +#include <drizzled/plugin/registry.h> |
673 | #include <drizzled/errmsg_print.h> |
674 | #include <drizzled/current_session.h> |
675 | |
676 | // need this for stderr |
677 | #include <string.h> |
678 | |
679 | +using namespace drizzled; |
680 | + |
681 | void sql_perror(const char *message) |
682 | { |
683 | // is stderr threadsafe? |
684 | @@ -38,10 +40,11 @@ |
685 | |
686 | bool errmsg_printf (int priority, char const *format, ...) |
687 | { |
688 | + plugin::Registry &plugins= plugin::Registry::singleton(); |
689 | bool rv; |
690 | va_list args; |
691 | va_start(args, format); |
692 | - rv= errmsg_vprintf(current_session, priority, format, args); |
693 | + rv= plugins.error_message.vprintf(current_session, priority, format, args); |
694 | va_end(args); |
695 | return rv; |
696 | } |
697 | |
698 | === modified file 'drizzled/ha_trx_info.cc' |
699 | --- drizzled/ha_trx_info.cc 2009-03-25 08:39:58 +0000 |
700 | +++ drizzled/ha_trx_info.cc 2009-09-24 21:11:10 +0000 |
701 | @@ -22,8 +22,10 @@ |
702 | #include <drizzled/plugin/storage_engine.h> |
703 | #include <drizzled/session.h> |
704 | |
705 | +using namespace drizzled; |
706 | |
707 | -void Ha_trx_info::register_ha(Session_TRANS *trans, StorageEngine *engine_arg) |
708 | +void Ha_trx_info::register_ha(Session_TRANS *trans, |
709 | + plugin::StorageEngine *engine_arg) |
710 | { |
711 | assert(m_flags == 0); |
712 | assert(m_engine == NULL); |
713 | @@ -86,7 +88,7 @@ |
714 | } |
715 | |
716 | |
717 | -StorageEngine *Ha_trx_info::engine() const |
718 | +plugin::StorageEngine *Ha_trx_info::engine() const |
719 | { |
720 | assert(is_started()); |
721 | return m_engine; |
722 | |
723 | === modified file 'drizzled/ha_trx_info.h' |
724 | --- drizzled/ha_trx_info.h 2009-03-25 08:39:58 +0000 |
725 | +++ drizzled/ha_trx_info.h 2009-09-24 21:11:10 +0000 |
726 | @@ -22,7 +22,13 @@ |
727 | |
728 | |
729 | class Session_TRANS; |
730 | +namespace drizzled |
731 | +{ |
732 | +namespace plugin |
733 | +{ |
734 | class StorageEngine; |
735 | +} |
736 | +} |
737 | |
738 | /** |
739 | Either statement transaction or normal transaction - related |
740 | @@ -45,7 +51,8 @@ |
741 | { |
742 | public: |
743 | /** Register this storage engine in the given transaction context. */ |
744 | - void register_ha(Session_TRANS *trans, StorageEngine *engine_arg); |
745 | + void register_ha(Session_TRANS *trans, |
746 | + drizzled::plugin::StorageEngine *engine_arg); |
747 | |
748 | /** Clear, prepare for reuse. */ |
749 | void reset(); |
750 | @@ -58,7 +65,7 @@ |
751 | /** Mark this transaction read-write if the argument is read-write. */ |
752 | void coalesce_trx_with(const Ha_trx_info *stmt_trx); |
753 | Ha_trx_info *next() const; |
754 | - StorageEngine *engine() const; |
755 | + drizzled::plugin::StorageEngine *engine() const; |
756 | |
757 | private: |
758 | enum { TRX_READ_ONLY= 0, TRX_READ_WRITE= 1 }; |
759 | @@ -69,7 +76,7 @@ |
760 | for the same storage engine, 'engine' is not-NULL only when the |
761 | corresponding storage is a part of a transaction. |
762 | */ |
763 | - StorageEngine *m_engine; |
764 | + drizzled::plugin::StorageEngine *m_engine; |
765 | /** |
766 | Transaction flags related to this engine. |
767 | Not-null only if this instance is a part of transaction. |
768 | |
769 | === modified file 'drizzled/handler.cc' |
770 | --- drizzled/handler.cc 2009-09-23 21:40:36 +0000 |
771 | +++ drizzled/handler.cc 2009-09-24 21:11:10 +0000 |
772 | @@ -44,8 +44,6 @@ |
773 | using namespace std; |
774 | using namespace drizzled; |
775 | |
776 | -extern drizzled::ReplicationServices replication_services; |
777 | - |
778 | KEY_CREATE_INFO default_key_create_info= { HA_KEY_ALG_UNDEF, 0, {NULL,0} }; |
779 | |
780 | /* number of entries in storage_engines[] */ |
781 | @@ -365,7 +363,7 @@ |
782 | in each engine independently. The two-phase commit protocol |
783 | is used only if: |
784 | - all participating engines support two-phase commit (provide |
785 | - StorageEngine::prepare PSEA API call) and |
786 | + plugin::StorageEngine::prepare PSEA API call) and |
787 | - transactions in at least two engines modify data (i.e. are |
788 | not read-only). |
789 | |
790 | @@ -429,10 +427,10 @@ |
791 | |
792 | At the end of a statement, server call |
793 | ha_autocommit_or_rollback() is invoked. This call in turn |
794 | - invokes StorageEngine::prepare() for every involved engine. |
795 | - Prepare is followed by a call to StorageEngine::commit_one_phase() |
796 | - If a one-phase commit will suffice, StorageEngine::prepare() is not |
797 | - invoked and the server only calls StorageEngine::commit_one_phase(). |
798 | + invokes plugin::StorageEngine::prepare() for every involved engine. |
799 | + Prepare is followed by a call to plugin::StorageEngine::commit_one_phase() |
800 | + If a one-phase commit will suffice, plugin::StorageEngine::prepare() is not |
801 | + invoked and the server only calls plugin::StorageEngine::commit_one_phase(). |
802 | At statement commit, the statement-related read-write engine |
803 | flag is propagated to the corresponding flag in the normal |
804 | transaction. When the commit is complete, the list of registered |
805 | @@ -491,7 +489,7 @@ |
806 | times per transaction. |
807 | |
808 | */ |
809 | -void trans_register_ha(Session *session, bool all, StorageEngine *engine) |
810 | +void trans_register_ha(Session *session, bool all, plugin::StorageEngine *engine) |
811 | { |
812 | Session_TRANS *trans; |
813 | Ha_trx_info *ha_info; |
814 | @@ -623,7 +621,7 @@ |
815 | for (; ha_info && !error; ha_info= ha_info->next()) |
816 | { |
817 | int err; |
818 | - StorageEngine *engine= ha_info->engine(); |
819 | + plugin::StorageEngine *engine= ha_info->engine(); |
820 | /* |
821 | Do not call two-phase commit if this particular |
822 | transaction is read-only. This allows for simpler |
823 | @@ -672,7 +670,7 @@ |
824 | for (; ha_info; ha_info= ha_info_next) |
825 | { |
826 | int err; |
827 | - StorageEngine *engine= ha_info->engine(); |
828 | + plugin::StorageEngine *engine= ha_info->engine(); |
829 | if ((err= engine->commit(session, all))) |
830 | { |
831 | my_error(ER_ERROR_DURING_COMMIT, MYF(0), err); |
832 | @@ -715,7 +713,7 @@ |
833 | for (; ha_info; ha_info= ha_info_next) |
834 | { |
835 | int err; |
836 | - StorageEngine *engine= ha_info->engine(); |
837 | + plugin::StorageEngine *engine= ha_info->engine(); |
838 | if ((err= engine->rollback(session, all))) |
839 | { // cannot happen |
840 | my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), err); |
841 | @@ -847,7 +845,7 @@ |
842 | for (ha_info= sv->ha_list; ha_info; ha_info= ha_info->next()) |
843 | { |
844 | int err; |
845 | - StorageEngine *engine= ha_info->engine(); |
846 | + plugin::StorageEngine *engine= ha_info->engine(); |
847 | assert(engine); |
848 | if ((err= engine->savepoint_rollback(session, |
849 | (void *)(sv+1)))) |
850 | @@ -866,7 +864,7 @@ |
851 | ha_info= ha_info_next) |
852 | { |
853 | int err; |
854 | - StorageEngine *engine= ha_info->engine(); |
855 | + plugin::StorageEngine *engine= ha_info->engine(); |
856 | if ((err= engine->rollback(session, !(0)))) |
857 | { // cannot happen |
858 | my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), err); |
859 | @@ -894,7 +892,7 @@ |
860 | for (; ha_info; ha_info= ha_info->next()) |
861 | { |
862 | int err; |
863 | - StorageEngine *engine= ha_info->engine(); |
864 | + plugin::StorageEngine *engine= ha_info->engine(); |
865 | assert(engine); |
866 | #ifdef NOT_IMPLEMENTED /*- TODO (examine this againt the original code base) */ |
867 | if (! engine->savepoint_set) |
868 | @@ -927,7 +925,7 @@ |
869 | for (; ha_info; ha_info= ha_info->next()) |
870 | { |
871 | int err; |
872 | - StorageEngine *engine= ha_info->engine(); |
873 | + plugin::StorageEngine *engine= ha_info->engine(); |
874 | /* Savepoint life time is enclosed into transaction life time. */ |
875 | assert(engine); |
876 | if ((err= engine->savepoint_release(session, |
877 | @@ -2614,7 +2612,7 @@ |
878 | return false; |
879 | } |
880 | |
881 | -bool ha_show_status(Session *session, StorageEngine *engine, enum ha_stat_type stat) |
882 | +bool ha_show_status(Session *session, plugin::StorageEngine *engine, enum ha_stat_type stat) |
883 | { |
884 | List<Item> field_list; |
885 | bool result; |
886 | @@ -2650,6 +2648,7 @@ |
887 | const unsigned char *before_record, |
888 | const unsigned char *after_record) |
889 | { |
890 | + ReplicationServices &replication_services= ReplicationServices::singleton(); |
891 | Session *const session= table->in_use; |
892 | |
893 | switch (session->lex->sql_command) |
894 | |
895 | === modified file 'drizzled/handler.h' |
896 | --- drizzled/handler.h 2009-09-15 21:01:42 +0000 |
897 | +++ drizzled/handler.h 2009-09-24 21:11:10 +0000 |
898 | @@ -45,6 +45,8 @@ |
899 | #include <algorithm> |
900 | |
901 | #define HA_MAX_ALTER_FLAGS 40 |
902 | + |
903 | + |
904 | typedef std::bitset<HA_MAX_ALTER_FLAGS> HA_ALTER_FLAGS; |
905 | |
906 | extern drizzled::atomic<uint32_t> refresh_version; /* Increments on each reload */ |
907 | @@ -171,7 +173,7 @@ |
908 | |
909 | ha_rows estimation_rows_to_insert; |
910 | public: |
911 | - StorageEngine *engine; /* storage engine of this handler */ |
912 | + drizzled::plugin::StorageEngine *engine; /* storage engine of this handler */ |
913 | unsigned char *ref; /* Pointer to current row */ |
914 | unsigned char *dup_ref; /* Pointer to duplicate row */ |
915 | |
916 | @@ -234,7 +236,7 @@ |
917 | */ |
918 | Discrete_interval auto_inc_interval_for_cur_row; |
919 | |
920 | - handler(StorageEngine *engine_arg, TableShare *share_arg) |
921 | + handler(drizzled::plugin::StorageEngine *engine_arg, TableShare *share_arg) |
922 | :table_share(share_arg), table(0), |
923 | estimation_rows_to_insert(0), engine(engine_arg), |
924 | ref(0), in_range_check_pushed_down(false), |
925 | @@ -803,37 +805,26 @@ |
926 | int ha_init(void); |
927 | int ha_end(void); |
928 | |
929 | -void add_storage_engine(StorageEngine *engine); |
930 | -void remove_storage_engine(StorageEngine *engine); |
931 | +void add_storage_engine(drizzled::plugin::StorageEngine *engine); |
932 | +void remove_storage_engine(drizzled::plugin::StorageEngine *engine); |
933 | |
934 | -void ha_close_connection(Session* session); |
935 | -bool ha_flush_logs(StorageEngine *db_type); |
936 | -void ha_drop_database(char* path); |
937 | int ha_create_table(Session *session, const char *path, |
938 | const char *db, const char *table_name, |
939 | HA_CREATE_INFO *create_info, |
940 | bool update_create_info, |
941 | drizzled::message::Table *table_proto); |
942 | -int ha_delete_table(Session *session, const char *path, |
943 | - const char *db, const char *alias, bool generate_warning); |
944 | |
945 | /* statistics and info */ |
946 | -bool ha_show_status(Session *session, StorageEngine *db_type, enum ha_stat_type stat); |
947 | +bool ha_show_status(Session *session, drizzled::plugin::StorageEngine *db_type, enum ha_stat_type stat); |
948 | |
949 | int ha_find_files(Session *session,const char *db,const char *path, |
950 | const char *wild, bool dir, List<LEX_STRING>* files); |
951 | |
952 | -/* report to InnoDB that control passes to the client */ |
953 | -int ha_release_temporary_latches(Session *session); |
954 | - |
955 | -/* transactions: interface to StorageEngine functions */ |
956 | -int ha_start_consistent_snapshot(Session *session); |
957 | -int ha_commit_or_rollback_by_xid(XID *xid, bool commit); |
958 | +/* transactions: interface to plugin::StorageEngine functions */ |
959 | int ha_commit_one_phase(Session *session, bool all); |
960 | int ha_rollback_trans(Session *session, bool all); |
961 | -int ha_recover(HASH *commit_list); |
962 | |
963 | -/* transactions: these functions never call StorageEngine functions directly */ |
964 | +/* transactions: these functions never call plugin::StorageEngine functions directly */ |
965 | int ha_commit_trans(Session *session, bool all); |
966 | int ha_autocommit_or_rollback(Session *session, int error); |
967 | int ha_enable_transaction(Session *session, bool on); |
968 | @@ -844,7 +835,7 @@ |
969 | int ha_release_savepoint(Session *session, SAVEPOINT *sv); |
970 | |
971 | /* these are called by storage engines */ |
972 | -void trans_register_ha(Session *session, bool all, StorageEngine *engine); |
973 | +void trans_register_ha(Session *session, bool all, drizzled::plugin::StorageEngine *engine); |
974 | |
975 | uint32_t filename_to_tablename(const char *from, char *to, uint32_t to_length); |
976 | bool tablename_to_filename(const char *from, char *to, size_t to_length); |
977 | @@ -911,7 +902,7 @@ |
978 | bool mysql_create_like_table(Session *session, TableList *table, |
979 | TableList *src_table, |
980 | HA_CREATE_INFO *create_info); |
981 | -bool mysql_rename_table(StorageEngine *base, const char *old_db, |
982 | +bool mysql_rename_table(drizzled::plugin::StorageEngine *base, const char *old_db, |
983 | const char * old_name, const char *new_db, |
984 | const char * new_name, uint32_t flags); |
985 | bool mysql_prepare_update(Session *session, TableList *table_list, |
986 | |
987 | === modified file 'drizzled/handler_structs.h' |
988 | --- drizzled/handler_structs.h 2009-09-16 20:58:28 +0000 |
989 | +++ drizzled/handler_structs.h 2009-09-24 21:11:10 +0000 |
990 | @@ -29,12 +29,19 @@ |
991 | #include <drizzled/lex_string.h> |
992 | |
993 | class Ha_trx_info; |
994 | -struct StorageEngine; |
995 | struct st_key; |
996 | typedef struct st_key KEY; |
997 | struct st_key_cache; |
998 | typedef struct st_key_cache KEY_CACHE; |
999 | |
1000 | +namespace drizzled |
1001 | +{ |
1002 | +namespace plugin |
1003 | +{ |
1004 | +class StorageEngine; |
1005 | +} |
1006 | +} |
1007 | + |
1008 | struct Session_TRANS |
1009 | { |
1010 | Session_TRANS() {}; |
1011 | @@ -85,7 +92,7 @@ |
1012 | uint32_t used_fields; |
1013 | uint32_t key_block_size; |
1014 | enum row_type row_type; |
1015 | - StorageEngine *db_type; |
1016 | + drizzled::plugin::StorageEngine *db_type; |
1017 | uint32_t options; /* OR of HA_CREATE_ options */ |
1018 | bool table_existed; /* 1 in create if table existed */ |
1019 | } HA_CREATE_INFO; |
1020 | |
1021 | === modified file 'drizzled/plugin.h' |
1022 | --- drizzled/plugin.h 2009-08-17 20:54:05 +0000 |
1023 | +++ drizzled/plugin.h 2009-09-24 21:11:10 +0000 |
1024 | @@ -22,6 +22,9 @@ |
1025 | |
1026 | #include <drizzled/lex_string.h> |
1027 | #include <drizzled/xid.h> |
1028 | +#include <drizzled/plugin/manifest.h> |
1029 | +#include <drizzled/plugin/library.h> |
1030 | +#include <drizzled/plugin/handle.h> |
1031 | |
1032 | class Session; |
1033 | class Item; |
1034 | @@ -32,6 +35,14 @@ |
1035 | */ |
1036 | |
1037 | |
1038 | +class sys_var; |
1039 | +typedef struct st_mysql_lex_string LEX_STRING; |
1040 | +struct my_option; |
1041 | + |
1042 | +extern char *opt_plugin_load; |
1043 | +extern char *opt_plugin_dir_ptr; |
1044 | +extern char opt_plugin_dir[FN_REFLEN]; |
1045 | + |
1046 | /* |
1047 | Macros for beginning and ending plugin declarations. Between |
1048 | drizzle_declare_plugin and drizzle_declare_plugin_end there should |
1049 | @@ -347,7 +358,13 @@ |
1050 | (*(DRIZZLE_SYSVAR_NAME(name).resolve(session, DRIZZLE_SYSVAR_NAME(name).offset))) |
1051 | |
1052 | |
1053 | -struct StorageEngine; |
1054 | +namespace drizzled |
1055 | +{ |
1056 | +namespace plugin |
1057 | +{ |
1058 | +class StorageEngine; |
1059 | +} |
1060 | +} |
1061 | |
1062 | |
1063 | class Plugin |
1064 | @@ -402,13 +419,25 @@ |
1065 | extern "C" { |
1066 | #endif |
1067 | |
1068 | +extern int plugin_init(drizzled::plugin::Registry &plugins, |
1069 | + int *argc, char **argv, int init_flags); |
1070 | +extern void plugin_shutdown(drizzled::plugin::Registry &plugins); |
1071 | +extern void my_print_help_inc_plugins(my_option *options); |
1072 | +extern bool plugin_is_ready(const LEX_STRING *name, int type); |
1073 | +extern bool mysql_install_plugin(Session *session, const LEX_STRING *name, |
1074 | + const LEX_STRING *dl); |
1075 | +extern bool mysql_uninstall_plugin(Session *session, const LEX_STRING *name); |
1076 | +extern void plugin_sessionvar_init(Session *session); |
1077 | +extern void plugin_sessionvar_cleanup(Session *session); |
1078 | +extern sys_var *intern_find_sys_var(const char *str, uint32_t, bool no_error); |
1079 | + |
1080 | int session_in_lock_tables(const Session *session); |
1081 | int session_tablespace_op(const Session *session); |
1082 | void set_session_proc_info(Session *session, const char *info); |
1083 | const char *get_session_proc_info(Session *session); |
1084 | int64_t session_test_options(const Session *session, int64_t test_options); |
1085 | int session_sql_command(const Session *session); |
1086 | -void **session_ha_data(const Session *session, const struct StorageEngine *engine); |
1087 | +void **session_ha_data(const Session *session, const drizzled::plugin::StorageEngine *engine); |
1088 | int session_tx_isolation(const Session *session); |
1089 | /* Increments the row counter, see Session::row_count */ |
1090 | void session_inc_row_count(Session *session); |
1091 | @@ -524,7 +553,7 @@ |
1092 | */ |
1093 | inline |
1094 | void * |
1095 | -session_get_ha_data(const Session *session, const struct StorageEngine *engine) |
1096 | +session_get_ha_data(const Session *session, const drizzled::plugin::StorageEngine *engine) |
1097 | { |
1098 | return *session_ha_data(session, engine); |
1099 | } |
1100 | @@ -534,7 +563,7 @@ |
1101 | */ |
1102 | inline |
1103 | void |
1104 | -session_set_ha_data(const Session *session, const struct StorageEngine *engine, |
1105 | +session_set_ha_data(const Session *session, const drizzled::plugin::StorageEngine *engine, |
1106 | const void *ha_data) |
1107 | { |
1108 | *session_ha_data(session, engine)= (void*) ha_data; |
1109 | |
1110 | === modified file 'drizzled/plugin/authentication.h' |
1111 | --- drizzled/plugin/authentication.h 2009-05-11 17:50:22 +0000 |
1112 | +++ drizzled/plugin/authentication.h 2009-09-24 21:11:10 +0000 |
1113 | @@ -27,6 +27,11 @@ |
1114 | #ifndef DRIZZLED_PLUGIN_AUTHENTICATION_H |
1115 | #define DRIZZLED_PLUGIN_AUTHENTICATION_H |
1116 | |
1117 | +namespace drizzled |
1118 | +{ |
1119 | +namespace plugin |
1120 | +{ |
1121 | + |
1122 | class Authentication |
1123 | { |
1124 | public: |
1125 | @@ -37,4 +42,7 @@ |
1126 | |
1127 | }; |
1128 | |
1129 | +} /* namespace plugin */ |
1130 | +} /* namespace drizzled */ |
1131 | + |
1132 | #endif /* DRIZZLED_PLUGIN_AUTHENTICATION_H */ |
1133 | |
1134 | === renamed file 'drizzled/plugin/error_message_handler.h' => 'drizzled/plugin/error_message.h' |
1135 | --- drizzled/plugin/error_message_handler.h 2009-05-11 17:50:22 +0000 |
1136 | +++ drizzled/plugin/error_message.h 2009-09-24 21:11:10 +0000 |
1137 | @@ -20,19 +20,23 @@ |
1138 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
1139 | */ |
1140 | |
1141 | -#ifndef DRIZZLED_PLUGIN_ERRMSG_H |
1142 | -#define DRIZZLED_PLUGIN_ERRMSG_H |
1143 | +#ifndef DRIZZLED_PLUGIN_ERROR_MESSAGE_H |
1144 | +#define DRIZZLED_PLUGIN_ERROR_MESSAGE_H |
1145 | |
1146 | #include <stdarg.h> |
1147 | #include <string> |
1148 | |
1149 | -class Error_message_handler |
1150 | +namespace drizzled |
1151 | +{ |
1152 | +namespace plugin |
1153 | +{ |
1154 | + |
1155 | +class ErrorMessage |
1156 | { |
1157 | std::string name; |
1158 | public: |
1159 | - Error_message_handler(std::string name_arg): name(name_arg) {} |
1160 | - Error_message_handler(const char *name_arg): name(name_arg) {} |
1161 | - virtual ~Error_message_handler() {} |
1162 | + ErrorMessage(std::string name_arg): name(name_arg) {} |
1163 | + virtual ~ErrorMessage() {} |
1164 | |
1165 | std::string getName() { return name; } |
1166 | |
1167 | @@ -40,4 +44,7 @@ |
1168 | const char *format, va_list ap)=0; |
1169 | }; |
1170 | |
1171 | -#endif /* DRIZZLED_PLUGIN_ERRMSG_H */ |
1172 | +} /* namespace plugin */ |
1173 | +} /* namespace drizzled */ |
1174 | + |
1175 | +#endif /* DRIZZLED_PLUGIN_ERROR_MESSAGE_H */ |
1176 | |
1177 | === renamed file 'drizzled/info_schema.h' => 'drizzled/plugin/info_schema_table.h' |
1178 | --- drizzled/info_schema.h 2009-07-07 04:47:22 +0000 |
1179 | +++ drizzled/plugin/info_schema_table.h 2009-09-24 21:11:10 +0000 |
1180 | @@ -18,11 +18,16 @@ |
1181 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
1182 | */ |
1183 | |
1184 | -#ifndef DRIZZLED_INFO_SCHEMA_H |
1185 | -#define DRIZZLED_INFO_SCHEMA_H |
1186 | +#ifndef DRIZZLE_PLUGIN_INFO_SCHEMA_TABLE_H |
1187 | +#define DRIZZLE_PLUGIN_INFO_SCHEMA_TABLE_H |
1188 | |
1189 | #include <string> |
1190 | |
1191 | +namespace drizzled |
1192 | +{ |
1193 | +namespace plugin |
1194 | +{ |
1195 | + |
1196 | /** |
1197 | * @file |
1198 | * info_schema.h |
1199 | @@ -473,4 +478,6 @@ |
1200 | |
1201 | }; |
1202 | |
1203 | -#endif /* DRIZZLED_INFO_SCHEMA_H */ |
1204 | +} /* namespace plugin */ |
1205 | +} /* namespace drizzled */ |
1206 | +#endif /* DRIZZLE_PLUGIN_INFO_SCHEMA_TABLE_H */ |
1207 | |
1208 | === modified file 'drizzled/plugin/listen_tcp.cc' |
1209 | --- drizzled/plugin/listen_tcp.cc 2009-08-27 18:06:03 +0000 |
1210 | +++ drizzled/plugin/listen_tcp.cc 2009-09-24 21:11:10 +0000 |
1211 | @@ -26,7 +26,9 @@ |
1212 | #include <netinet/tcp.h> |
1213 | |
1214 | using namespace std; |
1215 | -using namespace drizzled; |
1216 | + |
1217 | +namespace drizzled |
1218 | +{ |
1219 | |
1220 | int plugin::ListenTcp::acceptTcp(int fd) |
1221 | { |
1222 | @@ -211,3 +213,5 @@ |
1223 | |
1224 | return false; |
1225 | } |
1226 | + |
1227 | +} /* namespace drizzled */ |
1228 | |
1229 | === renamed file 'drizzled/sql_plugin.cc' => 'drizzled/plugin/loader.cc' |
1230 | --- drizzled/sql_plugin.cc 2009-09-14 18:25:40 +0000 |
1231 | +++ drizzled/plugin/loader.cc 2009-09-24 21:11:10 +0000 |
1232 | @@ -17,12 +17,7 @@ |
1233 | #include <mysys/my_getopt.h> |
1234 | #include <mysys/hash.h> |
1235 | |
1236 | -#include <drizzled/authentication.h> |
1237 | -#include <drizzled/logging.h> |
1238 | -#include <drizzled/errmsg.h> |
1239 | -#include <drizzled/qcache.h> |
1240 | #include <drizzled/sql_parse.h> |
1241 | -#include <drizzled/scheduling.h> |
1242 | #include <drizzled/replication_services.h> |
1243 | #include <drizzled/show.h> |
1244 | #include <drizzled/handler.h> |
1245 | |
1246 | === renamed file 'drizzled/plugin/logging_handler.h' => 'drizzled/plugin/logging.h' |
1247 | --- drizzled/plugin/logging_handler.h 2009-05-11 17:50:22 +0000 |
1248 | +++ drizzled/plugin/logging.h 2009-09-24 21:11:10 +0000 |
1249 | @@ -1,9 +1,8 @@ |
1250 | -/* |
1251 | - -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
1252 | +/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
1253 | * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
1254 | - |
1255 | + * |
1256 | * Definitions required for Query Logging plugin |
1257 | - |
1258 | + * |
1259 | * Copyright (C) 2008 Sun Microsystems |
1260 | * |
1261 | * This program is free software; you can redistribute it and/or modify |
1262 | @@ -25,21 +24,28 @@ |
1263 | |
1264 | #include <string> |
1265 | |
1266 | -class Logging_handler |
1267 | +namespace drizzled |
1268 | +{ |
1269 | +namespace plugin |
1270 | +{ |
1271 | + |
1272 | +class Logging |
1273 | { |
1274 | std::string name; |
1275 | public: |
1276 | - Logging_handler(std::string name_arg): name(name_arg) {} |
1277 | - Logging_handler(const char *name_arg): name(name_arg) {} |
1278 | - virtual ~Logging_handler() {} |
1279 | + Logging(std::string name_arg): name(name_arg) {} |
1280 | + virtual ~Logging() {} |
1281 | |
1282 | std::string getName() { return name; } |
1283 | /** |
1284 | * Make these no-op rather than pure-virtual so that it's easy for a plugin |
1285 | - * to only |
1286 | + * to only implement one. |
1287 | */ |
1288 | virtual bool pre(Session *) {return false;} |
1289 | virtual bool post(Session *) {return false;} |
1290 | }; |
1291 | |
1292 | +} /* namespace plugin */ |
1293 | +} /* namespace drizzled */ |
1294 | + |
1295 | #endif /* DRIZZLED_PLUGIN_LOGGING_H */ |
1296 | |
1297 | === renamed file 'drizzled/plugin/qcache.h' => 'drizzled/plugin/query_cache.h' |
1298 | --- drizzled/plugin/qcache.h 2009-05-11 17:50:22 +0000 |
1299 | +++ drizzled/plugin/query_cache.h 2009-09-24 21:11:10 +0000 |
1300 | @@ -23,6 +23,11 @@ |
1301 | #ifndef DRIZZLED_PLUGIN_QUERY_CACHE_H |
1302 | #define DRIZZLED_PLUGIN_QUERY_CACHE_H |
1303 | |
1304 | +namespace drizzled |
1305 | +{ |
1306 | +namespace plugin |
1307 | +{ |
1308 | + |
1309 | /* |
1310 | This is the API that a qcache plugin must implement. |
1311 | it should implement each of these function pointers. |
1312 | @@ -53,4 +58,7 @@ |
1313 | virtual bool flush(Session *session)= 0; |
1314 | }; |
1315 | |
1316 | +} /* namespace plugin */ |
1317 | +} /* namespace drizzled */ |
1318 | + |
1319 | #endif /* DRIZZLED_PLUGIN_QUERY_CACHE_H */ |
1320 | |
1321 | === modified file 'drizzled/plugin/registry.cc' |
1322 | --- drizzled/plugin/registry.cc 2009-09-16 17:10:18 +0000 |
1323 | +++ drizzled/plugin/registry.cc 2009-09-24 21:11:10 +0000 |
1324 | @@ -23,20 +23,15 @@ |
1325 | #include "drizzled/plugin.h" |
1326 | #include "drizzled/show.h" |
1327 | #include "drizzled/handler.h" |
1328 | -#include "drizzled/errmsg.h" |
1329 | -#include "drizzled/authentication.h" |
1330 | -#include "drizzled/qcache.h" |
1331 | -#include "drizzled/scheduling.h" |
1332 | -#include "drizzled/logging.h" |
1333 | -#include "drizzled/replication_services.h" |
1334 | |
1335 | #include <string> |
1336 | #include <vector> |
1337 | #include <map> |
1338 | |
1339 | using namespace std; |
1340 | -using namespace drizzled; |
1341 | |
1342 | +namespace drizzled |
1343 | +{ |
1344 | |
1345 | plugin::Handle *plugin::Registry::find(const LEX_STRING *name) |
1346 | { |
1347 | @@ -82,94 +77,4 @@ |
1348 | return plugins; |
1349 | } |
1350 | |
1351 | -void plugin::Registry::add(StorageEngine *engine) |
1352 | -{ |
1353 | - add_storage_engine(engine); |
1354 | -} |
1355 | - |
1356 | -void plugin::Registry::add(InfoSchemaTable *schema_table) |
1357 | -{ |
1358 | - add_infoschema_table(schema_table); |
1359 | -} |
1360 | - |
1361 | -void plugin::Registry::add(Logging_handler *handler) |
1362 | -{ |
1363 | - add_logger(handler); |
1364 | -} |
1365 | - |
1366 | -void plugin::Registry::add(Error_message_handler *handler) |
1367 | -{ |
1368 | - add_errmsg_handler(handler); |
1369 | -} |
1370 | - |
1371 | -void plugin::Registry::add(Authentication *auth) |
1372 | -{ |
1373 | - add_authentication(auth); |
1374 | -} |
1375 | - |
1376 | -void plugin::Registry::add(QueryCache *qcache) |
1377 | -{ |
1378 | - add_query_cache(qcache); |
1379 | -} |
1380 | - |
1381 | -void plugin::Registry::add(plugin::SchedulerFactory *factory) |
1382 | -{ |
1383 | - add_scheduler_factory(factory); |
1384 | -} |
1385 | - |
1386 | - |
1387 | -void plugin::Registry::add(drizzled::plugin::CommandReplicator *replicator) |
1388 | -{ |
1389 | - add_replicator(replicator); |
1390 | -} |
1391 | - |
1392 | -void plugin::Registry::add(drizzled::plugin::CommandApplier *applier) |
1393 | -{ |
1394 | - add_applier(applier); |
1395 | -} |
1396 | - |
1397 | -void plugin::Registry::remove(StorageEngine *engine) |
1398 | -{ |
1399 | - remove_storage_engine(engine); |
1400 | -} |
1401 | - |
1402 | -void plugin::Registry::remove(InfoSchemaTable *schema_table) |
1403 | -{ |
1404 | - remove_infoschema_table(schema_table); |
1405 | -} |
1406 | - |
1407 | -void plugin::Registry::remove(Logging_handler *handler) |
1408 | -{ |
1409 | - remove_logger(handler); |
1410 | -} |
1411 | - |
1412 | -void plugin::Registry::remove(Error_message_handler *handler) |
1413 | -{ |
1414 | - remove_errmsg_handler(handler); |
1415 | -} |
1416 | - |
1417 | -void plugin::Registry::remove(Authentication *auth) |
1418 | -{ |
1419 | - remove_authentication(auth); |
1420 | -} |
1421 | - |
1422 | -void plugin::Registry::remove(QueryCache *qcache) |
1423 | -{ |
1424 | - remove_query_cache(qcache); |
1425 | -} |
1426 | - |
1427 | -void plugin::Registry::remove(plugin::SchedulerFactory *factory) |
1428 | -{ |
1429 | - remove_scheduler_factory(factory); |
1430 | -} |
1431 | - |
1432 | - |
1433 | -void plugin::Registry::remove(drizzled::plugin::CommandReplicator *replicator) |
1434 | -{ |
1435 | - remove_replicator(replicator); |
1436 | -} |
1437 | - |
1438 | -void plugin::Registry::remove(drizzled::plugin::CommandApplier *applier) |
1439 | -{ |
1440 | - remove_applier(applier); |
1441 | -} |
1442 | +} /* namespace drizzled */ |
1443 | |
1444 | === modified file 'drizzled/plugin/registry.h' |
1445 | --- drizzled/plugin/registry.h 2009-09-16 20:04:11 +0000 |
1446 | +++ drizzled/plugin/registry.h 2009-09-24 21:11:10 +0000 |
1447 | @@ -20,28 +20,28 @@ |
1448 | #ifndef DRIZZLED_PLUGIN_REGISTRY_H |
1449 | #define DRIZZLED_PLUGIN_REGISTRY_H |
1450 | |
1451 | -#include "drizzled/slot/function.h" |
1452 | -#include "drizzled/slot/listen.h" |
1453 | - |
1454 | #include <string> |
1455 | #include <vector> |
1456 | #include <map> |
1457 | |
1458 | -class StorageEngine; |
1459 | -class InfoSchemaTable; |
1460 | -class Logging_handler; |
1461 | -class Error_message_handler; |
1462 | -class Authentication; |
1463 | -class QueryCache; |
1464 | +#include "drizzled/slot/authentication.h" |
1465 | +#include "drizzled/slot/scheduler.h" |
1466 | +#include "drizzled/slot/function.h" |
1467 | +#include "drizzled/slot/listen.h" |
1468 | +#include "drizzled/slot/query_cache.h" |
1469 | +#include "drizzled/slot/logging.h" |
1470 | +#include "drizzled/slot/error_message.h" |
1471 | +#include "drizzled/slot/info_schema.h" |
1472 | +#include "drizzled/slot/command_replicator.h" |
1473 | +#include "drizzled/slot/command_applier.h" |
1474 | +#include "drizzled/slot/storage_engine.h" |
1475 | + |
1476 | |
1477 | namespace drizzled |
1478 | { |
1479 | namespace plugin |
1480 | { |
1481 | -class CommandReplicator; |
1482 | -class CommandApplier; |
1483 | class Handle; |
1484 | -class SchedulerFactory; |
1485 | |
1486 | class Registry |
1487 | { |
1488 | @@ -65,28 +65,17 @@ |
1489 | |
1490 | std::vector<Handle *> get_list(bool active); |
1491 | |
1492 | - void add(StorageEngine *engine); |
1493 | - void add(InfoSchemaTable *schema_table); |
1494 | - void add(Logging_handler *handler); |
1495 | - void add(Error_message_handler *handler); |
1496 | - void add(Authentication *auth); |
1497 | - void add(QueryCache *qcache); |
1498 | - void add(SchedulerFactory *scheduler); |
1499 | - void add(drizzled::plugin::CommandReplicator *replicator); |
1500 | - void add(drizzled::plugin::CommandApplier *applier); |
1501 | - |
1502 | - void remove(StorageEngine *engine); |
1503 | - void remove(InfoSchemaTable *schema_table); |
1504 | - void remove(Logging_handler *handler); |
1505 | - void remove(Error_message_handler *handler); |
1506 | - void remove(Authentication *auth); |
1507 | - void remove(QueryCache *qcache); |
1508 | - void remove(SchedulerFactory *scheduler); |
1509 | - void remove(drizzled::plugin::CommandReplicator *replicator); |
1510 | - void remove(drizzled::plugin::CommandApplier *applier); |
1511 | - |
1512 | + ::drizzled::slot::CommandReplicator command_replicator; |
1513 | + ::drizzled::slot::CommandApplier command_applier; |
1514 | + ::drizzled::slot::ErrorMessage error_message; |
1515 | + ::drizzled::slot::Authentication authentication; |
1516 | + ::drizzled::slot::QueryCache query_cache; |
1517 | + ::drizzled::slot::Scheduler scheduler; |
1518 | ::drizzled::slot::Function function; |
1519 | ::drizzled::slot::Listen listen; |
1520 | + ::drizzled::slot::Logging logging; |
1521 | + ::drizzled::slot::InfoSchema info_schema; |
1522 | + ::drizzled::slot::StorageEngine storage_engine; |
1523 | }; |
1524 | |
1525 | } /* end namespace plugin */ |
1526 | |
1527 | === modified file 'drizzled/plugin/storage_engine.cc' |
1528 | --- drizzled/plugin/storage_engine.cc 2009-08-19 23:35:29 +0000 |
1529 | +++ drizzled/plugin/storage_engine.cc 2009-09-24 21:11:10 +0000 |
1530 | @@ -33,9 +33,6 @@ |
1531 | |
1532 | #include <drizzled/table_proto.h> |
1533 | |
1534 | -#include <google/protobuf/io/zero_copy_stream.h> |
1535 | -#include <google/protobuf/io/zero_copy_stream_impl.h> |
1536 | - |
1537 | #include <mysys/my_dir.h> |
1538 | |
1539 | #include CSTDINT_H |
1540 | @@ -43,19 +40,7 @@ |
1541 | using namespace std; |
1542 | using namespace drizzled; |
1543 | |
1544 | -drizzled::Registry<StorageEngine *> all_engines; |
1545 | - |
1546 | -void add_storage_engine(StorageEngine *engine) |
1547 | -{ |
1548 | - all_engines.add(engine); |
1549 | -} |
1550 | - |
1551 | -void remove_storage_engine(StorageEngine *engine) |
1552 | -{ |
1553 | - all_engines.remove(engine); |
1554 | -} |
1555 | - |
1556 | -StorageEngine::StorageEngine(const std::string name_arg, |
1557 | +plugin::StorageEngine::StorageEngine(const std::string name_arg, |
1558 | const std::bitset<HTON_BIT_SIZE> &flags_arg, |
1559 | size_t savepoint_offset_arg, |
1560 | bool support_2pc) |
1561 | @@ -75,12 +60,12 @@ |
1562 | } |
1563 | |
1564 | |
1565 | -StorageEngine::~StorageEngine() |
1566 | +plugin::StorageEngine::~StorageEngine() |
1567 | { |
1568 | savepoint_alloc_size-= orig_savepoint_offset; |
1569 | } |
1570 | |
1571 | -void StorageEngine::setTransactionReadWrite(Session* session) |
1572 | +void plugin::StorageEngine::setTransactionReadWrite(Session* session) |
1573 | { |
1574 | Ha_trx_info *ha_info= &session->ha_data[getSlot()].ha_info[0]; |
1575 | /* |
1576 | @@ -103,15 +88,15 @@ |
1577 | |
1578 | |
1579 | /** |
1580 | - Return the default storage engine StorageEngine for thread |
1581 | + Return the default storage engine plugin::StorageEngine for thread |
1582 | |
1583 | @param ha_default_storage_engine(session) |
1584 | @param session current thread |
1585 | |
1586 | @return |
1587 | - pointer to StorageEngine |
1588 | + pointer to plugin::StorageEngine |
1589 | */ |
1590 | -StorageEngine *ha_default_storage_engine(Session *session) |
1591 | +plugin::StorageEngine *ha_default_storage_engine(Session *session) |
1592 | { |
1593 | if (session->variables.storage_engine) |
1594 | return session->variables.storage_engine; |
1595 | @@ -119,34 +104,8 @@ |
1596 | } |
1597 | |
1598 | |
1599 | -/** |
1600 | - Return the storage engine StorageEngine for the supplied name |
1601 | - |
1602 | - @param session current thread |
1603 | - @param name name of storage engine |
1604 | - |
1605 | - @return |
1606 | - pointer to storage engine plugin handle |
1607 | -*/ |
1608 | -StorageEngine *ha_resolve_by_name(Session *session, std::string find_str) |
1609 | -{ |
1610 | - transform(find_str.begin(), find_str.end(), |
1611 | - find_str.begin(), ::tolower); |
1612 | - string default_str("default"); |
1613 | - if (find_str == default_str) |
1614 | - return ha_default_storage_engine(session); |
1615 | - |
1616 | - StorageEngine *engine= all_engines.find(find_str); |
1617 | - |
1618 | - if (engine && engine->is_user_selectable()) |
1619 | - return engine; |
1620 | - |
1621 | - return NULL; |
1622 | -} |
1623 | - |
1624 | - |
1625 | handler *get_new_handler(TableShare *share, MEM_ROOT *alloc, |
1626 | - StorageEngine *engine) |
1627 | + plugin::StorageEngine *engine) |
1628 | { |
1629 | handler *file; |
1630 | |
1631 | @@ -164,348 +123,10 @@ |
1632 | return(get_new_handler(share, alloc, ha_default_storage_engine(current_session))); |
1633 | } |
1634 | |
1635 | -class StorageEngineCloseConnection |
1636 | - : public unary_function<StorageEngine *, void> |
1637 | -{ |
1638 | - Session *session; |
1639 | -public: |
1640 | - StorageEngineCloseConnection(Session *session_arg) : session(session_arg) {} |
1641 | - /* |
1642 | - there's no need to rollback here as all transactions must |
1643 | - be rolled back already |
1644 | - */ |
1645 | - inline result_type operator() (argument_type engine) |
1646 | - { |
1647 | - if (engine->is_enabled() && |
1648 | - session_get_ha_data(session, engine)) |
1649 | - engine->close_connection(session); |
1650 | - } |
1651 | -}; |
1652 | - |
1653 | -/** |
1654 | - @note |
1655 | - don't bother to rollback here, it's done already |
1656 | -*/ |
1657 | -void ha_close_connection(Session* session) |
1658 | -{ |
1659 | - for_each(all_engines.begin(), all_engines.end(), |
1660 | - StorageEngineCloseConnection(session)); |
1661 | -} |
1662 | - |
1663 | -void ha_drop_database(char* path) |
1664 | -{ |
1665 | - for_each(all_engines.begin(), all_engines.end(), |
1666 | - bind2nd(mem_fun(&StorageEngine::drop_database),path)); |
1667 | -} |
1668 | - |
1669 | -int ha_commit_or_rollback_by_xid(XID *xid, bool commit) |
1670 | -{ |
1671 | - vector<int> results; |
1672 | - |
1673 | - if (commit) |
1674 | - transform(all_engines.begin(), all_engines.end(), results.begin(), |
1675 | - bind2nd(mem_fun(&StorageEngine::commit_by_xid),xid)); |
1676 | - else |
1677 | - transform(all_engines.begin(), all_engines.end(), results.begin(), |
1678 | - bind2nd(mem_fun(&StorageEngine::rollback_by_xid),xid)); |
1679 | - |
1680 | - if (find_if(results.begin(), results.end(), bind2nd(equal_to<int>(),0)) |
1681 | - == results.end()) |
1682 | - return 1; |
1683 | - return 0; |
1684 | -} |
1685 | - |
1686 | - |
1687 | -/** |
1688 | - @details |
1689 | - This function should be called when MySQL sends rows of a SELECT result set |
1690 | - or the EOF mark to the client. It releases a possible adaptive hash index |
1691 | - S-latch held by session in InnoDB and also releases a possible InnoDB query |
1692 | - FIFO ticket to enter InnoDB. To save CPU time, InnoDB allows a session to |
1693 | - keep them over several calls of the InnoDB handler interface when a join |
1694 | - is executed. But when we let the control to pass to the client they have |
1695 | - to be released because if the application program uses mysql_use_result(), |
1696 | - it may deadlock on the S-latch if the application on another connection |
1697 | - performs another SQL query. In MySQL-4.1 this is even more important because |
1698 | - there a connection can have several SELECT queries open at the same time. |
1699 | - |
1700 | - @param session the thread handle of the current connection |
1701 | - |
1702 | - @return |
1703 | - always 0 |
1704 | -*/ |
1705 | -int ha_release_temporary_latches(Session *session) |
1706 | -{ |
1707 | - for_each(all_engines.begin(), all_engines.end(), |
1708 | - bind2nd(mem_fun(&StorageEngine::release_temporary_latches),session)); |
1709 | - return 0; |
1710 | -} |
1711 | - |
1712 | - |
1713 | -bool ha_flush_logs(StorageEngine *engine) |
1714 | -{ |
1715 | - if (engine == NULL) |
1716 | - { |
1717 | - if (find_if(all_engines.begin(), all_engines.end(), |
1718 | - mem_fun(&StorageEngine::flush_logs)) |
1719 | - != all_engines.begin()) |
1720 | - return true; |
1721 | - } |
1722 | - else |
1723 | - { |
1724 | - if ((!engine->is_enabled()) || |
1725 | - (engine->flush_logs())) |
1726 | - return true; |
1727 | - } |
1728 | - return false; |
1729 | -} |
1730 | - |
1731 | -/** |
1732 | - recover() step of xa. |
1733 | - |
1734 | - @note |
1735 | - there are three modes of operation: |
1736 | - - automatic recover after a crash |
1737 | - in this case commit_list != 0, tc_heuristic_recover==0 |
1738 | - all xids from commit_list are committed, others are rolled back |
1739 | - - manual (heuristic) recover |
1740 | - in this case commit_list==0, tc_heuristic_recover != 0 |
1741 | - DBA has explicitly specified that all prepared transactions should |
1742 | - be committed (or rolled back). |
1743 | - - no recovery (MySQL did not detect a crash) |
1744 | - in this case commit_list==0, tc_heuristic_recover == 0 |
1745 | - there should be no prepared transactions in this case. |
1746 | -*/ |
1747 | -class XARecover : unary_function<StorageEngine *, void> |
1748 | -{ |
1749 | - int trans_len, found_foreign_xids, found_my_xids; |
1750 | - bool result; |
1751 | - XID *trans_list; |
1752 | - HASH *commit_list; |
1753 | - bool dry_run; |
1754 | -public: |
1755 | - XARecover(XID *trans_list_arg, int trans_len_arg, |
1756 | - HASH *commit_list_arg, bool dry_run_arg) |
1757 | - : trans_len(trans_len_arg), found_foreign_xids(0), found_my_xids(0), |
1758 | - result(false), |
1759 | - trans_list(trans_list_arg), commit_list(commit_list_arg), |
1760 | - dry_run(dry_run_arg) |
1761 | - {} |
1762 | - |
1763 | - int getForeignXIDs() |
1764 | - { |
1765 | - return found_foreign_xids; |
1766 | - } |
1767 | - |
1768 | - int getMyXIDs() |
1769 | - { |
1770 | - return found_my_xids; |
1771 | - } |
1772 | - |
1773 | - result_type operator() (argument_type engine) |
1774 | - { |
1775 | - |
1776 | - int got; |
1777 | - |
1778 | - if (engine->is_enabled()) |
1779 | - { |
1780 | - while ((got= engine->recover(trans_list, trans_len)) > 0 ) |
1781 | - { |
1782 | - errmsg_printf(ERRMSG_LVL_INFO, |
1783 | - _("Found %d prepared transaction(s) in %s"), |
1784 | - got, engine->getName().c_str()); |
1785 | - for (int i=0; i < got; i ++) |
1786 | - { |
1787 | - my_xid x=trans_list[i].get_my_xid(); |
1788 | - if (!x) // not "mine" - that is generated by external TM |
1789 | - { |
1790 | - xid_cache_insert(trans_list+i, XA_PREPARED); |
1791 | - found_foreign_xids++; |
1792 | - continue; |
1793 | - } |
1794 | - if (dry_run) |
1795 | - { |
1796 | - found_my_xids++; |
1797 | - continue; |
1798 | - } |
1799 | - // recovery mode |
1800 | - if (commit_list ? |
1801 | - hash_search(commit_list, (unsigned char *)&x, sizeof(x)) != 0 : |
1802 | - tc_heuristic_recover == TC_HEURISTIC_RECOVER_COMMIT) |
1803 | - { |
1804 | - engine->commit_by_xid(trans_list+i); |
1805 | - } |
1806 | - else |
1807 | - { |
1808 | - engine->rollback_by_xid(trans_list+i); |
1809 | - } |
1810 | - } |
1811 | - if (got < trans_len) |
1812 | - break; |
1813 | - } |
1814 | - } |
1815 | - } |
1816 | - |
1817 | -}; |
1818 | - |
1819 | -int ha_recover(HASH *commit_list) |
1820 | -{ |
1821 | - XID *trans_list= NULL; |
1822 | - int trans_len= 0; |
1823 | - |
1824 | - bool dry_run= (commit_list==0 && tc_heuristic_recover==0); |
1825 | - |
1826 | - /* commit_list and tc_heuristic_recover cannot be set both */ |
1827 | - assert(commit_list==0 || tc_heuristic_recover==0); |
1828 | - |
1829 | - /* if either is set, total_ha_2pc must be set too */ |
1830 | - if (total_ha_2pc <= 1) |
1831 | - return 0; |
1832 | - |
1833 | - |
1834 | -#ifndef WILL_BE_DELETED_LATER |
1835 | - |
1836 | - /* |
1837 | - for now, only InnoDB supports 2pc. It means we can always safely |
1838 | - rollback all pending transactions, without risking inconsistent data |
1839 | - */ |
1840 | - |
1841 | - assert(total_ha_2pc == 2); // only InnoDB and binlog |
1842 | - tc_heuristic_recover= TC_HEURISTIC_RECOVER_ROLLBACK; // forcing ROLLBACK |
1843 | - dry_run=false; |
1844 | -#endif |
1845 | - for (trans_len= MAX_XID_LIST_SIZE ; |
1846 | - trans_list==0 && trans_len > MIN_XID_LIST_SIZE; trans_len/=2) |
1847 | - { |
1848 | - trans_list=(XID *)malloc(trans_len*sizeof(XID)); |
1849 | - } |
1850 | - if (!trans_list) |
1851 | - { |
1852 | - errmsg_printf(ERRMSG_LVL_ERROR, ER(ER_OUTOFMEMORY), trans_len*sizeof(XID)); |
1853 | - return(1); |
1854 | - } |
1855 | - |
1856 | - if (commit_list) |
1857 | - errmsg_printf(ERRMSG_LVL_INFO, _("Starting crash recovery...")); |
1858 | - |
1859 | - |
1860 | - XARecover recover_func(trans_list, trans_len, commit_list, dry_run); |
1861 | - for_each(all_engines.begin(), all_engines.end(), recover_func); |
1862 | - free(trans_list); |
1863 | - |
1864 | - if (recover_func.getForeignXIDs()) |
1865 | - errmsg_printf(ERRMSG_LVL_WARN, |
1866 | - _("Found %d prepared XA transactions"), |
1867 | - recover_func.getForeignXIDs()); |
1868 | - if (dry_run && recover_func.getMyXIDs()) |
1869 | - { |
1870 | - errmsg_printf(ERRMSG_LVL_ERROR, |
1871 | - _("Found %d prepared transactions! It means that drizzled " |
1872 | - "was not shut down properly last time and critical " |
1873 | - "recovery information (last binlog or %s file) was " |
1874 | - "manually deleted after a crash. You have to start " |
1875 | - "drizzled with the --tc-heuristic-recover switch to " |
1876 | - "commit or rollback pending transactions."), |
1877 | - recover_func.getMyXIDs(), opt_tc_log_file); |
1878 | - return(1); |
1879 | - } |
1880 | - if (commit_list) |
1881 | - errmsg_printf(ERRMSG_LVL_INFO, _("Crash recovery finished.")); |
1882 | - return(0); |
1883 | -} |
1884 | - |
1885 | -int ha_start_consistent_snapshot(Session *session) |
1886 | -{ |
1887 | - for_each(all_engines.begin(), all_engines.end(), |
1888 | - bind2nd(mem_fun(&StorageEngine::start_consistent_snapshot),session)); |
1889 | - return 0; |
1890 | -} |
1891 | - |
1892 | -static int drizzle_read_table_proto(const char* path, message::Table* table) |
1893 | -{ |
1894 | - int fd= open(path, O_RDONLY); |
1895 | - |
1896 | - if (fd == -1) |
1897 | - return errno; |
1898 | - |
1899 | - google::protobuf::io::ZeroCopyInputStream* input= |
1900 | - new google::protobuf::io::FileInputStream(fd); |
1901 | - |
1902 | - if (table->ParseFromZeroCopyStream(input) == false) |
1903 | - { |
1904 | - delete input; |
1905 | - close(fd); |
1906 | - return -1; |
1907 | - } |
1908 | - |
1909 | - delete input; |
1910 | - close(fd); |
1911 | - return 0; |
1912 | -} |
1913 | - |
1914 | -class StorageEngineGetTableProto: public unary_function<StorageEngine *,bool> |
1915 | -{ |
1916 | - const char* path; |
1917 | - message::Table *table_proto; |
1918 | - int *err; |
1919 | -public: |
1920 | - StorageEngineGetTableProto(const char* path_arg, |
1921 | - message::Table *table_proto_arg, |
1922 | - int *err_arg) |
1923 | - :path(path_arg), table_proto(table_proto_arg), err(err_arg) {} |
1924 | - |
1925 | - result_type operator() (argument_type engine) |
1926 | - { |
1927 | - int ret= engine->getTableProtoImplementation(path, table_proto); |
1928 | - |
1929 | - if (ret != ENOENT) |
1930 | - *err= ret; |
1931 | - |
1932 | - return *err == EEXIST; |
1933 | - } |
1934 | -}; |
1935 | - |
1936 | -/** |
1937 | - Call this function in order to give the handler the possiblity |
1938 | - to ask engine if there are any new tables that should be written to disk |
1939 | - or any dropped tables that need to be removed from disk |
1940 | -*/ |
1941 | -int StorageEngine::getTableProto(const char* path, |
1942 | - message::Table *table_proto) |
1943 | -{ |
1944 | - int err= ENOENT; |
1945 | - |
1946 | - drizzled::Registry<StorageEngine *>::iterator iter= |
1947 | - find_if(all_engines.begin(), all_engines.end(), |
1948 | - StorageEngineGetTableProto(path, table_proto, &err)); |
1949 | - if (iter == all_engines.end()) |
1950 | - { |
1951 | - string proto_path(path); |
1952 | - string file_ext(".dfe"); |
1953 | - proto_path.append(file_ext); |
1954 | - |
1955 | - int error= access(proto_path.c_str(), F_OK); |
1956 | - |
1957 | - if (error == 0) |
1958 | - err= EEXIST; |
1959 | - else |
1960 | - err= errno; |
1961 | - |
1962 | - if (table_proto) |
1963 | - { |
1964 | - int read_proto_err= drizzle_read_table_proto(proto_path.c_str(), |
1965 | - table_proto); |
1966 | - |
1967 | - if (read_proto_err) |
1968 | - err= read_proto_err; |
1969 | - } |
1970 | - } |
1971 | - |
1972 | - return err; |
1973 | -} |
1974 | - |
1975 | - |
1976 | -int StorageEngine::renameTableImplementation(Session *, const char *from, const char *to) |
1977 | + |
1978 | + |
1979 | + |
1980 | +int plugin::StorageEngine::renameTableImplementation(Session *, const char *from, const char *to) |
1981 | { |
1982 | int error= 0; |
1983 | for (const char **ext= bas_ext(); *ext ; ext++) |
1984 | @@ -536,7 +157,7 @@ |
1985 | @retval |
1986 | !0 Error |
1987 | */ |
1988 | -int StorageEngine::deleteTableImplementation(Session *, const std::string table_path) |
1989 | +int plugin::StorageEngine::deleteTableImplementation(Session *, const std::string table_path) |
1990 | { |
1991 | int error= 0; |
1992 | int enoent_or_zero= ENOENT; // Error if no file was deleted |
1993 | @@ -559,164 +180,6 @@ |
1994 | } |
1995 | |
1996 | /** |
1997 | - An interceptor to hijack the text of the error message without |
1998 | - setting an error in the thread. We need the text to present it |
1999 | - in the form of a warning to the user. |
2000 | -*/ |
2001 | - |
2002 | -class Ha_delete_table_error_handler: public Internal_error_handler |
2003 | -{ |
2004 | -public: |
2005 | - Ha_delete_table_error_handler() : Internal_error_handler() {} |
2006 | - virtual bool handle_error(uint32_t sql_errno, |
2007 | - const char *message, |
2008 | - DRIZZLE_ERROR::enum_warning_level level, |
2009 | - Session *session); |
2010 | - char buff[DRIZZLE_ERRMSG_SIZE]; |
2011 | -}; |
2012 | - |
2013 | - |
2014 | -bool |
2015 | -Ha_delete_table_error_handler:: |
2016 | -handle_error(uint32_t , |
2017 | - const char *message, |
2018 | - DRIZZLE_ERROR::enum_warning_level , |
2019 | - Session *) |
2020 | -{ |
2021 | - /* Grab the error message */ |
2022 | - strncpy(buff, message, sizeof(buff)-1); |
2023 | - return true; |
2024 | -} |
2025 | - |
2026 | - |
2027 | -class DeleteTableStorageEngine |
2028 | - : public unary_function<StorageEngine *, void> |
2029 | -{ |
2030 | - Session *session; |
2031 | - const char *path; |
2032 | - handler **file; |
2033 | - int *dt_error; |
2034 | -public: |
2035 | - DeleteTableStorageEngine(Session *session_arg, const char *path_arg, |
2036 | - handler **file_arg, int *error_arg) |
2037 | - : session(session_arg), path(path_arg), file(file_arg), dt_error(error_arg) {} |
2038 | - |
2039 | - result_type operator() (argument_type engine) |
2040 | - { |
2041 | - char tmp_path[FN_REFLEN]; |
2042 | - handler *tmp_file; |
2043 | - |
2044 | - if(*dt_error!=ENOENT) /* already deleted table */ |
2045 | - return; |
2046 | - |
2047 | - if (!engine) |
2048 | - return; |
2049 | - |
2050 | - if (!engine->is_enabled()) |
2051 | - return; |
2052 | - |
2053 | - if ((tmp_file= engine->create(NULL, session->mem_root))) |
2054 | - tmp_file->init(); |
2055 | - else |
2056 | - return; |
2057 | - |
2058 | - path= engine->checkLowercaseNames(path, tmp_path); |
2059 | - const std::string table_path(path); |
2060 | - int tmp_error= engine->deleteTable(session, table_path); |
2061 | - |
2062 | - if (tmp_error != ENOENT) |
2063 | - { |
2064 | - if (tmp_error == 0) |
2065 | - { |
2066 | - if (engine->check_flag(HTON_BIT_HAS_DATA_DICTIONARY)) |
2067 | - delete_table_proto_file(path); |
2068 | - else |
2069 | - tmp_error= delete_table_proto_file(path); |
2070 | - } |
2071 | - |
2072 | - *dt_error= tmp_error; |
2073 | - if(*file) |
2074 | - delete *file; |
2075 | - *file= tmp_file; |
2076 | - return; |
2077 | - } |
2078 | - else |
2079 | - delete tmp_file; |
2080 | - |
2081 | - return; |
2082 | - } |
2083 | -}; |
2084 | - |
2085 | -/** |
2086 | - This should return ENOENT if the file doesn't exists. |
2087 | - The .frm file will be deleted only if we return 0 or ENOENT |
2088 | -*/ |
2089 | -int ha_delete_table(Session *session, const char *path, |
2090 | - const char *db, const char *alias, bool generate_warning) |
2091 | -{ |
2092 | - TableShare dummy_share; |
2093 | - Table dummy_table; |
2094 | - memset(&dummy_table, 0, sizeof(dummy_table)); |
2095 | - memset(&dummy_share, 0, sizeof(dummy_share)); |
2096 | - |
2097 | - dummy_table.s= &dummy_share; |
2098 | - |
2099 | - int error= ENOENT; |
2100 | - handler *file= NULL; |
2101 | - |
2102 | - for_each(all_engines.begin(), all_engines.end(), |
2103 | - DeleteTableStorageEngine(session, path, &file, &error)); |
2104 | - |
2105 | - if (error == ENOENT) /* proto may be left behind */ |
2106 | - error= delete_table_proto_file(path); |
2107 | - |
2108 | - if (error && generate_warning) |
2109 | - { |
2110 | - /* |
2111 | - Because file->print_error() use my_error() to generate the error message |
2112 | - we use an internal error handler to intercept it and store the text |
2113 | - in a temporary buffer. Later the message will be presented to user |
2114 | - as a warning. |
2115 | - */ |
2116 | - Ha_delete_table_error_handler ha_delete_table_error_handler; |
2117 | - |
2118 | - /* Fill up strucutures that print_error may need */ |
2119 | - dummy_share.path.str= (char*) path; |
2120 | - dummy_share.path.length= strlen(path); |
2121 | - dummy_share.db.str= (char*) db; |
2122 | - dummy_share.db.length= strlen(db); |
2123 | - dummy_share.table_name.str= (char*) alias; |
2124 | - dummy_share.table_name.length= strlen(alias); |
2125 | - dummy_table.alias= alias; |
2126 | - |
2127 | - |
2128 | - if(file != NULL) |
2129 | - { |
2130 | - file->change_table_ptr(&dummy_table, &dummy_share); |
2131 | - |
2132 | - session->push_internal_handler(&ha_delete_table_error_handler); |
2133 | - file->print_error(error, 0); |
2134 | - |
2135 | - session->pop_internal_handler(); |
2136 | - } |
2137 | - else |
2138 | - error= -1; /* General form of fail. maybe bad FRM */ |
2139 | - |
2140 | - /* |
2141 | - XXX: should we convert *all* errors to warnings here? |
2142 | - What if the error is fatal? |
2143 | - */ |
2144 | - push_warning(session, DRIZZLE_ERROR::WARN_LEVEL_ERROR, error, |
2145 | - ha_delete_table_error_handler.buff); |
2146 | - } |
2147 | - |
2148 | - if(file) |
2149 | - delete file; |
2150 | - |
2151 | - return error; |
2152 | -} |
2153 | - |
2154 | -/** |
2155 | Initiates table-file and calls appropriate database-creator. |
2156 | |
2157 | @retval |
2158 | @@ -769,12 +232,12 @@ |
2159 | } |
2160 | |
2161 | |
2162 | -const string ha_resolve_storage_engine_name(const StorageEngine *engine) |
2163 | +const string ha_resolve_storage_engine_name(const plugin::StorageEngine *engine) |
2164 | { |
2165 | return engine == NULL ? string("UNKNOWN") : engine->getName(); |
2166 | } |
2167 | |
2168 | -const char *StorageEngine::checkLowercaseNames(const char *path, char *tmp_path) |
2169 | +const char *plugin::StorageEngine::checkLowercaseNames(const char *path, char *tmp_path) |
2170 | { |
2171 | if (flags.test(HTON_BIT_FILE_BASED)) |
2172 | return path; |
2173 | @@ -795,135 +258,3 @@ |
2174 | return tmp_path; |
2175 | } |
2176 | |
2177 | -class DFETableNameIterator: public TableNameIteratorImplementation |
2178 | -{ |
2179 | -private: |
2180 | - MY_DIR *dirp; |
2181 | - uint32_t current_entry; |
2182 | - |
2183 | -public: |
2184 | - DFETableNameIterator(const std::string &database) |
2185 | - : TableNameIteratorImplementation(database), |
2186 | - dirp(NULL), |
2187 | - current_entry(-1) |
2188 | - {}; |
2189 | - |
2190 | - ~DFETableNameIterator(); |
2191 | - |
2192 | - int next(std::string *name); |
2193 | - |
2194 | -}; |
2195 | - |
2196 | -DFETableNameIterator::~DFETableNameIterator() |
2197 | -{ |
2198 | - if (dirp) |
2199 | - my_dirend(dirp); |
2200 | -} |
2201 | - |
2202 | -int DFETableNameIterator::next(string *name) |
2203 | -{ |
2204 | - char uname[NAME_LEN + 1]; |
2205 | - FILEINFO *file; |
2206 | - char *ext; |
2207 | - uint32_t file_name_len; |
2208 | - const char *wild= NULL; |
2209 | - |
2210 | - if (dirp == NULL) |
2211 | - { |
2212 | - bool dir= false; |
2213 | - char path[FN_REFLEN]; |
2214 | - |
2215 | - build_table_filename(path, sizeof(path), db.c_str(), "", false); |
2216 | - |
2217 | - dirp = my_dir(path,MYF(dir ? MY_WANT_STAT : 0)); |
2218 | - |
2219 | - if (dirp == NULL) |
2220 | - { |
2221 | - if (my_errno == ENOENT) |
2222 | - my_error(ER_BAD_DB_ERROR, MYF(ME_BELL+ME_WAITTANG), db.c_str()); |
2223 | - else |
2224 | - my_error(ER_CANT_READ_DIR, MYF(ME_BELL+ME_WAITTANG), path, my_errno); |
2225 | - return(ENOENT); |
2226 | - } |
2227 | - current_entry= -1; |
2228 | - } |
2229 | - |
2230 | - while(true) |
2231 | - { |
2232 | - current_entry++; |
2233 | - |
2234 | - if (current_entry == dirp->number_off_files) |
2235 | - { |
2236 | - my_dirend(dirp); |
2237 | - dirp= NULL; |
2238 | - return -1; |
2239 | - } |
2240 | - |
2241 | - file= dirp->dir_entry + current_entry; |
2242 | - |
2243 | - if (my_strcasecmp(system_charset_info, ext=fn_rext(file->name),".dfe") || |
2244 | - is_prefix(file->name, TMP_FILE_PREFIX)) |
2245 | - continue; |
2246 | - *ext=0; |
2247 | - |
2248 | - file_name_len= filename_to_tablename(file->name, uname, sizeof(uname)); |
2249 | - |
2250 | - uname[file_name_len]= '\0'; |
2251 | - |
2252 | - if (wild && wild_compare(uname, wild, 0)) |
2253 | - continue; |
2254 | - |
2255 | - if (name) |
2256 | - name->assign(uname); |
2257 | - |
2258 | - return 0; |
2259 | - } |
2260 | -} |
2261 | - |
2262 | -TableNameIterator::TableNameIterator(const std::string &db) |
2263 | - : current_implementation(NULL), database(db) |
2264 | -{ |
2265 | - engine_iter= all_engines.begin(); |
2266 | - default_implementation= new DFETableNameIterator(database); |
2267 | -} |
2268 | - |
2269 | -TableNameIterator::~TableNameIterator() |
2270 | -{ |
2271 | - delete current_implementation; |
2272 | -} |
2273 | - |
2274 | -int TableNameIterator::next(std::string *name) |
2275 | -{ |
2276 | - int err= 0; |
2277 | - |
2278 | -next: |
2279 | - if (current_implementation == NULL) |
2280 | - { |
2281 | - while(current_implementation == NULL && engine_iter != all_engines.end()) |
2282 | - { |
2283 | - StorageEngine *engine= *engine_iter; |
2284 | - current_implementation= engine->tableNameIterator(database); |
2285 | - engine_iter++; |
2286 | - } |
2287 | - |
2288 | - if (current_implementation == NULL && engine_iter == all_engines.end()) |
2289 | - { |
2290 | - current_implementation= default_implementation; |
2291 | - } |
2292 | - } |
2293 | - |
2294 | - err= current_implementation->next(name); |
2295 | - |
2296 | - if (err == -1) |
2297 | - { |
2298 | - if (current_implementation != default_implementation) |
2299 | - { |
2300 | - delete current_implementation; |
2301 | - current_implementation= NULL; |
2302 | - goto next; |
2303 | - } |
2304 | - } |
2305 | - |
2306 | - return err; |
2307 | -} |
2308 | - |
2309 | |
2310 | === modified file 'drizzled/plugin/storage_engine.h' |
2311 | --- drizzled/plugin/storage_engine.h 2009-08-22 02:06:02 +0000 |
2312 | +++ drizzled/plugin/storage_engine.h 2009-09-24 21:11:10 +0000 |
2313 | @@ -22,7 +22,7 @@ |
2314 | |
2315 | |
2316 | #include <drizzled/definitions.h> |
2317 | -#include <drizzled/sql_plugin.h> |
2318 | +#include <drizzled/plugin.h> |
2319 | #include <drizzled/handler_structs.h> |
2320 | #include <drizzled/message/table.pb.h> |
2321 | #include <drizzled/registry.h> |
2322 | @@ -41,7 +41,6 @@ |
2323 | typedef bool (stat_print_fn)(Session *session, const char *type, uint32_t type_len, |
2324 | const char *file, uint32_t file_len, |
2325 | const char *status, uint32_t status_len); |
2326 | -enum ha_stat_type { HA_ENGINE_STATUS, HA_ENGINE_LOGS, HA_ENGINE_MUTEX }; |
2327 | |
2328 | /* Possible flags of a StorageEngine (there can be 32 of them) */ |
2329 | enum engine_flag_bits { |
2330 | @@ -69,8 +68,13 @@ |
2331 | static const std::bitset<HTON_BIT_SIZE> HTON_HAS_DATA_DICTIONARY(1 << HTON_BIT_HAS_DATA_DICTIONARY); |
2332 | |
2333 | class Table; |
2334 | + |
2335 | +namespace drizzled |
2336 | +{ |
2337 | +namespace plugin |
2338 | +{ |
2339 | + |
2340 | class TableNameIteratorImplementation; |
2341 | - |
2342 | /* |
2343 | StorageEngine is a singleton structure - one instance per storage engine - |
2344 | to provide access to storage engine functionality that works on the |
2345 | @@ -128,9 +132,6 @@ |
2346 | |
2347 | virtual ~StorageEngine(); |
2348 | |
2349 | - static int getTableProto(const char* path, |
2350 | - drizzled::message::Table *table_proto); |
2351 | - |
2352 | virtual int getTableProtoImplementation(const char* path, |
2353 | drizzled::message::Table *table_proto) |
2354 | { |
2355 | @@ -340,26 +341,25 @@ |
2356 | |
2357 | }; |
2358 | |
2359 | -class TableNameIterator |
2360 | -{ |
2361 | -private: |
2362 | - drizzled::Registry<StorageEngine *>::iterator engine_iter; |
2363 | - TableNameIteratorImplementation *current_implementation; |
2364 | - TableNameIteratorImplementation *default_implementation; |
2365 | - std::string database; |
2366 | -public: |
2367 | - TableNameIterator(const std::string &db); |
2368 | - ~TableNameIterator(); |
2369 | |
2370 | - int next(std::string *name); |
2371 | -}; |
2372 | +} /* namespace plugin */ |
2373 | +} /* namespace drizzled */ |
2374 | |
2375 | /* lookups */ |
2376 | -StorageEngine *ha_default_storage_engine(Session *session); |
2377 | -StorageEngine *ha_resolve_by_name(Session *session, std::string find_str); |
2378 | +/** |
2379 | + Return the default storage engine plugin::StorageEngine for thread |
2380 | + |
2381 | + @param ha_default_storage_engine(session) |
2382 | + @param session current thread |
2383 | + |
2384 | + @return |
2385 | + pointer to plugin::StorageEngine |
2386 | +*/ |
2387 | +drizzled::plugin::StorageEngine *ha_default_storage_engine(Session *session); |
2388 | |
2389 | handler *get_new_handler(TableShare *share, MEM_ROOT *alloc, |
2390 | - StorageEngine *db_type); |
2391 | -const std::string ha_resolve_storage_engine_name(const StorageEngine *db_type); |
2392 | + drizzled::plugin::StorageEngine *db_type); |
2393 | +const std::string ha_resolve_storage_engine_name(const drizzled::plugin::StorageEngine *db_type); |
2394 | + |
2395 | |
2396 | #endif /* DRIZZLED_PLUGIN_STORAGE_ENGINE_H */ |
2397 | |
2398 | === modified file 'drizzled/registry.h' |
2399 | --- drizzled/registry.h 2009-08-17 20:54:05 +0000 |
2400 | +++ drizzled/registry.h 2009-09-24 21:11:10 +0000 |
2401 | @@ -23,6 +23,7 @@ |
2402 | #include <map> |
2403 | #include <set> |
2404 | #include <string> |
2405 | +#include <vector> |
2406 | #include <algorithm> |
2407 | #include <functional> |
2408 | |
2409 | |
2410 | === modified file 'drizzled/replication_services.cc' |
2411 | --- drizzled/replication_services.cc 2009-09-16 17:10:18 +0000 |
2412 | +++ drizzled/replication_services.cc 2009-09-24 21:11:10 +0000 |
2413 | @@ -56,28 +56,6 @@ |
2414 | using namespace std; |
2415 | using namespace drizzled; |
2416 | |
2417 | -ReplicationServices replication_services; |
2418 | - |
2419 | -void add_replicator(plugin::CommandReplicator *replicator) |
2420 | -{ |
2421 | - replication_services.attachReplicator(replicator); |
2422 | -} |
2423 | - |
2424 | -void remove_replicator(plugin::CommandReplicator *replicator) |
2425 | -{ |
2426 | - replication_services.detachReplicator(replicator); |
2427 | -} |
2428 | - |
2429 | -void add_applier(plugin::CommandApplier *applier) |
2430 | -{ |
2431 | - replication_services.attachApplier(applier); |
2432 | -} |
2433 | - |
2434 | -void remove_applier(plugin::CommandApplier *applier) |
2435 | -{ |
2436 | - replication_services.detachApplier(applier); |
2437 | -} |
2438 | - |
2439 | ReplicationServices::ReplicationServices() |
2440 | { |
2441 | is_active= false; |
2442 | |
2443 | === modified file 'drizzled/replication_services.h' |
2444 | --- drizzled/replication_services.h 2009-07-29 09:19:15 +0000 |
2445 | +++ drizzled/replication_services.h 2009-09-24 21:11:10 +0000 |
2446 | @@ -42,21 +42,13 @@ |
2447 | { |
2448 | class Command; |
2449 | } |
2450 | -} |
2451 | - |
2452 | -void add_replicator(drizzled::plugin::CommandReplicator *replicator); |
2453 | -void remove_replicator(drizzled::plugin::CommandReplicator *replicator); |
2454 | - |
2455 | -void add_applier(drizzled::plugin::CommandApplier *applier); |
2456 | -void remove_applier(drizzled::plugin::CommandApplier *applier); |
2457 | + |
2458 | |
2459 | /** |
2460 | * This is a class which manages transforming internal |
2461 | * transactional events into GPB messages and sending those |
2462 | * events out through registered replicators and appliers. |
2463 | */ |
2464 | -namespace drizzled |
2465 | -{ |
2466 | class ReplicationServices |
2467 | { |
2468 | public: |
2469 | @@ -103,6 +95,17 @@ |
2470 | * Constructor |
2471 | */ |
2472 | ReplicationServices(); |
2473 | + |
2474 | + /** |
2475 | + * Singleton method |
2476 | + * Returns the singleton instance of ReplicationServices |
2477 | + */ |
2478 | + static inline ReplicationServices &singleton() |
2479 | + { |
2480 | + static ReplicationServices replication_services; |
2481 | + return replication_services; |
2482 | + } |
2483 | + |
2484 | /** |
2485 | * Returns whether the ReplicationServices object |
2486 | * is active. In other words, does it have both |
2487 | |
2488 | === modified file 'drizzled/server_includes.h' |
2489 | --- drizzled/server_includes.h 2009-09-22 07:35:28 +0000 |
2490 | +++ drizzled/server_includes.h 2009-09-24 21:11:10 +0000 |
2491 | @@ -37,8 +37,8 @@ |
2492 | /* Custom C string functions */ |
2493 | #include <mystrings/m_string.h> |
2494 | |
2495 | -/* The <strong>INTERNAL</strong> plugin API - not the external, or public, server plugin API */ |
2496 | -#include <drizzled/sql_plugin.h> |
2497 | +/* The plugin API */ |
2498 | +#include <drizzled/plugin.h> |
2499 | /* Range optimization API/library */ |
2500 | #include <drizzled/opt_range.h> |
2501 | /* Routines for dropping, repairing, checking schema tables */ |
2502 | @@ -150,8 +150,8 @@ |
2503 | extern struct my_option my_long_options[]; |
2504 | extern std::bitset<5> sql_command_flags[]; |
2505 | |
2506 | -extern StorageEngine *myisam_engine; |
2507 | -extern StorageEngine *heap_engine; |
2508 | +extern drizzled::plugin::StorageEngine *myisam_engine; |
2509 | +extern drizzled::plugin::StorageEngine *heap_engine; |
2510 | |
2511 | extern SHOW_COMP_OPTION have_symlink; |
2512 | |
2513 | |
2514 | === modified file 'drizzled/session.cc' |
2515 | --- drizzled/session.cc 2009-09-23 21:40:36 +0000 |
2516 | +++ drizzled/session.cc 2009-09-24 21:11:10 +0000 |
2517 | @@ -36,8 +36,8 @@ |
2518 | #include <drizzled/item/return_int.h> |
2519 | #include <drizzled/item/empty_string.h> |
2520 | #include <drizzled/show.h> |
2521 | -#include <drizzled/scheduling.h> |
2522 | #include <drizzled/plugin/client.h> |
2523 | +#include "drizzled/plugin/scheduler.h" |
2524 | #include "drizzled/probes.h" |
2525 | |
2526 | #include <algorithm> |
2527 | @@ -144,7 +144,7 @@ |
2528 | } |
2529 | |
2530 | extern "C" |
2531 | -void **session_ha_data(const Session *session, const struct StorageEngine *engine) |
2532 | +void **session_ha_data(const Session *session, const plugin::StorageEngine *engine) |
2533 | { |
2534 | return (void **) &session->ha_data[engine->slot].ha_ptr; |
2535 | } |
2536 | @@ -606,7 +606,9 @@ |
2537 | |
2538 | bool Session::schedule() |
2539 | { |
2540 | - scheduler= get_thread_scheduler(); |
2541 | + plugin::Registry &plugins= plugin::Registry::singleton(); |
2542 | + |
2543 | + scheduler= plugins.scheduler.getScheduler(); |
2544 | |
2545 | ++connection_count; |
2546 | |
2547 | @@ -651,6 +653,7 @@ |
2548 | |
2549 | bool Session::checkUser(const char *passwd, uint32_t passwd_len, const char *in_db) |
2550 | { |
2551 | + plugin::Registry &plugins= plugin::Registry::singleton(); |
2552 | LEX_STRING db_str= { (char *) in_db, in_db ? strlen(in_db) : 0 }; |
2553 | bool is_authenticated; |
2554 | |
2555 | @@ -668,7 +671,7 @@ |
2556 | return false; |
2557 | } |
2558 | |
2559 | - is_authenticated= authenticate_user(this, passwd); |
2560 | + is_authenticated= plugins.authentication.authenticate(this, passwd); |
2561 | |
2562 | if (is_authenticated != true) |
2563 | { |
2564 | @@ -1923,7 +1926,7 @@ |
2565 | |
2566 | void Session::close_temporary(Table *table, bool free_share, bool delete_table) |
2567 | { |
2568 | - StorageEngine *table_type= table->s->db_type(); |
2569 | + plugin::StorageEngine *table_type= table->s->db_type(); |
2570 | |
2571 | table->free_io_cache(); |
2572 | table->closefrm(false); |
2573 | @@ -2149,7 +2152,7 @@ |
2574 | return false; |
2575 | } |
2576 | |
2577 | -bool Session::rm_temporary_table(StorageEngine *base, char *path) |
2578 | +bool Session::rm_temporary_table(plugin::StorageEngine *base, char *path) |
2579 | { |
2580 | bool error=0; |
2581 | |
2582 | |
2583 | === modified file 'drizzled/session.h' |
2584 | --- drizzled/session.h 2009-09-22 07:35:28 +0000 |
2585 | +++ drizzled/session.h 2009-09-24 21:11:10 +0000 |
2586 | @@ -23,7 +23,7 @@ |
2587 | |
2588 | /* Classes in mysql */ |
2589 | |
2590 | -#include <drizzled/sql_plugin.h> |
2591 | +#include "drizzled/plugin.h" |
2592 | #include <drizzled/sql_locale.h> |
2593 | #include <drizzled/ha_trx_info.h> |
2594 | #include <mysys/my_alloc.h> |
2595 | @@ -33,7 +33,6 @@ |
2596 | #include <drizzled/sql_error.h> |
2597 | #include <drizzled/file_exchange.h> |
2598 | #include <drizzled/select_result_interceptor.h> |
2599 | -#include <drizzled/authentication.h> |
2600 | #include <drizzled/db.h> |
2601 | #include <drizzled/xid.h> |
2602 | |
2603 | @@ -170,7 +169,7 @@ |
2604 | /* TODO: change this to my_thread_id - but have to fix set_var first */ |
2605 | uint64_t pseudo_thread_id; |
2606 | |
2607 | - StorageEngine *storage_engine; |
2608 | + drizzled::plugin::StorageEngine *storage_engine; |
2609 | |
2610 | /* Only charset part of these variables is sensible */ |
2611 | const CHARSET_INFO *character_set_filesystem; |
2612 | @@ -1407,7 +1406,7 @@ |
2613 | void close_temporary_table(Table *table, bool free_share, bool delete_table); |
2614 | void close_temporary(Table *table, bool free_share, bool delete_table); |
2615 | int drop_temporary_table(TableList *table_list); |
2616 | - bool rm_temporary_table(StorageEngine *base, char *path); |
2617 | + bool rm_temporary_table(drizzled::plugin::StorageEngine *base, char *path); |
2618 | Table *open_temporary_table(const char *path, const char *db, |
2619 | const char *table_name, bool link_in_list, |
2620 | open_table_mode open_mode); |
2621 | |
2622 | === modified file 'drizzled/set_var.cc' |
2623 | --- drizzled/set_var.cc 2009-08-13 21:55:13 +0000 |
2624 | +++ drizzled/set_var.cc 2009-09-24 21:11:10 +0000 |
2625 | @@ -57,13 +57,14 @@ |
2626 | #include <drizzled/item/uint.h> |
2627 | #include <drizzled/item/null.h> |
2628 | #include <drizzled/item/float.h> |
2629 | -#include <drizzled/sql_plugin.h> |
2630 | +#include <drizzled/plugin.h> |
2631 | |
2632 | #include "drizzled/registry.h" |
2633 | #include <map> |
2634 | #include <algorithm> |
2635 | |
2636 | using namespace std; |
2637 | +using namespace drizzled; |
2638 | |
2639 | extern const CHARSET_INFO *character_set_filesystem; |
2640 | extern size_t my_thread_stack_size; |
2641 | @@ -2048,7 +2049,7 @@ |
2642 | else |
2643 | { |
2644 | const std::string engine_name(res->ptr()); |
2645 | - StorageEngine *engine; |
2646 | + plugin::StorageEngine *engine; |
2647 | var->save_result.storage_engine= ha_resolve_by_name(session, engine_name); |
2648 | if (var->save_result.storage_engine == NULL) |
2649 | { |
2650 | @@ -2073,7 +2074,7 @@ |
2651 | { |
2652 | unsigned char* result; |
2653 | string engine_name; |
2654 | - StorageEngine *engine= session->variables.*offset; |
2655 | + plugin::StorageEngine *engine= session->variables.*offset; |
2656 | if (type == OPT_GLOBAL) |
2657 | engine= global_system_variables.*offset; |
2658 | engine_name= engine->getName(); |
2659 | @@ -2085,7 +2086,7 @@ |
2660 | |
2661 | void sys_var_session_storage_engine::set_default(Session *session, enum_var_type type) |
2662 | { |
2663 | - StorageEngine *old_value, *new_value, **value; |
2664 | + plugin::StorageEngine *old_value, *new_value, **value; |
2665 | if (type == OPT_GLOBAL) |
2666 | { |
2667 | value= &(global_system_variables.*offset); |
2668 | @@ -2104,7 +2105,7 @@ |
2669 | |
2670 | bool sys_var_session_storage_engine::update(Session *session, set_var *var) |
2671 | { |
2672 | - StorageEngine **value= &(global_system_variables.*offset), *old_value; |
2673 | + plugin::StorageEngine **value= &(global_system_variables.*offset), *old_value; |
2674 | if (var->type != OPT_GLOBAL) |
2675 | value= &(session->variables.*offset); |
2676 | old_value= *value; |
2677 | |
2678 | === modified file 'drizzled/set_var.h' |
2679 | --- drizzled/set_var.h 2009-08-13 21:22:40 +0000 |
2680 | +++ drizzled/set_var.h 2009-09-24 21:11:10 +0000 |
2681 | @@ -656,10 +656,10 @@ |
2682 | class sys_var_session_storage_engine :public sys_var_session |
2683 | { |
2684 | protected: |
2685 | - StorageEngine *SV::*offset; |
2686 | + drizzled::plugin::StorageEngine *SV::*offset; |
2687 | public: |
2688 | sys_var_session_storage_engine(sys_var_chain *chain, const char *name_arg, |
2689 | - StorageEngine *SV::*offset_arg) |
2690 | + drizzled::plugin::StorageEngine *SV::*offset_arg) |
2691 | :sys_var_session(name_arg), offset(offset_arg) |
2692 | { chain_sys_var(chain); } |
2693 | bool check(Session *session, set_var *var); |
2694 | @@ -983,7 +983,7 @@ |
2695 | uint32_t uint32_t_value; |
2696 | uint64_t uint64_t_value; |
2697 | size_t size_t_value; |
2698 | - StorageEngine *storage_engine; |
2699 | + drizzled::plugin::StorageEngine *storage_engine; |
2700 | Time_zone *time_zone; |
2701 | MY_LOCALE *locale_value; |
2702 | } save_result; |
2703 | |
2704 | === modified file 'drizzled/show.cc' |
2705 | --- drizzled/show.cc 2009-08-31 23:50:37 +0000 |
2706 | +++ drizzled/show.cc 2009-09-24 21:11:10 +0000 |
2707 | @@ -40,7 +40,7 @@ |
2708 | #include <drizzled/item/return_date_time.h> |
2709 | #include <drizzled/item/empty_string.h> |
2710 | #include "drizzled/plugin/registry.h" |
2711 | -#include <drizzled/info_schema.h> |
2712 | +#include <drizzled/plugin/info_schema_table.h> |
2713 | #include <drizzled/message/schema.pb.h> |
2714 | #include <drizzled/plugin/client.h> |
2715 | #include <mysys/cached_directory.h> |
2716 | @@ -66,26 +66,6 @@ |
2717 | |
2718 | static void store_key_options(String *packet, Table *table, KEY *key_info); |
2719 | |
2720 | -static vector<InfoSchemaTable *> all_schema_tables; |
2721 | - |
2722 | -void add_infoschema_table(InfoSchemaTable *schema_table) |
2723 | -{ |
2724 | - if (schema_table->getFirstColumnIndex() == 0) |
2725 | - schema_table->setFirstColumnIndex(-1); |
2726 | - if (schema_table->getSecondColumnIndex() == 0) |
2727 | - schema_table->setSecondColumnIndex(-1); |
2728 | - |
2729 | - all_schema_tables.push_back(schema_table); |
2730 | -} |
2731 | - |
2732 | -void remove_infoschema_table(InfoSchemaTable *table) |
2733 | -{ |
2734 | - all_schema_tables.erase(remove_if(all_schema_tables.begin(), |
2735 | - all_schema_tables.end(), |
2736 | - bind2nd(equal_to<InfoSchemaTable *>(), |
2737 | - table)), |
2738 | - all_schema_tables.end()); |
2739 | -} |
2740 | |
2741 | |
2742 | int wild_case_compare(const CHARSET_INFO * const cs, const char *str,const char *wildstr) |
2743 | @@ -1102,7 +1082,7 @@ |
2744 | TableList *table, |
2745 | LOOKUP_FIELD_VALUES *lookup_field_vals) |
2746 | { |
2747 | - InfoSchemaTable *schema_table= table->schema_table; |
2748 | + plugin::InfoSchemaTable *schema_table= table->schema_table; |
2749 | const char *field_name1= schema_table->getFirstColumnIndex() >= 0 ? |
2750 | schema_table->getColumnName(schema_table->getFirstColumnIndex()).c_str() : ""; |
2751 | const char *field_name2= schema_table->getSecondColumnIndex() >= 0 ? |
2752 | @@ -1230,7 +1210,7 @@ |
2753 | { |
2754 | Item_field *item_field= (Item_field*)item; |
2755 | const CHARSET_INFO * const cs= system_charset_info; |
2756 | - InfoSchemaTable *schema_table= table->schema_table; |
2757 | + plugin::InfoSchemaTable *schema_table= table->schema_table; |
2758 | const char *field_name1= schema_table->getFirstColumnIndex() >= 0 ? |
2759 | schema_table->getColumnName(schema_table->getFirstColumnIndex()).c_str() : ""; |
2760 | const char *field_name2= schema_table->getSecondColumnIndex() >= 0 ? |
2761 | @@ -1463,57 +1443,14 @@ |
2762 | } |
2763 | |
2764 | |
2765 | -class AddSchemaTable : public unary_function<InfoSchemaTable *, bool> |
2766 | -{ |
2767 | - Session *session; |
2768 | - const char *wild; |
2769 | - vector<LEX_STRING*> &files; |
2770 | - |
2771 | -public: |
2772 | - AddSchemaTable(Session *session_arg, vector<LEX_STRING*> &files_arg, const char *wild_arg) |
2773 | - : session(session_arg), wild(wild_arg), files(files_arg) |
2774 | - {} |
2775 | - |
2776 | - result_type operator() (argument_type schema_table) |
2777 | - { |
2778 | - if (schema_table->isHidden()) |
2779 | - { |
2780 | - return false; |
2781 | - } |
2782 | - |
2783 | - const string &schema_table_name= schema_table->getTableName(); |
2784 | - |
2785 | - if (wild && wild_case_compare(files_charset_info, schema_table_name.c_str(), wild)) |
2786 | - { |
2787 | - return false; |
2788 | - } |
2789 | - |
2790 | - LEX_STRING *file_name= 0; |
2791 | - file_name= session->make_lex_string(file_name, schema_table_name.c_str(), |
2792 | - schema_table_name.length(), true); |
2793 | - if (file_name == NULL) |
2794 | - { |
2795 | - return true; |
2796 | - } |
2797 | - |
2798 | - files.push_back(file_name); |
2799 | - return false; |
2800 | - } |
2801 | -}; |
2802 | - |
2803 | - |
2804 | -static int schema_tables_add(Session *session, vector<LEX_STRING*> &files, const char *wild) |
2805 | -{ |
2806 | - vector<InfoSchemaTable *>::iterator iter= find_if(all_schema_tables.begin(), |
2807 | - all_schema_tables.end(), |
2808 | - AddSchemaTable(session, files, wild)); |
2809 | - |
2810 | - if (iter != all_schema_tables.end()) |
2811 | - { |
2812 | - return 1; |
2813 | - } |
2814 | - |
2815 | - return 0; |
2816 | + |
2817 | + |
2818 | +static int schema_tables_add(Session *session, |
2819 | + vector<LEX_STRING*> &files, |
2820 | + const char *wild) |
2821 | +{ |
2822 | + plugin::Registry &plugins= plugin::Registry::singleton(); |
2823 | + return plugins.info_schema.addTableToList(session, files, wild); |
2824 | } |
2825 | |
2826 | |
2827 | @@ -1570,7 +1507,7 @@ |
2828 | |
2829 | string db(db_name->str); |
2830 | |
2831 | - TableNameIterator tniter(db); |
2832 | + slot::TableNameIterator tniter(db); |
2833 | int err= 0; |
2834 | string table_name; |
2835 | |
2836 | @@ -1622,7 +1559,7 @@ |
2837 | |
2838 | static int |
2839 | fill_schema_show_cols_or_idxs(Session *session, TableList *tables, |
2840 | - InfoSchemaTable *schema_table, |
2841 | + plugin::InfoSchemaTable *schema_table, |
2842 | Open_tables_state *open_tables_state_backup) |
2843 | { |
2844 | LEX *lex= session->lex; |
2845 | @@ -1739,7 +1676,7 @@ |
2846 | */ |
2847 | |
2848 | static uint32_t get_table_open_method(TableList *tables, |
2849 | - InfoSchemaTable *schema_table) |
2850 | + plugin::InfoSchemaTable *schema_table) |
2851 | { |
2852 | /* |
2853 | determine which method will be used for table opening |
2854 | @@ -1778,7 +1715,7 @@ |
2855 | */ |
2856 | |
2857 | static int fill_schema_table_from_frm(Session *session,TableList *tables, |
2858 | - InfoSchemaTable *schema_table, |
2859 | + plugin::InfoSchemaTable *schema_table, |
2860 | LEX_STRING *db_name, |
2861 | LEX_STRING *table_name) |
2862 | { |
2863 | @@ -1832,7 +1769,7 @@ |
2864 | temporary tables that are filled at query execution time. |
2865 | Those I_S tables whose data are retrieved |
2866 | from frm files and storage engine are filled by the function |
2867 | - InfoSchemaMethods::fillTable(). |
2868 | + plugin::InfoSchemaMethods::fillTable(). |
2869 | |
2870 | @param[in] session thread handler |
2871 | @param[in] tables I_S table |
2872 | @@ -1842,14 +1779,14 @@ |
2873 | @retval 0 success |
2874 | @retval 1 error |
2875 | */ |
2876 | -int InfoSchemaMethods::fillTable(Session *session, TableList *tables, COND *cond) |
2877 | +int plugin::InfoSchemaMethods::fillTable(Session *session, TableList *tables, COND *cond) |
2878 | { |
2879 | LEX *lex= session->lex; |
2880 | Table *table= tables->table; |
2881 | Select_Lex *old_all_select_lex= lex->all_selects_list; |
2882 | enum_sql_command save_sql_command= lex->sql_command; |
2883 | Select_Lex *lsel= tables->schema_select_lex; |
2884 | - InfoSchemaTable *schema_table= tables->schema_table; |
2885 | + plugin::InfoSchemaTable *schema_table= tables->schema_table; |
2886 | Select_Lex sel; |
2887 | LOOKUP_FIELD_VALUES lookup_field_vals; |
2888 | bool with_i_schema; |
2889 | @@ -2168,7 +2105,7 @@ |
2890 | } |
2891 | |
2892 | |
2893 | -int InfoSchemaMethods::processTable(Session *session, TableList *tables, |
2894 | +int plugin::InfoSchemaMethods::processTable(Session *session, TableList *tables, |
2895 | Table *table, bool res, |
2896 | LEX_STRING *db_name, |
2897 | LEX_STRING *table_name) const |
2898 | @@ -2289,21 +2226,6 @@ |
2899 | } |
2900 | |
2901 | |
2902 | -class FindSchemaTableByName : public unary_function<InfoSchemaTable *, bool> |
2903 | -{ |
2904 | - const char *table_name; |
2905 | -public: |
2906 | - FindSchemaTableByName(const char *table_name_arg) |
2907 | - : table_name(table_name_arg) {} |
2908 | - result_type operator() (argument_type schema_table) |
2909 | - { |
2910 | - return ! my_strcasecmp(system_charset_info, |
2911 | - schema_table->getTableName().c_str(), |
2912 | - table_name); |
2913 | - } |
2914 | -}; |
2915 | - |
2916 | - |
2917 | /* |
2918 | Find schema_tables elment by name |
2919 | |
2920 | @@ -2316,21 +2238,15 @@ |
2921 | # pointer to 'schema_tables' element |
2922 | */ |
2923 | |
2924 | -InfoSchemaTable *find_schema_table(const char* table_name) |
2925 | +plugin::InfoSchemaTable *find_schema_table(const char* table_name) |
2926 | { |
2927 | - vector<InfoSchemaTable *>::iterator iter= |
2928 | - find_if(all_schema_tables.begin(), all_schema_tables.end(), |
2929 | - FindSchemaTableByName(table_name)); |
2930 | - if (iter != all_schema_tables.end()) |
2931 | - { |
2932 | - return *iter; |
2933 | - } |
2934 | - |
2935 | - return NULL; |
2936 | + |
2937 | + plugin::Registry &plugins= plugin::Registry::singleton(); |
2938 | + return plugins.info_schema.getTable(table_name); |
2939 | } |
2940 | |
2941 | |
2942 | -Table *InfoSchemaMethods::createSchemaTable(Session *session, TableList *table_list) |
2943 | +Table *plugin::InfoSchemaMethods::createSchemaTable(Session *session, TableList *table_list) |
2944 | const |
2945 | { |
2946 | int field_count= 0; |
2947 | @@ -2338,12 +2254,12 @@ |
2948 | Table *table; |
2949 | List<Item> field_list; |
2950 | const CHARSET_INFO * const cs= system_charset_info; |
2951 | - const InfoSchemaTable::Columns &columns= table_list->schema_table->getColumns(); |
2952 | - InfoSchemaTable::Columns::const_iterator iter= columns.begin(); |
2953 | + const plugin::InfoSchemaTable::Columns &columns= table_list->schema_table->getColumns(); |
2954 | + plugin::InfoSchemaTable::Columns::const_iterator iter= columns.begin(); |
2955 | |
2956 | while (iter != columns.end()) |
2957 | { |
2958 | - const ColumnInfo *column= *iter; |
2959 | + const plugin::ColumnInfo *column= *iter; |
2960 | switch (column->getType()) { |
2961 | case DRIZZLE_TYPE_LONG: |
2962 | case DRIZZLE_TYPE_LONGLONG: |
2963 | @@ -2435,7 +2351,7 @@ |
2964 | Make list of fields for SHOW |
2965 | |
2966 | SYNOPSIS |
2967 | - InfoSchemaMethods::oldFormat() |
2968 | + plugin::InfoSchemaMethods::oldFormat() |
2969 | session thread handler |
2970 | schema_table pointer to 'schema_tables' element |
2971 | |
2972 | @@ -2444,16 +2360,16 @@ |
2973 | 0 success |
2974 | */ |
2975 | |
2976 | -int InfoSchemaMethods::oldFormat(Session *session, InfoSchemaTable *schema_table) |
2977 | +int plugin::InfoSchemaMethods::oldFormat(Session *session, plugin::InfoSchemaTable *schema_table) |
2978 | const |
2979 | { |
2980 | Name_resolution_context *context= &session->lex->select_lex.context; |
2981 | - const InfoSchemaTable::Columns columns= schema_table->getColumns(); |
2982 | - InfoSchemaTable::Columns::const_iterator iter= columns.begin(); |
2983 | + const plugin::InfoSchemaTable::Columns columns= schema_table->getColumns(); |
2984 | + plugin::InfoSchemaTable::Columns::const_iterator iter= columns.begin(); |
2985 | |
2986 | while (iter != columns.end()) |
2987 | { |
2988 | - const ColumnInfo *column= *iter; |
2989 | + const plugin::ColumnInfo *column= *iter; |
2990 | if (column->getOldName().length() != 0) |
2991 | { |
2992 | Item_field *field= new Item_field(context, |
2993 | @@ -2531,7 +2447,7 @@ |
2994 | bool make_schema_select(Session *session, Select_Lex *sel, |
2995 | const string& schema_table_name) |
2996 | { |
2997 | - InfoSchemaTable *schema_table= find_schema_table(schema_table_name.c_str()); |
2998 | + plugin::InfoSchemaTable *schema_table= find_schema_table(schema_table_name.c_str()); |
2999 | LEX_STRING db, table; |
3000 | /* |
3001 | We have to make non const db_name & table_name |
3002 | |
3003 | === modified file 'drizzled/show.h' |
3004 | --- drizzled/show.h 2009-08-04 14:13:13 +0000 |
3005 | +++ drizzled/show.h 2009-09-24 21:11:10 +0000 |
3006 | @@ -40,7 +40,14 @@ |
3007 | struct st_ha_create_information; |
3008 | typedef st_ha_create_information HA_CREATE_INFO; |
3009 | struct TableList; |
3010 | -class InfoSchemaTable; |
3011 | +namespace drizzled |
3012 | +{ |
3013 | +namespace plugin |
3014 | +{ |
3015 | + class InfoSchemaTable; |
3016 | +} |
3017 | +} |
3018 | + |
3019 | |
3020 | typedef struct system_status_var STATUS_VAR; |
3021 | |
3022 | @@ -66,7 +73,7 @@ |
3023 | int wild_case_compare(const CHARSET_INFO * const cs, |
3024 | const char *str,const char *wildstr); |
3025 | |
3026 | -InfoSchemaTable *find_schema_table(const char* table_name); |
3027 | +drizzled::plugin::InfoSchemaTable *find_schema_table(const char* table_name); |
3028 | bool make_schema_select(Session *session, Select_Lex *sel, |
3029 | const std::string& schema_table_name); |
3030 | bool mysql_schema_table(Session *session, LEX *lex, TableList *table_list); |
3031 | @@ -91,7 +98,5 @@ |
3032 | void init_status_vars(); |
3033 | void free_status_vars(); |
3034 | void reset_status_vars(); |
3035 | -void add_infoschema_table(InfoSchemaTable *schema_table); |
3036 | -void remove_infoschema_table(InfoSchemaTable *table); |
3037 | |
3038 | #endif /* DRIZZLE_SERVER_SHOW_H */ |
3039 | |
3040 | === renamed file 'drizzled/authentication.cc' => 'drizzled/slot/authentication.cc' |
3041 | --- drizzled/authentication.cc 2009-08-05 09:29:04 +0000 |
3042 | +++ drizzled/slot/authentication.cc 2009-09-24 21:11:10 +0000 |
3043 | @@ -19,38 +19,46 @@ |
3044 | */ |
3045 | |
3046 | #include "drizzled/server_includes.h" |
3047 | -#include "drizzled/authentication.h" |
3048 | -#include "drizzled/gettext.h" |
3049 | +#include "drizzled/slot/authentication.h" |
3050 | #include "drizzled/errmsg_print.h" |
3051 | #include "drizzled/plugin/registry.h" |
3052 | +#include "drizzled/plugin/authentication.h" |
3053 | +#include "drizzled/gettext.h" |
3054 | |
3055 | #include <vector> |
3056 | |
3057 | +using namespace drizzled; |
3058 | using namespace std; |
3059 | |
3060 | -static vector<Authentication *> all_authentication; |
3061 | - |
3062 | -static bool are_plugins_loaded= false; |
3063 | - |
3064 | -void add_authentication(Authentication *auth) |
3065 | -{ |
3066 | - all_authentication.push_back(auth); |
3067 | -} |
3068 | - |
3069 | -void remove_authentication(Authentication *auth) |
3070 | -{ |
3071 | - all_authentication.erase(find(all_authentication.begin(), |
3072 | - all_authentication.end(), |
3073 | - auth)); |
3074 | -} |
3075 | - |
3076 | -class AuthenticateBy : public unary_function<Authentication *, bool> |
3077 | + |
3078 | +void slot::Authentication::add(plugin::Authentication *auth) |
3079 | +{ |
3080 | + if (auth != NULL) |
3081 | + all_authentication.push_back(auth); |
3082 | +} |
3083 | + |
3084 | +void slot::Authentication::remove(plugin::Authentication *auth) |
3085 | +{ |
3086 | + if (auth != NULL) |
3087 | + all_authentication.erase(find(all_authentication.begin(), |
3088 | + all_authentication.end(), |
3089 | + auth)); |
3090 | +} |
3091 | + |
3092 | +namespace drizzled |
3093 | +{ |
3094 | +namespace slot |
3095 | +{ |
3096 | +namespace auth_priv |
3097 | +{ |
3098 | + |
3099 | +class AuthenticateBy : public unary_function<plugin::Authentication *, bool> |
3100 | { |
3101 | Session *session; |
3102 | const char *password; |
3103 | public: |
3104 | AuthenticateBy(Session *session_arg, const char *password_arg) : |
3105 | - unary_function<Authentication *, bool>(), |
3106 | + unary_function<plugin::Authentication *, bool>(), |
3107 | session(session_arg), password(password_arg) {} |
3108 | |
3109 | inline result_type operator()(argument_type auth) |
3110 | @@ -58,17 +66,20 @@ |
3111 | return auth->authenticate(session, password); |
3112 | } |
3113 | }; |
3114 | +} /* namespace auth_priv */ |
3115 | +} /* namespace slot */ |
3116 | +} /* namespace drizzled */ |
3117 | |
3118 | -bool authenticate_user(Session *session, const char *password) |
3119 | +bool slot::Authentication::authenticate(Session *session, const char *password) |
3120 | { |
3121 | /* If we never loaded any auth plugins, just return true */ |
3122 | if (are_plugins_loaded != true) |
3123 | return true; |
3124 | |
3125 | /* Use find_if instead of foreach so that we can collect return codes */ |
3126 | - vector<Authentication *>::iterator iter= |
3127 | + vector<plugin::Authentication *>::iterator iter= |
3128 | find_if(all_authentication.begin(), all_authentication.end(), |
3129 | - AuthenticateBy(session, password)); |
3130 | + slot::auth_priv::AuthenticateBy(session, password)); |
3131 | /* If iter is == end() here, that means that all of the plugins returned |
3132 | * false, which in this case means they all succeeded. Since we want to |
3133 | * return false on success, we return the value of the two being != |
3134 | |
3135 | === renamed file 'drizzled/authentication.h' => 'drizzled/slot/authentication.h' |
3136 | --- drizzled/authentication.h 2009-05-11 17:50:22 +0000 |
3137 | +++ drizzled/slot/authentication.h 2009-09-24 21:11:10 +0000 |
3138 | @@ -19,13 +19,39 @@ |
3139 | */ |
3140 | |
3141 | |
3142 | -#ifndef DRIZZLED_AUTHENTICATION_H |
3143 | -#define DRIZZLED_AUTHENTICATION_H |
3144 | - |
3145 | -#include <drizzled/plugin/authentication.h> |
3146 | - |
3147 | -bool authenticate_user(Session *session, const char *password); |
3148 | -void add_authentication(Authentication *auth); |
3149 | -void remove_authentication(Authentication *auth); |
3150 | - |
3151 | -#endif /* DRIZZLED_AUTHENTICATION_H */ |
3152 | +#ifndef DRIZZLED_SLOT_AUTHENTICATION_H |
3153 | +#define DRIZZLED_SLOT_AUTHENTICATION_H |
3154 | + |
3155 | +#include <vector> |
3156 | + |
3157 | +class Session; |
3158 | + |
3159 | +namespace drizzled |
3160 | +{ |
3161 | +namespace plugin |
3162 | +{ |
3163 | + class Authentication; |
3164 | +} |
3165 | + |
3166 | +namespace slot |
3167 | +{ |
3168 | + |
3169 | +class Authentication |
3170 | +{ |
3171 | +private: |
3172 | + std::vector<plugin::Authentication *> all_authentication; |
3173 | + bool are_plugins_loaded; |
3174 | + |
3175 | +public: |
3176 | + Authentication() : all_authentication(), are_plugins_loaded(false) {} |
3177 | + ~Authentication() {} |
3178 | + |
3179 | + void add(plugin::Authentication *auth); |
3180 | + void remove(plugin::Authentication *auth); |
3181 | + bool authenticate(Session *session, const char *password); |
3182 | +}; |
3183 | + |
3184 | +} /* namespace slot */ |
3185 | +} /* namespace drizzled */ |
3186 | + |
3187 | +#endif /* DRIZZLED_SLOT_AUTHENTICATION_H */ |
3188 | |
3189 | === added file 'drizzled/slot/command_applier.cc' |
3190 | --- drizzled/slot/command_applier.cc 1970-01-01 00:00:00 +0000 |
3191 | +++ drizzled/slot/command_applier.cc 2009-09-24 21:11:10 +0000 |
3192 | @@ -0,0 +1,39 @@ |
3193 | +/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
3194 | + * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
3195 | + * |
3196 | + * Copyright (C) 2009 Sun Microsystems |
3197 | + * |
3198 | + * This program is free software; you can redistribute it and/or modify |
3199 | + * it under the terms of the GNU General Public License as published by |
3200 | + * the Free Software Foundation; version 2 of the License. |
3201 | + * |
3202 | + * This program is distributed in the hope that it will be useful, |
3203 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3204 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3205 | + * GNU General Public License for more details. |
3206 | + * |
3207 | + * You should have received a copy of the GNU General Public License |
3208 | + * along with this program; if not, write to the Free Software |
3209 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
3210 | + */ |
3211 | + |
3212 | +#include "drizzled/global.h" |
3213 | + |
3214 | +#include "drizzled/replication_services.h" |
3215 | +#include "drizzled/slot/command_applier.h" |
3216 | + |
3217 | +using namespace std; |
3218 | +using namespace drizzled; |
3219 | + |
3220 | +void slot::CommandApplier::add(plugin::CommandApplier *applier) |
3221 | +{ |
3222 | + ReplicationServices &replication_services= ReplicationServices::singleton(); |
3223 | + replication_services.attachApplier(applier); |
3224 | +} |
3225 | + |
3226 | +void slot::CommandApplier::remove(plugin::CommandApplier *applier) |
3227 | +{ |
3228 | + ReplicationServices &replication_services= ReplicationServices::singleton(); |
3229 | + replication_services.detachApplier(applier); |
3230 | +} |
3231 | + |
3232 | |
3233 | === added file 'drizzled/slot/command_applier.h' |
3234 | --- drizzled/slot/command_applier.h 1970-01-01 00:00:00 +0000 |
3235 | +++ drizzled/slot/command_applier.h 2009-09-24 21:11:10 +0000 |
3236 | @@ -0,0 +1,46 @@ |
3237 | +/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
3238 | + * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
3239 | + * |
3240 | + * Copyright (C) 2009 Sun Microsystems |
3241 | + * |
3242 | + * This program is free software; you can redistribute it and/or modify |
3243 | + * it under the terms of the GNU General Public License as published by |
3244 | + * the Free Software Foundation; version 2 of the License. |
3245 | + * |
3246 | + * This program is distributed in the hope that it will be useful, |
3247 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3248 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3249 | + * GNU General Public License for more details. |
3250 | + * |
3251 | + * You should have received a copy of the GNU General Public License |
3252 | + * along with this program; if not, write to the Free Software |
3253 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
3254 | + */ |
3255 | + |
3256 | +#ifndef DRIZZLED_SLOT_COMMAND_APPLIER_H |
3257 | +#define DRIZZLED_SLOT_COMMAND_APPLIER_H |
3258 | + |
3259 | +namespace drizzled |
3260 | +{ |
3261 | +namespace plugin |
3262 | +{ |
3263 | + class CommandApplier; |
3264 | +} |
3265 | + |
3266 | +namespace slot |
3267 | +{ |
3268 | + |
3269 | +class CommandApplier |
3270 | +{ |
3271 | +public: |
3272 | + void add(plugin::CommandApplier *applier); |
3273 | + |
3274 | + void remove(plugin::CommandApplier *applier); |
3275 | + |
3276 | +}; |
3277 | + |
3278 | + |
3279 | +} /* end namespace slot */ |
3280 | +} /* end namespace drizzled */ |
3281 | + |
3282 | +#endif /* DRIZZLED_SLOT_COMMAND_APPLIER_H */ |
3283 | |
3284 | === added file 'drizzled/slot/command_replicator.cc' |
3285 | --- drizzled/slot/command_replicator.cc 1970-01-01 00:00:00 +0000 |
3286 | +++ drizzled/slot/command_replicator.cc 2009-09-24 21:11:10 +0000 |
3287 | @@ -0,0 +1,40 @@ |
3288 | +/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
3289 | + * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
3290 | + * |
3291 | + * Copyright (C) 2009 Sun Microsystems |
3292 | + * |
3293 | + * This program is free software; you can redistribute it and/or modify |
3294 | + * it under the terms of the GNU General Public License as published by |
3295 | + * the Free Software Foundation; version 2 of the License. |
3296 | + * |
3297 | + * This program is distributed in the hope that it will be useful, |
3298 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3299 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3300 | + * GNU General Public License for more details. |
3301 | + * |
3302 | + * You should have received a copy of the GNU General Public License |
3303 | + * along with this program; if not, write to the Free Software |
3304 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
3305 | + */ |
3306 | + |
3307 | +#include "drizzled/global.h" |
3308 | + |
3309 | +#include "drizzled/replication_services.h" |
3310 | +#include "drizzled/slot/command_replicator.h" |
3311 | + |
3312 | +using namespace std; |
3313 | +using namespace drizzled; |
3314 | + |
3315 | +void slot::CommandReplicator::add(plugin::CommandReplicator *replicator) |
3316 | +{ |
3317 | + ReplicationServices &replication_services= ReplicationServices::singleton(); |
3318 | + replication_services.attachReplicator(replicator); |
3319 | +} |
3320 | + |
3321 | +void slot::CommandReplicator::remove(plugin::CommandReplicator *replicator) |
3322 | +{ |
3323 | + ReplicationServices &replication_services= ReplicationServices::singleton(); |
3324 | + replication_services.detachReplicator(replicator); |
3325 | +} |
3326 | + |
3327 | + |
3328 | |
3329 | === added file 'drizzled/slot/command_replicator.h' |
3330 | --- drizzled/slot/command_replicator.h 1970-01-01 00:00:00 +0000 |
3331 | +++ drizzled/slot/command_replicator.h 2009-09-24 21:11:10 +0000 |
3332 | @@ -0,0 +1,47 @@ |
3333 | +/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
3334 | + * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
3335 | + * |
3336 | + * Copyright (C) 2009 Sun Microsystems |
3337 | + * |
3338 | + * This program is free software; you can redistribute it and/or modify |
3339 | + * it under the terms of the GNU General Public License as published by |
3340 | + * the Free Software Foundation; version 2 of the License. |
3341 | + * |
3342 | + * This program is distributed in the hope that it will be useful, |
3343 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3344 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3345 | + * GNU General Public License for more details. |
3346 | + * |
3347 | + * You should have received a copy of the GNU General Public License |
3348 | + * along with this program; if not, write to the Free Software |
3349 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
3350 | + */ |
3351 | + |
3352 | +#ifndef DRIZZLED_SLOT_COMMAND_REPLICATOR_H |
3353 | +#define DRIZZLED_SLOT_COMMAND_REPLICATOR_H |
3354 | + |
3355 | + |
3356 | +namespace drizzled |
3357 | +{ |
3358 | +namespace plugin |
3359 | +{ |
3360 | + class CommandReplicator; |
3361 | +} |
3362 | + |
3363 | +namespace slot |
3364 | +{ |
3365 | + |
3366 | +class CommandReplicator |
3367 | +{ |
3368 | +public: |
3369 | + void add(plugin::CommandReplicator *replicator); |
3370 | + |
3371 | + void remove(plugin::CommandReplicator *replicator); |
3372 | + |
3373 | +}; |
3374 | + |
3375 | + |
3376 | +} /* end namespace slot */ |
3377 | +} /* end namespace drizzled */ |
3378 | + |
3379 | +#endif /* DRIZZLED_SLOT_COMMAND_REPLICATOR_H */ |
3380 | |
3381 | === renamed file 'drizzled/errmsg.cc' => 'drizzled/slot/error_message.cc' |
3382 | --- drizzled/errmsg.cc 2009-08-05 09:29:04 +0000 |
3383 | +++ drizzled/slot/error_message.cc 2009-09-24 21:11:10 +0000 |
3384 | @@ -17,48 +17,54 @@ |
3385 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
3386 | */ |
3387 | |
3388 | -#include <drizzled/server_includes.h> |
3389 | -#include <drizzled/errmsg.h> |
3390 | -#include <drizzled/gettext.h> |
3391 | +#include "drizzled/server_includes.h" |
3392 | +#include "drizzled/slot/error_message.h" |
3393 | +#include "drizzled/plugin/error_message.h" |
3394 | #include "drizzled/plugin/registry.h" |
3395 | |
3396 | +#include "drizzled/gettext.h" |
3397 | + |
3398 | #include <vector> |
3399 | |
3400 | +using namespace drizzled; |
3401 | using namespace std; |
3402 | |
3403 | -static vector<Error_message_handler *> all_errmsg_handler; |
3404 | - |
3405 | -static bool errmsg_has= false; |
3406 | - |
3407 | -void add_errmsg_handler(Error_message_handler *handler) |
3408 | +void slot::ErrorMessage::add(plugin::ErrorMessage *handler) |
3409 | { |
3410 | all_errmsg_handler.push_back(handler); |
3411 | errmsg_has= true; |
3412 | } |
3413 | |
3414 | -void remove_errmsg_handler(Error_message_handler *handler) |
3415 | +void slot::ErrorMessage::remove(plugin::ErrorMessage *handler) |
3416 | { |
3417 | all_errmsg_handler.erase(find(all_errmsg_handler.begin(), |
3418 | all_errmsg_handler.end(), handler)); |
3419 | } |
3420 | |
3421 | |
3422 | -class ErrorMessagePrint : public unary_function<Error_message_handler *, bool> |
3423 | +namespace drizzled |
3424 | +{ |
3425 | +namespace slot |
3426 | +{ |
3427 | +namespace errmsg_priv |
3428 | +{ |
3429 | + |
3430 | +class Print : public unary_function<plugin::ErrorMessage *, bool> |
3431 | { |
3432 | Session *session; |
3433 | int priority; |
3434 | const char *format; |
3435 | va_list ap; |
3436 | public: |
3437 | - ErrorMessagePrint(Session *session_arg, int priority_arg, |
3438 | - const char *format_arg, va_list ap_arg) : |
3439 | - unary_function<Error_message_handler *, bool>(), session(session_arg), |
3440 | - priority(priority_arg), format(format_arg) |
3441 | + Print(Session *session_arg, int priority_arg, |
3442 | + const char *format_arg, va_list ap_arg) |
3443 | + : unary_function<plugin::ErrorMessage *, bool>(), session(session_arg), |
3444 | + priority(priority_arg), format(format_arg) |
3445 | { |
3446 | va_copy(ap, ap_arg); |
3447 | } |
3448 | |
3449 | - ~ErrorMessagePrint() { va_end(ap); } |
3450 | + ~Print() { va_end(ap); } |
3451 | |
3452 | inline result_type operator()(argument_type handler) |
3453 | { |
3454 | @@ -76,10 +82,14 @@ |
3455 | } |
3456 | return false; |
3457 | } |
3458 | -}; |
3459 | - |
3460 | -bool errmsg_vprintf (Session *session, int priority, |
3461 | - char const *format, va_list ap) |
3462 | +}; |
3463 | + |
3464 | +} /* namespace errmsg_priv */ |
3465 | +} /* namespace slot */ |
3466 | +} /* namespace drizzled */ |
3467 | + |
3468 | +bool slot::ErrorMessage::vprintf(Session *session, int priority, |
3469 | + char const *format, va_list ap) |
3470 | { |
3471 | |
3472 | /* check to see if any errmsg plugin has been loaded |
3473 | @@ -95,9 +105,9 @@ |
3474 | } |
3475 | |
3476 | /* Use find_if instead of foreach so that we can collect return codes */ |
3477 | - vector<Error_message_handler *>::iterator iter= |
3478 | + vector<plugin::ErrorMessage *>::iterator iter= |
3479 | find_if(all_errmsg_handler.begin(), all_errmsg_handler.end(), |
3480 | - ErrorMessagePrint(session, priority, format, ap)); |
3481 | + slot::errmsg_priv::Print(session, priority, format, ap)); |
3482 | /* If iter is == end() here, that means that all of the plugins returned |
3483 | * false, which in this case means they all succeeded. Since we want to |
3484 | * return false on success, we return the value of the two being != |
3485 | |
3486 | === renamed file 'drizzled/errmsg.h' => 'drizzled/slot/error_message.h' |
3487 | --- drizzled/errmsg.h 2009-05-11 17:50:22 +0000 |
3488 | +++ drizzled/slot/error_message.h 2009-09-24 21:11:10 +0000 |
3489 | @@ -17,17 +17,40 @@ |
3490 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
3491 | */ |
3492 | |
3493 | -#ifndef DRIZZLED_ERRMSG_H |
3494 | -#define DRIZZLED_ERRMSG_H |
3495 | - |
3496 | -#include <drizzled/plugin/error_message_handler.h> |
3497 | +#ifndef DRIZZLED_SLOT_ERROR_MESSAGE_H |
3498 | +#define DRIZZLED_SLOT_ERROR_MESSAGE_H |
3499 | |
3500 | // need stdarg for va_list |
3501 | #include <stdarg.h> |
3502 | - |
3503 | -void add_errmsg_handler(Error_message_handler *handler); |
3504 | -void remove_errmsg_handler(Error_message_handler *handler); |
3505 | - |
3506 | -bool errmsg_vprintf (Session *session, int priority, char const *format, va_list ap); |
3507 | - |
3508 | -#endif /* DRIZZLED_ERRMSG_H */ |
3509 | +#include <vector> |
3510 | + |
3511 | +namespace drizzled |
3512 | +{ |
3513 | +namespace plugin |
3514 | +{ |
3515 | + class ErrorMessage; |
3516 | +} |
3517 | +namespace slot |
3518 | +{ |
3519 | + |
3520 | +class ErrorMessage |
3521 | +{ |
3522 | +private: |
3523 | + std::vector<plugin::ErrorMessage *> all_errmsg_handler; |
3524 | + |
3525 | + bool errmsg_has; |
3526 | + |
3527 | +public: |
3528 | + ErrorMessage() : all_errmsg_handler(), errmsg_has(false) {} |
3529 | + ~ErrorMessage() {} |
3530 | + |
3531 | + void add(plugin::ErrorMessage *handler); |
3532 | + void remove(plugin::ErrorMessage *handler); |
3533 | + |
3534 | + bool vprintf(Session *session, int priority, char const *format, va_list ap); |
3535 | +}; |
3536 | + |
3537 | +} /* namespace slot */ |
3538 | +} /* namespace drizzled */ |
3539 | + |
3540 | +#endif /* DRIZZLED_SLOT_ERROR_MESSAGE_H */ |
3541 | |
3542 | === added file 'drizzled/slot/info_schema.cc' |
3543 | --- drizzled/slot/info_schema.cc 1970-01-01 00:00:00 +0000 |
3544 | +++ drizzled/slot/info_schema.cc 2009-09-24 21:11:10 +0000 |
3545 | @@ -0,0 +1,150 @@ |
3546 | +/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
3547 | + * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
3548 | + * |
3549 | + * Copyright (C) 2008 Sun Microsystems |
3550 | + * |
3551 | + * This program is free software; you can redistribute it and/or modify |
3552 | + * it under the terms of the GNU General Public License as published by |
3553 | + * the Free Software Foundation; either version 2 of the License, or |
3554 | + * (at your option) any later version. |
3555 | + * |
3556 | + * This program is distributed in the hope that it will be useful, |
3557 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3558 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3559 | + * GNU General Public License for more details. |
3560 | + * |
3561 | + * You should have received a copy of the GNU General Public License |
3562 | + * along with this program; if not, write to the Free Software |
3563 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
3564 | + */ |
3565 | + |
3566 | +#include "drizzled/server_includes.h" |
3567 | +#include "drizzled/slot/info_schema.h" |
3568 | +#include "drizzled/plugin/info_schema_table.h" |
3569 | +#include "drizzled/gettext.h" |
3570 | +#include "drizzled/session.h" |
3571 | +#include "drizzled/lex_string.h" |
3572 | + |
3573 | +#include <vector> |
3574 | + |
3575 | +using namespace std; |
3576 | + |
3577 | +namespace drizzled |
3578 | +{ |
3579 | + |
3580 | +void slot::InfoSchema::add(plugin::InfoSchemaTable *schema_table) |
3581 | +{ |
3582 | + if (schema_table->getFirstColumnIndex() == 0) |
3583 | + schema_table->setFirstColumnIndex(-1); |
3584 | + if (schema_table->getSecondColumnIndex() == 0) |
3585 | + schema_table->setSecondColumnIndex(-1); |
3586 | + |
3587 | + all_schema_tables.push_back(schema_table); |
3588 | +} |
3589 | + |
3590 | +void slot::InfoSchema::remove(plugin::InfoSchemaTable *table) |
3591 | +{ |
3592 | + all_schema_tables.erase(remove_if(all_schema_tables.begin(), |
3593 | + all_schema_tables.end(), |
3594 | + bind2nd(equal_to<plugin::InfoSchemaTable *>(), |
3595 | + table)), |
3596 | + all_schema_tables.end()); |
3597 | +} |
3598 | + |
3599 | + |
3600 | +namespace slot |
3601 | +{ |
3602 | +namespace i_s_priv |
3603 | +{ |
3604 | + |
3605 | +class AddSchemaTable : public unary_function<plugin::InfoSchemaTable *, bool> |
3606 | +{ |
3607 | + Session *session; |
3608 | + const char *wild; |
3609 | + vector<LEX_STRING*> &files; |
3610 | + |
3611 | +public: |
3612 | + AddSchemaTable(Session *session_arg, vector<LEX_STRING*> &files_arg, const char *wild_arg) |
3613 | + : session(session_arg), wild(wild_arg), files(files_arg) |
3614 | + {} |
3615 | + |
3616 | + result_type operator() (argument_type schema_table) |
3617 | + { |
3618 | + if (schema_table->isHidden()) |
3619 | + { |
3620 | + return false; |
3621 | + } |
3622 | + |
3623 | + const string &schema_table_name= schema_table->getTableName(); |
3624 | + |
3625 | + if (wild && wild_case_compare(files_charset_info, schema_table_name.c_str(), wild)) |
3626 | + { |
3627 | + return false; |
3628 | + } |
3629 | + |
3630 | + LEX_STRING *file_name= 0; |
3631 | + file_name= session->make_lex_string(file_name, schema_table_name.c_str(), |
3632 | + schema_table_name.length(), true); |
3633 | + if (file_name == NULL) |
3634 | + { |
3635 | + return true; |
3636 | + } |
3637 | + |
3638 | + files.push_back(file_name); |
3639 | + return false; |
3640 | + } |
3641 | +}; |
3642 | + |
3643 | +class FindSchemaTableByName : public unary_function<plugin::InfoSchemaTable *, bool> |
3644 | +{ |
3645 | + const char *table_name; |
3646 | +public: |
3647 | + FindSchemaTableByName(const char *table_name_arg) |
3648 | + : table_name(table_name_arg) {} |
3649 | + result_type operator() (argument_type schema_table) |
3650 | + { |
3651 | + return ! my_strcasecmp(system_charset_info, |
3652 | + schema_table->getTableName().c_str(), |
3653 | + table_name); |
3654 | + } |
3655 | +}; |
3656 | + |
3657 | +} |
3658 | +} |
3659 | + |
3660 | +plugin::InfoSchemaTable *slot::InfoSchema::getTable(const char *table_name) |
3661 | +{ |
3662 | + vector<plugin::InfoSchemaTable *>::iterator iter= |
3663 | + find_if(all_schema_tables.begin(), |
3664 | + all_schema_tables.end(), |
3665 | + slot::i_s_priv::FindSchemaTableByName(table_name)); |
3666 | + |
3667 | + if (iter != all_schema_tables.end()) |
3668 | + { |
3669 | + return *iter; |
3670 | + } |
3671 | + |
3672 | + return NULL; |
3673 | + |
3674 | +} |
3675 | + |
3676 | + |
3677 | +int slot::InfoSchema::addTableToList(Session *session, |
3678 | + vector<LEX_STRING*> &files, |
3679 | + const char *wild) |
3680 | +{ |
3681 | + |
3682 | + vector<plugin::InfoSchemaTable *>::iterator iter= |
3683 | + find_if(all_schema_tables.begin(), |
3684 | + all_schema_tables.end(), |
3685 | + slot::i_s_priv::AddSchemaTable(session, files, wild)); |
3686 | + |
3687 | + if (iter != all_schema_tables.end()) |
3688 | + { |
3689 | + return 1; |
3690 | + } |
3691 | + |
3692 | + return 0; |
3693 | +} |
3694 | + |
3695 | +} /* namespace drizzled */ |
3696 | |
3697 | === added file 'drizzled/slot/info_schema.h' |
3698 | --- drizzled/slot/info_schema.h 1970-01-01 00:00:00 +0000 |
3699 | +++ drizzled/slot/info_schema.h 2009-09-24 21:11:10 +0000 |
3700 | @@ -0,0 +1,59 @@ |
3701 | +/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
3702 | + * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
3703 | + * |
3704 | + * Copyright (C) 2008 Sun Microsystems |
3705 | + * |
3706 | + * This program is free software; you can redistribute it and/or modify |
3707 | + * it under the terms of the GNU General Public License as published by |
3708 | + * the Free Software Foundation; either version 2 of the License, or |
3709 | + * (at your option) any later version. |
3710 | + * |
3711 | + * This program is distributed in the hope that it will be useful, |
3712 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3713 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3714 | + * GNU General Public License for more details. |
3715 | + * |
3716 | + * You should have received a copy of the GNU General Public License |
3717 | + * along with this program; if not, write to the Free Software |
3718 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
3719 | + */ |
3720 | + |
3721 | + |
3722 | +#ifndef DRIZZLED_SLOT_INFO_SCHEMA_H |
3723 | +#define DRIZZLED_SLOT_INFO_SCHEMA_H |
3724 | + |
3725 | +#include <vector> |
3726 | +#include <functional> |
3727 | + |
3728 | +namespace drizzled |
3729 | +{ |
3730 | +namespace plugin |
3731 | +{ |
3732 | + class InfoSchemaTable; |
3733 | +} |
3734 | + |
3735 | +namespace slot |
3736 | +{ |
3737 | + |
3738 | +class InfoSchema |
3739 | +{ |
3740 | +private: |
3741 | + |
3742 | + std::vector<plugin::InfoSchemaTable *> all_schema_tables; |
3743 | + |
3744 | +public: |
3745 | + InfoSchema() : all_schema_tables() {} |
3746 | + ~InfoSchema() {} |
3747 | + |
3748 | + void add(plugin::InfoSchemaTable *schema_table); |
3749 | + void remove(plugin::InfoSchemaTable *table); |
3750 | + plugin::InfoSchemaTable *getTable(const char *table_name); |
3751 | + int addTableToList(Session *session, std::vector<LEX_STRING*> &files, |
3752 | + const char *wild); |
3753 | + |
3754 | +}; |
3755 | + |
3756 | +} /* namespace slot */ |
3757 | +} /* namespace drizzled */ |
3758 | + |
3759 | +#endif /* DRIZZLED_SLOT_INFO_SCHEMA_H */ |
3760 | |
3761 | === renamed file 'drizzled/logging.cc' => 'drizzled/slot/logging.cc' |
3762 | --- drizzled/logging.cc 2009-08-05 09:29:04 +0000 |
3763 | +++ drizzled/slot/logging.cc 2009-09-24 21:11:10 +0000 |
3764 | @@ -18,35 +18,41 @@ |
3765 | */ |
3766 | |
3767 | #include <drizzled/server_includes.h> |
3768 | -#include <drizzled/logging.h> |
3769 | +#include <drizzled/slot/logging.h> |
3770 | #include <drizzled/gettext.h> |
3771 | #include "drizzled/plugin/registry.h" |
3772 | |
3773 | #include <vector> |
3774 | |
3775 | +using namespace drizzled; |
3776 | using namespace std; |
3777 | |
3778 | -static vector<Logging_handler *> all_loggers; |
3779 | - |
3780 | -void add_logger(Logging_handler *handler) |
3781 | +void slot::Logging::add(plugin::Logging *handler) |
3782 | { |
3783 | if (handler != NULL) |
3784 | all_loggers.push_back(handler); |
3785 | } |
3786 | |
3787 | -void remove_logger(Logging_handler *handler) |
3788 | +void slot::Logging::remove(plugin::Logging *handler) |
3789 | { |
3790 | if (handler != NULL) |
3791 | all_loggers.erase(find(all_loggers.begin(), all_loggers.end(), handler)); |
3792 | } |
3793 | |
3794 | |
3795 | -class LoggingPreIterate : public unary_function<Logging_handler *, bool> |
3796 | +namespace drizzled |
3797 | +{ |
3798 | +namespace slot |
3799 | +{ |
3800 | +namespace logging_priv |
3801 | +{ |
3802 | + |
3803 | +class PreIterate : public unary_function<plugin::Logging *, bool> |
3804 | { |
3805 | Session *session; |
3806 | public: |
3807 | - LoggingPreIterate(Session *session_arg) : |
3808 | - unary_function<Logging_handler *, bool>(), |
3809 | + PreIterate(Session *session_arg) : |
3810 | + unary_function<plugin::Logging *, bool>(), |
3811 | session(session_arg) {} |
3812 | |
3813 | inline result_type operator()(argument_type handler) |
3814 | @@ -65,12 +71,12 @@ |
3815 | }; |
3816 | |
3817 | |
3818 | -class LoggingPostIterate : public unary_function<Logging_handler *, bool> |
3819 | +class PostIterate : public unary_function<plugin::Logging *, bool> |
3820 | { |
3821 | Session *session; |
3822 | public: |
3823 | - LoggingPostIterate(Session *session_arg) : |
3824 | - unary_function<Logging_handler *, bool>(), |
3825 | + PostIterate(Session *session_arg) : |
3826 | + unary_function<plugin::Logging *, bool>(), |
3827 | session(session_arg) {} |
3828 | |
3829 | /* This gets called once for each loaded logging plugin */ |
3830 | @@ -89,15 +95,19 @@ |
3831 | } |
3832 | }; |
3833 | |
3834 | +} /* namespace logging_priv */ |
3835 | +} /* namespace slot */ |
3836 | +} /* namespace drizzled */ |
3837 | + |
3838 | |
3839 | /* This is the logging_pre_do entry point. |
3840 | This gets called by the rest of the Drizzle server code */ |
3841 | -bool logging_pre_do (Session *session) |
3842 | +bool slot::Logging::pre_do(Session *session) |
3843 | { |
3844 | /* Use find_if instead of foreach so that we can collect return codes */ |
3845 | - vector<Logging_handler *>::iterator iter= |
3846 | + vector<plugin::Logging *>::iterator iter= |
3847 | find_if(all_loggers.begin(), all_loggers.end(), |
3848 | - LoggingPreIterate(session)); |
3849 | + slot::logging_priv::PreIterate(session)); |
3850 | /* If iter is == end() here, that means that all of the plugins returned |
3851 | * false, which in this case means they all succeeded. Since we want to |
3852 | * return false on success, we return the value of the two being != |
3853 | @@ -107,12 +117,12 @@ |
3854 | |
3855 | /* This is the logging_post_do entry point. |
3856 | This gets called by the rest of the Drizzle server code */ |
3857 | -bool logging_post_do (Session *session) |
3858 | +bool slot::Logging::post_do(Session *session) |
3859 | { |
3860 | /* Use find_if instead of foreach so that we can collect return codes */ |
3861 | - vector<Logging_handler *>::iterator iter= |
3862 | + vector<plugin::Logging *>::iterator iter= |
3863 | find_if(all_loggers.begin(), all_loggers.end(), |
3864 | - LoggingPostIterate(session)); |
3865 | + slot::logging_priv::PostIterate(session)); |
3866 | /* If iter is == end() here, that means that all of the plugins returned |
3867 | * false, which in this case means they all succeeded. Since we want to |
3868 | * return false on success, we return the value of the two being != |
3869 | |
3870 | === renamed file 'drizzled/logging.h' => 'drizzled/slot/logging.h' |
3871 | --- drizzled/logging.h 2009-05-11 17:50:22 +0000 |
3872 | +++ drizzled/slot/logging.h 2009-09-24 21:11:10 +0000 |
3873 | @@ -17,18 +17,38 @@ |
3874 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
3875 | */ |
3876 | |
3877 | -#ifndef DRIZZLED_LOGGING_H |
3878 | -#define DRIZZLED_LOGGING_H |
3879 | - |
3880 | -#include <drizzled/plugin/logging_handler.h> |
3881 | +#ifndef DRIZZLED_SLOT_LOGGING_H |
3882 | +#define DRIZZLED_SLOT_LOGGING_H |
3883 | + |
3884 | +#include <drizzled/plugin/logging.h> |
3885 | + |
3886 | +#include <vector> |
3887 | + |
3888 | +namespace drizzled |
3889 | +{ |
3890 | +namespace slot |
3891 | +{ |
3892 | |
3893 | /* there are no parameters other than the session because logging can |
3894 | * pull everything it needs out of the session. If need to add |
3895 | * parameters, look at how errmsg.h and errmsg.cc do it. */ |
3896 | |
3897 | -bool logging_pre_do (Session *session); |
3898 | -bool logging_post_do (Session *session); |
3899 | -void add_logger(Logging_handler *handler); |
3900 | -void remove_logger(Logging_handler *handler); |
3901 | - |
3902 | -#endif /* DRIZZLED_LOGGING_H */ |
3903 | +class Logging |
3904 | +{ |
3905 | +private: |
3906 | + std::vector<plugin::Logging *> all_loggers; |
3907 | + |
3908 | +public: |
3909 | + Logging() : all_loggers() {} |
3910 | + ~Logging() {} |
3911 | + |
3912 | + void add(plugin::Logging *handler); |
3913 | + void remove(plugin::Logging *handler); |
3914 | + bool pre_do(Session *session); |
3915 | + bool post_do(Session *session); |
3916 | +}; |
3917 | + |
3918 | +} /* namespace slot */ |
3919 | +} /* namespace drizzled */ |
3920 | + |
3921 | +#endif /* DRIZZLED_SLOT_LOGGING_H */ |
3922 | |
3923 | === renamed file 'drizzled/qcache.cc' => 'drizzled/slot/query_cache.cc' |
3924 | --- drizzled/qcache.cc 2009-08-05 09:29:04 +0000 |
3925 | +++ drizzled/slot/query_cache.cc 2009-09-24 21:11:10 +0000 |
3926 | @@ -17,42 +17,40 @@ |
3927 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
3928 | */ |
3929 | |
3930 | -#include <drizzled/server_includes.h> |
3931 | -#include <drizzled/qcache.h> |
3932 | -#include <drizzled/gettext.h> |
3933 | +#include "drizzled/server_includes.h" |
3934 | +#include "drizzled/slot/query_cache.h" |
3935 | +#include "drizzled/plugin/query_cache.h" |
3936 | #include "drizzled/plugin/registry.h" |
3937 | + |
3938 | +#include "drizzled/gettext.h" |
3939 | + |
3940 | #include <vector> |
3941 | |
3942 | +using namespace drizzled; |
3943 | using namespace std; |
3944 | |
3945 | -static vector<QueryCache *> all_query_cache; |
3946 | - |
3947 | -void add_query_cache(QueryCache *handler) |
3948 | -{ |
3949 | - all_query_cache.push_back(handler); |
3950 | -} |
3951 | - |
3952 | -void remove_query_cache(QueryCache *handler) |
3953 | -{ |
3954 | - all_query_cache.erase(find(all_query_cache.begin(), all_query_cache.end(), |
3955 | - handler)); |
3956 | -} |
3957 | - |
3958 | - |
3959 | +namespace plugin |
3960 | +{ |
3961 | + class QueryCache; |
3962 | +} |
3963 | + |
3964 | +namespace drizzled |
3965 | +{ |
3966 | +namespace slot |
3967 | +{ |
3968 | +namespace query_cache_priv |
3969 | +{ |
3970 | |
3971 | /* Namespaces are here to prevent global symbol clashes with these classes */ |
3972 | |
3973 | -namespace drizzled { |
3974 | -namespace query_cache { |
3975 | - |
3976 | class TryFetchAndSendIterate |
3977 | - : public unary_function<QueryCache *, bool> |
3978 | + : public unary_function<plugin::QueryCache *, bool> |
3979 | { |
3980 | Session *session; |
3981 | bool is_transactional; |
3982 | public: |
3983 | TryFetchAndSendIterate(Session *session_arg, bool is_transactional_arg) : |
3984 | - unary_function<QueryCache *, bool>(), |
3985 | + unary_function<plugin::QueryCache *, bool>(), |
3986 | session(session_arg), is_transactional(is_transactional_arg) { } |
3987 | |
3988 | inline result_type operator()(argument_type handler) |
3989 | @@ -69,13 +67,13 @@ |
3990 | }; |
3991 | |
3992 | class SetIterate |
3993 | - : public unary_function<QueryCache *, bool> |
3994 | + : public unary_function<plugin::QueryCache *, bool> |
3995 | { |
3996 | Session *session; |
3997 | bool is_transactional; |
3998 | public: |
3999 | SetIterate(Session *session_arg, bool is_transactional_arg) : |
4000 | - unary_function<QueryCache *, bool>(), |
4001 | + unary_function<plugin::QueryCache *, bool>(), |
4002 | session(session_arg), is_transactional(is_transactional_arg) { } |
4003 | |
4004 | inline result_type operator()(argument_type handler) |
4005 | @@ -92,13 +90,13 @@ |
4006 | }; |
4007 | |
4008 | class InvalidateTableIterate |
4009 | - : public unary_function<QueryCache *, bool> |
4010 | + : public unary_function<plugin::QueryCache *, bool> |
4011 | { |
4012 | Session *session; |
4013 | bool is_transactional; |
4014 | public: |
4015 | InvalidateTableIterate(Session *session_arg, bool is_transactional_arg) : |
4016 | - unary_function<QueryCache *, bool>(), |
4017 | + unary_function<plugin::QueryCache *, bool>(), |
4018 | session(session_arg), is_transactional(is_transactional_arg) { } |
4019 | |
4020 | inline result_type operator()(argument_type handler) |
4021 | @@ -117,7 +115,7 @@ |
4022 | |
4023 | |
4024 | class InvalidateDbIterate |
4025 | - : public unary_function<QueryCache *, bool> |
4026 | + : public unary_function<plugin::QueryCache *, bool> |
4027 | { |
4028 | Session *session; |
4029 | const char *dbname; |
4030 | @@ -125,7 +123,7 @@ |
4031 | public: |
4032 | InvalidateDbIterate(Session *session_arg, const char *dbname_arg, |
4033 | bool is_transactional_arg) : |
4034 | - unary_function<QueryCache *, bool>(), |
4035 | + unary_function<plugin::QueryCache *, bool>(), |
4036 | session(session_arg), dbname(dbname_arg), |
4037 | is_transactional(is_transactional_arg) { } |
4038 | |
4039 | @@ -143,12 +141,12 @@ |
4040 | }; |
4041 | |
4042 | class FlushIterate |
4043 | - : public unary_function<QueryCache *, bool> |
4044 | + : public unary_function<plugin::QueryCache *, bool> |
4045 | { |
4046 | Session *session; |
4047 | public: |
4048 | FlushIterate(Session *session_arg) : |
4049 | - unary_function<QueryCache *, bool>(), session(session_arg) { } |
4050 | + unary_function<plugin::QueryCache *, bool>(), session(session_arg) { } |
4051 | |
4052 | inline result_type operator()(argument_type handler) |
4053 | { |
4054 | @@ -162,6 +160,22 @@ |
4055 | } |
4056 | }; |
4057 | |
4058 | +} /* namespace query_cache_priv */ |
4059 | +} /* namespace slot */ |
4060 | +} /* namespace drizzled */ |
4061 | + |
4062 | +void slot::QueryCache::add(plugin::QueryCache *handler) |
4063 | +{ |
4064 | + all_query_cache.push_back(handler); |
4065 | +} |
4066 | + |
4067 | +void slot::QueryCache::remove(plugin::QueryCache *handler) |
4068 | +{ |
4069 | + all_query_cache.erase(find(all_query_cache.begin(), all_query_cache.end(), |
4070 | + handler)); |
4071 | +} |
4072 | + |
4073 | + |
4074 | /* |
4075 | Following functions: |
4076 | |
4077 | @@ -175,72 +189,73 @@ |
4078 | rest of the Drizzle server code. |
4079 | */ |
4080 | |
4081 | -bool try_fetch_and_send(Session *session, bool transactional) |
4082 | -{ |
4083 | - /* Use find_if instead of foreach so that we can collect return codes */ |
4084 | - vector<QueryCache *>::iterator iter= |
4085 | - find_if(all_query_cache.begin(), all_query_cache.end(), |
4086 | - TryFetchAndSendIterate(session, transactional)); |
4087 | - /* If iter is == end() here, that means that all of the plugins returned |
4088 | - * false, which in this case means they all succeeded. Since we want to |
4089 | - * return false on success, we return the value of the two being != |
4090 | - */ |
4091 | - return iter != all_query_cache.end(); |
4092 | -} |
4093 | - |
4094 | -bool set(Session *session, bool transactional) |
4095 | -{ |
4096 | - /* Use find_if instead of foreach so that we can collect return codes */ |
4097 | - vector<QueryCache *>::iterator iter= |
4098 | - find_if(all_query_cache.begin(), all_query_cache.end(), |
4099 | - SetIterate(session, transactional)); |
4100 | - /* If iter is == end() here, that means that all of the plugins returned |
4101 | - * false, which in this case means they all succeeded. Since we want to |
4102 | - * return false on success, we return the value of the two being != |
4103 | - */ |
4104 | - return iter != all_query_cache.end(); |
4105 | -} |
4106 | - |
4107 | -bool invalidate_table(Session *session, bool transactional) |
4108 | -{ |
4109 | - /* Use find_if instead of foreach so that we can collect return codes */ |
4110 | - vector<QueryCache *>::iterator iter= |
4111 | - find_if(all_query_cache.begin(), all_query_cache.end(), |
4112 | - InvalidateTableIterate(session, transactional)); |
4113 | - /* If iter is == end() here, that means that all of the plugins returned |
4114 | - * false, which in this case means they all succeeded. Since we want to |
4115 | - * return false on success, we return the value of the two being != |
4116 | - */ |
4117 | - return iter != all_query_cache.end(); |
4118 | -} |
4119 | - |
4120 | -bool invalidate_db(Session *session, const char *dbname, |
4121 | - bool transactional) |
4122 | -{ |
4123 | - /* Use find_if instead of foreach so that we can collect return codes */ |
4124 | - vector<QueryCache *>::iterator iter= |
4125 | - find_if(all_query_cache.begin(), all_query_cache.end(), |
4126 | - InvalidateDbIterate(session, dbname, transactional)); |
4127 | - /* If iter is == end() here, that means that all of the plugins returned |
4128 | - * false, which in this case means they all succeeded. Since we want to |
4129 | - * return false on success, we return the value of the two being != |
4130 | - */ |
4131 | - return iter != all_query_cache.end(); |
4132 | -} |
4133 | - |
4134 | -bool flush(Session *session) |
4135 | -{ |
4136 | - /* Use find_if instead of foreach so that we can collect return codes */ |
4137 | - vector<QueryCache *>::iterator iter= |
4138 | - find_if(all_query_cache.begin(), all_query_cache.end(), |
4139 | - FlushIterate(session)); |
4140 | - /* If iter is == end() here, that means that all of the plugins returned |
4141 | - * false, which in this case means they all succeeded. Since we want to |
4142 | - * return false on success, we return the value of the two being != |
4143 | - */ |
4144 | - return iter != all_query_cache.end(); |
4145 | -} |
4146 | - |
4147 | -} /* namespace query_cache */ |
4148 | -} /* namespace drizzled */ |
4149 | +bool slot::QueryCache::try_fetch_and_send(Session *session, bool transactional) |
4150 | +{ |
4151 | + /* Use find_if instead of foreach so that we can collect return codes */ |
4152 | + vector<plugin::QueryCache *>::iterator iter= |
4153 | + find_if(all_query_cache.begin(), all_query_cache.end(), |
4154 | + slot::query_cache_priv::TryFetchAndSendIterate(session, |
4155 | + transactional)); |
4156 | + /* If iter is == end() here, that means that all of the plugins returned |
4157 | + * false, which in this case means they all succeeded. Since we want to |
4158 | + * return false on success, we return the value of the two being != |
4159 | + */ |
4160 | + return iter != all_query_cache.end(); |
4161 | +} |
4162 | + |
4163 | +bool slot::QueryCache::set(Session *session, bool transactional) |
4164 | +{ |
4165 | + /* Use find_if instead of foreach so that we can collect return codes */ |
4166 | + vector<plugin::QueryCache *>::iterator iter= |
4167 | + find_if(all_query_cache.begin(), all_query_cache.end(), |
4168 | + slot::query_cache_priv::SetIterate(session, transactional)); |
4169 | + /* If iter is == end() here, that means that all of the plugins returned |
4170 | + * false, which in this case means they all succeeded. Since we want to |
4171 | + * return false on success, we return the value of the two being != |
4172 | + */ |
4173 | + return iter != all_query_cache.end(); |
4174 | +} |
4175 | + |
4176 | +bool slot::QueryCache::invalidate_table(Session *session, bool transactional) |
4177 | +{ |
4178 | + /* Use find_if instead of foreach so that we can collect return codes */ |
4179 | + vector<plugin::QueryCache *>::iterator iter= |
4180 | + find_if(all_query_cache.begin(), all_query_cache.end(), |
4181 | + slot::query_cache_priv::InvalidateTableIterate(session, |
4182 | + transactional)); |
4183 | + /* If iter is == end() here, that means that all of the plugins returned |
4184 | + * false, which in this case means they all succeeded. Since we want to |
4185 | + * return false on success, we return the value of the two being != |
4186 | + */ |
4187 | + return iter != all_query_cache.end(); |
4188 | +} |
4189 | + |
4190 | +bool slot::QueryCache::invalidate_db(Session *session, const char *dbname, |
4191 | + bool transactional) |
4192 | +{ |
4193 | + /* Use find_if instead of foreach so that we can collect return codes */ |
4194 | + vector<plugin::QueryCache *>::iterator iter= |
4195 | + find_if(all_query_cache.begin(), all_query_cache.end(), |
4196 | + slot::query_cache_priv::InvalidateDbIterate(session, |
4197 | + dbname, |
4198 | + transactional)); |
4199 | + /* If iter is == end() here, that means that all of the plugins returned |
4200 | + * false, which in this case means they all succeeded. Since we want to |
4201 | + * return false on success, we return the value of the two being != |
4202 | + */ |
4203 | + return iter != all_query_cache.end(); |
4204 | +} |
4205 | + |
4206 | +bool slot::QueryCache::flush(Session *session) |
4207 | +{ |
4208 | + /* Use find_if instead of foreach so that we can collect return codes */ |
4209 | + vector<plugin::QueryCache *>::iterator iter= |
4210 | + find_if(all_query_cache.begin(), all_query_cache.end(), |
4211 | + slot::query_cache_priv::FlushIterate(session)); |
4212 | + /* If iter is == end() here, that means that all of the plugins returned |
4213 | + * false, which in this case means they all succeeded. Since we want to |
4214 | + * return false on success, we return the value of the two being != |
4215 | + */ |
4216 | + return iter != all_query_cache.end(); |
4217 | +} |
4218 | |
4219 | |
4220 | === renamed file 'drizzled/qcache.h' => 'drizzled/slot/query_cache.h' |
4221 | --- drizzled/qcache.h 2009-07-07 09:06:29 +0000 |
4222 | +++ drizzled/slot/query_cache.h 2009-09-24 21:11:10 +0000 |
4223 | @@ -17,24 +17,44 @@ |
4224 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
4225 | */ |
4226 | |
4227 | -#ifndef DRIZZLED_QCACHE_H |
4228 | -#define DRIZZLED_QCACHE_H |
4229 | - |
4230 | -#include <drizzled/plugin/qcache.h> |
4231 | - |
4232 | -void add_query_cache(QueryCache *handler); |
4233 | -void remove_query_cache(QueryCache *handler); |
4234 | - |
4235 | -namespace drizzled { |
4236 | -namespace query_cache { |
4237 | -/* These are the functions called by the rest of the Drizzle server */ |
4238 | -bool try_fetch_and_send(Session *session, bool transactional); |
4239 | -bool set(Session *session, bool transactional); |
4240 | -bool invalidate_table(Session *session, bool transactional); |
4241 | -bool invalidate_db(Session *session, const char *db_name, |
4242 | - bool transactional); |
4243 | -bool flush(Session *session); |
4244 | -} |
4245 | -} |
4246 | - |
4247 | -#endif /* DRIZZLED_QCACHE_H */ |
4248 | +#ifndef DRIZZLED_SLOT_QUERY_CACHE_H |
4249 | +#define DRIZZLED_SLOT_QUERY_CACHE_H |
4250 | + |
4251 | +#include <vector> |
4252 | + |
4253 | +namespace drizzled |
4254 | +{ |
4255 | + |
4256 | +namespace plugin |
4257 | +{ |
4258 | + class QueryCache; |
4259 | +} |
4260 | + |
4261 | +namespace slot |
4262 | +{ |
4263 | + |
4264 | +class QueryCache |
4265 | +{ |
4266 | +private: |
4267 | + std::vector<plugin::QueryCache *> all_query_cache; |
4268 | + |
4269 | +public: |
4270 | + QueryCache() : all_query_cache() {} |
4271 | + ~QueryCache() {} |
4272 | + |
4273 | + void add(plugin::QueryCache *handler); |
4274 | + void remove(plugin::QueryCache *handler); |
4275 | + |
4276 | + /* These are the functions called by the rest of the Drizzle server */ |
4277 | + bool try_fetch_and_send(Session *session, bool transactional); |
4278 | + bool set(Session *session, bool transactional); |
4279 | + bool invalidate_table(Session *session, bool transactional); |
4280 | + bool invalidate_db(Session *session, const char *db_name, |
4281 | + bool transactional); |
4282 | + bool flush(Session *session); |
4283 | +}; /* class QueryCache */ |
4284 | + |
4285 | +} /* namespace slot */ |
4286 | +} /* namespace drizzled */ |
4287 | + |
4288 | +#endif /* DRIZZLED_SLOT_QUERY_CACHE_H */ |
4289 | |
4290 | === renamed file 'drizzled/scheduling.cc' => 'drizzled/slot/scheduler.cc' |
4291 | --- drizzled/scheduling.cc 2009-08-05 09:29:04 +0000 |
4292 | +++ drizzled/slot/scheduler.cc 2009-09-24 21:11:10 +0000 |
4293 | @@ -17,19 +17,20 @@ |
4294 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
4295 | */ |
4296 | |
4297 | -#include <drizzled/server_includes.h> |
4298 | -#include <drizzled/scheduling.h> |
4299 | -#include <drizzled/gettext.h> |
4300 | +#include "drizzled/server_includes.h" |
4301 | +#include "drizzled/slot/scheduler.h" |
4302 | +#include "drizzled/plugin/scheduler.h" |
4303 | #include "drizzled/plugin/registry.h" |
4304 | -#include "drizzled/registry.h" |
4305 | - |
4306 | + |
4307 | +#include "drizzled/gettext.h" |
4308 | + |
4309 | +using namespace drizzled; |
4310 | using namespace std; |
4311 | -using namespace drizzled; |
4312 | - |
4313 | -plugin::SchedulerFactory *scheduler_factory= NULL; |
4314 | -Registry<plugin::SchedulerFactory *> all_schedulers; |
4315 | - |
4316 | -bool add_scheduler_factory(plugin::SchedulerFactory *factory) |
4317 | + |
4318 | +slot::Scheduler::Scheduler() : scheduler_factory(NULL), all_schedulers() {} |
4319 | +slot::Scheduler::~Scheduler() {} |
4320 | + |
4321 | +void slot::Scheduler::add(plugin::SchedulerFactory *factory) |
4322 | { |
4323 | if (all_schedulers.count(factory->getName()) != 0) |
4324 | { |
4325 | @@ -37,22 +38,20 @@ |
4326 | _("Attempted to register a scheduler %s, but a scheduler " |
4327 | "has already been registered with that name.\n"), |
4328 | factory->getName().c_str()); |
4329 | - return true; |
4330 | + return; |
4331 | } |
4332 | all_schedulers.add(factory); |
4333 | - return false; |
4334 | } |
4335 | |
4336 | |
4337 | -bool remove_scheduler_factory(plugin::SchedulerFactory *factory) |
4338 | +void slot::Scheduler::remove(plugin::SchedulerFactory *factory) |
4339 | { |
4340 | scheduler_factory= NULL; |
4341 | all_schedulers.remove(factory); |
4342 | - return false; |
4343 | } |
4344 | |
4345 | |
4346 | -bool set_scheduler_factory(const string& name) |
4347 | +bool slot::Scheduler::setFactory(const string& name) |
4348 | { |
4349 | |
4350 | plugin::SchedulerFactory *factory= all_schedulers.find(name); |
4351 | @@ -68,7 +67,7 @@ |
4352 | return false; |
4353 | } |
4354 | |
4355 | -plugin::Scheduler *get_thread_scheduler() |
4356 | +plugin::Scheduler *slot::Scheduler::getScheduler() |
4357 | { |
4358 | assert(scheduler_factory != NULL); |
4359 | plugin::Scheduler *sched= (*scheduler_factory)(); |
4360 | @@ -79,4 +78,3 @@ |
4361 | } |
4362 | return sched; |
4363 | } |
4364 | - |
4365 | |
4366 | === renamed file 'drizzled/scheduling.h' => 'drizzled/slot/scheduler.h' |
4367 | --- drizzled/scheduling.h 2009-08-04 22:16:30 +0000 |
4368 | +++ drizzled/slot/scheduler.h 2009-09-24 21:11:10 +0000 |
4369 | @@ -17,16 +17,46 @@ |
4370 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
4371 | */ |
4372 | |
4373 | -#ifndef DRIZZLED_SCHEDULING_H |
4374 | -#define DRIZZLED_SCHEDULING_H |
4375 | - |
4376 | -#include <drizzled/plugin/scheduler.h> |
4377 | - |
4378 | -#include <string> |
4379 | - |
4380 | -drizzled::plugin::Scheduler *get_thread_scheduler(); |
4381 | -bool add_scheduler_factory(drizzled::plugin::SchedulerFactory *scheduler); |
4382 | -bool remove_scheduler_factory(drizzled::plugin::SchedulerFactory *scheduler); |
4383 | -bool set_scheduler_factory(const std::string& name); |
4384 | - |
4385 | -#endif /* DRIZZLED_SCHEDULING_H */ |
4386 | +#ifndef DRIZZLED_SLOT_SCHEDULER_H |
4387 | +#define DRIZZLED_SLOT_SCHEDULER_H |
4388 | + |
4389 | +#include <drizzled/registry.h> |
4390 | + |
4391 | +namespace drizzled |
4392 | +{ |
4393 | + |
4394 | +namespace plugin |
4395 | +{ |
4396 | + class SchedulerFactory; |
4397 | + class Scheduler; |
4398 | +} |
4399 | + |
4400 | +namespace slot |
4401 | +{ |
4402 | + |
4403 | +/** |
4404 | + * Class to handle all Scheduler objects |
4405 | + */ |
4406 | +class Scheduler |
4407 | +{ |
4408 | +private: |
4409 | + |
4410 | + plugin::SchedulerFactory *scheduler_factory; |
4411 | + Registry<plugin::SchedulerFactory *> all_schedulers; |
4412 | + |
4413 | +public: |
4414 | + |
4415 | + Scheduler(); |
4416 | + ~Scheduler(); |
4417 | + |
4418 | + void add(plugin::SchedulerFactory *factory); |
4419 | + void remove(plugin::SchedulerFactory *factory); |
4420 | + bool setFactory(const std::string& name); |
4421 | + plugin::Scheduler *getScheduler(); |
4422 | + |
4423 | +}; |
4424 | + |
4425 | +} /* namespace slot */ |
4426 | +} /* namespace drizzled */ |
4427 | + |
4428 | +#endif /* DRIZZLED_SLOT_SCHEDULER_H */ |
4429 | |
4430 | === added file 'drizzled/slot/storage_engine.cc' |
4431 | --- drizzled/slot/storage_engine.cc 1970-01-01 00:00:00 +0000 |
4432 | +++ drizzled/slot/storage_engine.cc 2009-09-24 21:11:10 +0000 |
4433 | @@ -0,0 +1,772 @@ |
4434 | +/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
4435 | + * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
4436 | + * |
4437 | + * Copyright (C) 2009 Sun Microsystems |
4438 | + * |
4439 | + * This program is free software; you can redistribute it and/or modify |
4440 | + * it under the terms of the GNU General Public License as published by |
4441 | + * the Free Software Foundation; version 2 of the License. |
4442 | + * |
4443 | + * This program is distributed in the hope that it will be useful, |
4444 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4445 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4446 | + * GNU General Public License for more details. |
4447 | + * |
4448 | + * You should have received a copy of the GNU General Public License |
4449 | + * along with this program; if not, write to the Free Software |
4450 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
4451 | + */ |
4452 | + |
4453 | +#include "drizzled/global.h" |
4454 | + |
4455 | +#include <vector> |
4456 | +#include <algorithm> |
4457 | +#include <functional> |
4458 | + |
4459 | +#include <google/protobuf/io/zero_copy_stream.h> |
4460 | +#include <google/protobuf/io/zero_copy_stream_impl.h> |
4461 | + |
4462 | +#include "mysys/my_dir.h" |
4463 | +#include "mysys/hash.h" |
4464 | + |
4465 | +#include "drizzled/slot/storage_engine.h" |
4466 | +#include "drizzled/plugin/storage_engine.h" |
4467 | +#include "drizzled/gettext.h" |
4468 | +#include "drizzled/xid.h" |
4469 | +#include "drizzled/errmsg_print.h" |
4470 | +#include "drizzled/plugin/registry.h" |
4471 | +#include "drizzled/session.h" |
4472 | + |
4473 | +namespace drizzled |
4474 | +{ |
4475 | +namespace slot |
4476 | +{ |
4477 | + |
4478 | +StorageEngine::StorageEngine() : all_engines() {} |
4479 | +StorageEngine::~StorageEngine() {} |
4480 | + |
4481 | +void StorageEngine::add(plugin::StorageEngine *engine) |
4482 | +{ |
4483 | + all_engines.add(engine); |
4484 | +} |
4485 | + |
4486 | +void StorageEngine::remove(plugin::StorageEngine *engine) |
4487 | +{ |
4488 | + all_engines.remove(engine); |
4489 | +} |
4490 | + |
4491 | +plugin::StorageEngine *StorageEngine::findByName(Session *session, |
4492 | + std::string find_str) |
4493 | +{ |
4494 | + |
4495 | + transform(find_str.begin(), find_str.end(), |
4496 | + find_str.begin(), ::tolower); |
4497 | + string default_str("default"); |
4498 | + if (find_str == default_str) |
4499 | + return ha_default_storage_engine(session); |
4500 | + |
4501 | + plugin::StorageEngine *engine= all_engines.find(find_str); |
4502 | + |
4503 | + if (engine && engine->is_user_selectable()) |
4504 | + return engine; |
4505 | + |
4506 | + return NULL; |
4507 | +} |
4508 | + |
4509 | +class StorageEngineCloseConnection |
4510 | + : public unary_function<plugin::StorageEngine *, void> |
4511 | +{ |
4512 | + Session *session; |
4513 | +public: |
4514 | + StorageEngineCloseConnection(Session *session_arg) : session(session_arg) {} |
4515 | + /* |
4516 | + there's no need to rollback here as all transactions must |
4517 | + be rolled back already |
4518 | + */ |
4519 | + inline result_type operator() (argument_type engine) |
4520 | + { |
4521 | + if (engine->is_enabled() && |
4522 | + session_get_ha_data(session, engine)) |
4523 | + engine->close_connection(session); |
4524 | + } |
4525 | +}; |
4526 | + |
4527 | +/** |
4528 | + @note |
4529 | + don't bother to rollback here, it's done already |
4530 | +*/ |
4531 | +void StorageEngine::closeConnection(Session* session) |
4532 | +{ |
4533 | + for_each(all_engines.begin(), all_engines.end(), |
4534 | + StorageEngineCloseConnection(session)); |
4535 | +} |
4536 | + |
4537 | +void StorageEngine::dropDatabase(char* path) |
4538 | +{ |
4539 | + for_each(all_engines.begin(), all_engines.end(), |
4540 | + bind2nd(mem_fun(&plugin::StorageEngine::drop_database),path)); |
4541 | +} |
4542 | + |
4543 | +int StorageEngine::commitOrRollbackByXID(XID *xid, bool commit) |
4544 | +{ |
4545 | + vector<int> results; |
4546 | + |
4547 | + if (commit) |
4548 | + transform(all_engines.begin(), all_engines.end(), results.begin(), |
4549 | + bind2nd(mem_fun(&plugin::StorageEngine::commit_by_xid),xid)); |
4550 | + else |
4551 | + transform(all_engines.begin(), all_engines.end(), results.begin(), |
4552 | + bind2nd(mem_fun(&plugin::StorageEngine::rollback_by_xid),xid)); |
4553 | + |
4554 | + if (find_if(results.begin(), results.end(), bind2nd(equal_to<int>(),0)) |
4555 | + == results.end()) |
4556 | + return 1; |
4557 | + return 0; |
4558 | +} |
4559 | + |
4560 | +/** |
4561 | + @details |
4562 | + This function should be called when MySQL sends rows of a SELECT result set |
4563 | + or the EOF mark to the client. It releases a possible adaptive hash index |
4564 | + S-latch held by session in InnoDB and also releases a possible InnoDB query |
4565 | + FIFO ticket to enter InnoDB. To save CPU time, InnoDB allows a session to |
4566 | + keep them over several calls of the InnoDB handler interface when a join |
4567 | + is executed. But when we let the control to pass to the client they have |
4568 | + to be released because if the application program uses mysql_use_result(), |
4569 | + it may deadlock on the S-latch if the application on another connection |
4570 | + performs another SQL query. In MySQL-4.1 this is even more important because |
4571 | + there a connection can have several SELECT queries open at the same time. |
4572 | + |
4573 | + @param session the thread handle of the current connection |
4574 | + |
4575 | + @return |
4576 | + always 0 |
4577 | +*/ |
4578 | +int StorageEngine::releaseTemporaryLatches(Session *session) |
4579 | +{ |
4580 | + for_each(all_engines.begin(), all_engines.end(), |
4581 | + bind2nd(mem_fun(&plugin::StorageEngine::release_temporary_latches),session)); |
4582 | + return 0; |
4583 | +} |
4584 | + |
4585 | +bool StorageEngine::flushLogs(plugin::StorageEngine *engine) |
4586 | +{ |
4587 | + if (engine == NULL) |
4588 | + { |
4589 | + if (find_if(all_engines.begin(), all_engines.end(), |
4590 | + mem_fun(&plugin::StorageEngine::flush_logs)) |
4591 | + != all_engines.begin()) |
4592 | + return true; |
4593 | + } |
4594 | + else |
4595 | + { |
4596 | + if ((!engine->is_enabled()) || |
4597 | + (engine->flush_logs())) |
4598 | + return true; |
4599 | + } |
4600 | + return false; |
4601 | +} |
4602 | + |
4603 | +/** |
4604 | + recover() step of xa. |
4605 | + |
4606 | + @note |
4607 | + there are three modes of operation: |
4608 | + - automatic recover after a crash |
4609 | + in this case commit_list != 0, tc_heuristic_recover==0 |
4610 | + all xids from commit_list are committed, others are rolled back |
4611 | + - manual (heuristic) recover |
4612 | + in this case commit_list==0, tc_heuristic_recover != 0 |
4613 | + DBA has explicitly specified that all prepared transactions should |
4614 | + be committed (or rolled back). |
4615 | + - no recovery (MySQL did not detect a crash) |
4616 | + in this case commit_list==0, tc_heuristic_recover == 0 |
4617 | + there should be no prepared transactions in this case. |
4618 | +*/ |
4619 | +class XARecover : unary_function<plugin::StorageEngine *, void> |
4620 | +{ |
4621 | + int trans_len, found_foreign_xids, found_my_xids; |
4622 | + bool result; |
4623 | + XID *trans_list; |
4624 | + HASH *commit_list; |
4625 | + bool dry_run; |
4626 | +public: |
4627 | + XARecover(XID *trans_list_arg, int trans_len_arg, |
4628 | + HASH *commit_list_arg, bool dry_run_arg) |
4629 | + : trans_len(trans_len_arg), found_foreign_xids(0), found_my_xids(0), |
4630 | + result(false), |
4631 | + trans_list(trans_list_arg), commit_list(commit_list_arg), |
4632 | + dry_run(dry_run_arg) |
4633 | + {} |
4634 | + |
4635 | + int getForeignXIDs() |
4636 | + { |
4637 | + return found_foreign_xids; |
4638 | + } |
4639 | + |
4640 | + int getMyXIDs() |
4641 | + { |
4642 | + return found_my_xids; |
4643 | + } |
4644 | + |
4645 | + result_type operator() (argument_type engine) |
4646 | + { |
4647 | + |
4648 | + int got; |
4649 | + |
4650 | + if (engine->is_enabled()) |
4651 | + { |
4652 | + while ((got= engine->recover(trans_list, trans_len)) > 0 ) |
4653 | + { |
4654 | + errmsg_printf(ERRMSG_LVL_INFO, |
4655 | + _("Found %d prepared transaction(s) in %s"), |
4656 | + got, engine->getName().c_str()); |
4657 | + for (int i=0; i < got; i ++) |
4658 | + { |
4659 | + my_xid x=trans_list[i].get_my_xid(); |
4660 | + if (!x) // not "mine" - that is generated by external TM |
4661 | + { |
4662 | + xid_cache_insert(trans_list+i, XA_PREPARED); |
4663 | + found_foreign_xids++; |
4664 | + continue; |
4665 | + } |
4666 | + if (dry_run) |
4667 | + { |
4668 | + found_my_xids++; |
4669 | + continue; |
4670 | + } |
4671 | + // recovery mode |
4672 | + if (commit_list ? |
4673 | + hash_search(commit_list, (unsigned char *)&x, sizeof(x)) != 0 : |
4674 | + tc_heuristic_recover == TC_HEURISTIC_RECOVER_COMMIT) |
4675 | + { |
4676 | + engine->commit_by_xid(trans_list+i); |
4677 | + } |
4678 | + else |
4679 | + { |
4680 | + engine->rollback_by_xid(trans_list+i); |
4681 | + } |
4682 | + } |
4683 | + if (got < trans_len) |
4684 | + break; |
4685 | + } |
4686 | + } |
4687 | + } |
4688 | +}; |
4689 | + |
4690 | +int StorageEngine::recover(HASH *commit_list) |
4691 | +{ |
4692 | + XID *trans_list= NULL; |
4693 | + int trans_len= 0; |
4694 | + |
4695 | + bool dry_run= (commit_list==0 && tc_heuristic_recover==0); |
4696 | + |
4697 | + /* commit_list and tc_heuristic_recover cannot be set both */ |
4698 | + assert(commit_list==0 || tc_heuristic_recover==0); |
4699 | + |
4700 | + /* if either is set, total_ha_2pc must be set too */ |
4701 | + if (total_ha_2pc <= 1) |
4702 | + return 0; |
4703 | + |
4704 | + |
4705 | +#ifndef WILL_BE_DELETED_LATER |
4706 | + |
4707 | + /* |
4708 | + for now, only InnoDB supports 2pc. It means we can always safely |
4709 | + rollback all pending transactions, without risking inconsistent data |
4710 | + */ |
4711 | + |
4712 | + assert(total_ha_2pc == 2); // only InnoDB and binlog |
4713 | + tc_heuristic_recover= TC_HEURISTIC_RECOVER_ROLLBACK; // forcing ROLLBACK |
4714 | + dry_run=false; |
4715 | +#endif |
4716 | + for (trans_len= MAX_XID_LIST_SIZE ; |
4717 | + trans_list==0 && trans_len > MIN_XID_LIST_SIZE; trans_len/=2) |
4718 | + { |
4719 | + trans_list=(XID *)malloc(trans_len*sizeof(XID)); |
4720 | + } |
4721 | + if (!trans_list) |
4722 | + { |
4723 | + errmsg_printf(ERRMSG_LVL_ERROR, ER(ER_OUTOFMEMORY), trans_len*sizeof(XID)); |
4724 | + return(1); |
4725 | + } |
4726 | + |
4727 | + if (commit_list) |
4728 | + errmsg_printf(ERRMSG_LVL_INFO, _("Starting crash recovery...")); |
4729 | + |
4730 | + |
4731 | + XARecover recover_func(trans_list, trans_len, commit_list, dry_run); |
4732 | + for_each(all_engines.begin(), all_engines.end(), recover_func); |
4733 | + free(trans_list); |
4734 | + |
4735 | + if (recover_func.getForeignXIDs()) |
4736 | + errmsg_printf(ERRMSG_LVL_WARN, |
4737 | + _("Found %d prepared XA transactions"), |
4738 | + recover_func.getForeignXIDs()); |
4739 | + if (dry_run && recover_func.getMyXIDs()) |
4740 | + { |
4741 | + errmsg_printf(ERRMSG_LVL_ERROR, |
4742 | + _("Found %d prepared transactions! It means that drizzled " |
4743 | + "was not shut down properly last time and critical " |
4744 | + "recovery information (last binlog or %s file) was " |
4745 | + "manually deleted after a crash. You have to start " |
4746 | + "drizzled with the --tc-heuristic-recover switch to " |
4747 | + "commit or rollback pending transactions."), |
4748 | + recover_func.getMyXIDs(), opt_tc_log_file); |
4749 | + return(1); |
4750 | + } |
4751 | + if (commit_list) |
4752 | + errmsg_printf(ERRMSG_LVL_INFO, _("Crash recovery finished.")); |
4753 | + return(0); |
4754 | +} |
4755 | + |
4756 | +int StorageEngine::startConsistentSnapshot(Session *session) |
4757 | +{ |
4758 | + for_each(all_engines.begin(), all_engines.end(), |
4759 | + bind2nd(mem_fun(&plugin::StorageEngine::start_consistent_snapshot), |
4760 | + session)); |
4761 | + return 0; |
4762 | +} |
4763 | + |
4764 | +class StorageEngineGetTableProto: public unary_function<plugin::StorageEngine *,bool> |
4765 | +{ |
4766 | + const char* path; |
4767 | + message::Table *table_proto; |
4768 | + int *err; |
4769 | +public: |
4770 | + StorageEngineGetTableProto(const char* path_arg, |
4771 | + message::Table *table_proto_arg, |
4772 | + int *err_arg) |
4773 | + :path(path_arg), table_proto(table_proto_arg), err(err_arg) {} |
4774 | + |
4775 | + result_type operator() (argument_type engine) |
4776 | + { |
4777 | + int ret= engine->getTableProtoImplementation(path, table_proto); |
4778 | + |
4779 | + if (ret != ENOENT) |
4780 | + *err= ret; |
4781 | + |
4782 | + return *err == EEXIST; |
4783 | + } |
4784 | +}; |
4785 | + |
4786 | +static int drizzle_read_table_proto(const char* path, message::Table* table) |
4787 | +{ |
4788 | + int fd= open(path, O_RDONLY); |
4789 | + |
4790 | + if (fd == -1) |
4791 | + return errno; |
4792 | + |
4793 | + google::protobuf::io::ZeroCopyInputStream* input= |
4794 | + new google::protobuf::io::FileInputStream(fd); |
4795 | + |
4796 | + if (table->ParseFromZeroCopyStream(input) == false) |
4797 | + { |
4798 | + delete input; |
4799 | + close(fd); |
4800 | + return -1; |
4801 | + } |
4802 | + |
4803 | + delete input; |
4804 | + close(fd); |
4805 | + return 0; |
4806 | +} |
4807 | + |
4808 | +/** |
4809 | + Call this function in order to give the handler the possiblity |
4810 | + to ask engine if there are any new tables that should be written to disk |
4811 | + or any dropped tables that need to be removed from disk |
4812 | +*/ |
4813 | +int StorageEngine::getTableProto(const char* path, |
4814 | + message::Table *table_proto) |
4815 | +{ |
4816 | + int err= ENOENT; |
4817 | + |
4818 | + Registry<plugin::StorageEngine *>::iterator iter= |
4819 | + find_if(all_engines.begin(), all_engines.end(), |
4820 | + StorageEngineGetTableProto(path, table_proto, &err)); |
4821 | + if (iter == all_engines.end()) |
4822 | + { |
4823 | + string proto_path(path); |
4824 | + string file_ext(".dfe"); |
4825 | + proto_path.append(file_ext); |
4826 | + |
4827 | + int error= access(proto_path.c_str(), F_OK); |
4828 | + |
4829 | + if (error == 0) |
4830 | + err= EEXIST; |
4831 | + else |
4832 | + err= errno; |
4833 | + |
4834 | + if (table_proto) |
4835 | + { |
4836 | + int read_proto_err= drizzle_read_table_proto(proto_path.c_str(), |
4837 | + table_proto); |
4838 | + |
4839 | + if (read_proto_err) |
4840 | + err= read_proto_err; |
4841 | + } |
4842 | + } |
4843 | + |
4844 | + return err; |
4845 | +} |
4846 | + |
4847 | +/** |
4848 | + An interceptor to hijack the text of the error message without |
4849 | + setting an error in the thread. We need the text to present it |
4850 | + in the form of a warning to the user. |
4851 | +*/ |
4852 | + |
4853 | +class Ha_delete_table_error_handler: public Internal_error_handler |
4854 | +{ |
4855 | +public: |
4856 | + Ha_delete_table_error_handler() : Internal_error_handler() {} |
4857 | + virtual bool handle_error(uint32_t sql_errno, |
4858 | + const char *message, |
4859 | + DRIZZLE_ERROR::enum_warning_level level, |
4860 | + Session *session); |
4861 | + char buff[DRIZZLE_ERRMSG_SIZE]; |
4862 | +}; |
4863 | + |
4864 | + |
4865 | +bool |
4866 | +Ha_delete_table_error_handler:: |
4867 | +handle_error(uint32_t , |
4868 | + const char *message, |
4869 | + DRIZZLE_ERROR::enum_warning_level , |
4870 | + Session *) |
4871 | +{ |
4872 | + /* Grab the error message */ |
4873 | + strncpy(buff, message, sizeof(buff)-1); |
4874 | + return true; |
4875 | +} |
4876 | + |
4877 | + |
4878 | +class DeleteTableStorageEngine |
4879 | + : public unary_function<plugin::StorageEngine *, void> |
4880 | +{ |
4881 | + Session *session; |
4882 | + const char *path; |
4883 | + handler **file; |
4884 | + int *dt_error; |
4885 | +public: |
4886 | + DeleteTableStorageEngine(Session *session_arg, const char *path_arg, |
4887 | + handler **file_arg, int *error_arg) |
4888 | + : session(session_arg), path(path_arg), file(file_arg), dt_error(error_arg) {} |
4889 | + |
4890 | + result_type operator() (argument_type engine) |
4891 | + { |
4892 | + char tmp_path[FN_REFLEN]; |
4893 | + handler *tmp_file; |
4894 | + |
4895 | + if(*dt_error!=ENOENT) /* already deleted table */ |
4896 | + return; |
4897 | + |
4898 | + if (!engine) |
4899 | + return; |
4900 | + |
4901 | + if (!engine->is_enabled()) |
4902 | + return; |
4903 | + |
4904 | + if ((tmp_file= engine->create(NULL, session->mem_root))) |
4905 | + tmp_file->init(); |
4906 | + else |
4907 | + return; |
4908 | + |
4909 | + path= engine->checkLowercaseNames(path, tmp_path); |
4910 | + const std::string table_path(path); |
4911 | + int tmp_error= engine->deleteTable(session, table_path); |
4912 | + |
4913 | + if (tmp_error != ENOENT) |
4914 | + { |
4915 | + if (tmp_error == 0) |
4916 | + { |
4917 | + if (engine->check_flag(HTON_BIT_HAS_DATA_DICTIONARY)) |
4918 | + delete_table_proto_file(path); |
4919 | + else |
4920 | + tmp_error= delete_table_proto_file(path); |
4921 | + } |
4922 | + |
4923 | + *dt_error= tmp_error; |
4924 | + if(*file) |
4925 | + delete *file; |
4926 | + *file= tmp_file; |
4927 | + return; |
4928 | + } |
4929 | + else |
4930 | + delete tmp_file; |
4931 | + |
4932 | + return; |
4933 | + } |
4934 | +}; |
4935 | + |
4936 | + |
4937 | +/** |
4938 | + This should return ENOENT if the file doesn't exists. |
4939 | + The .frm file will be deleted only if we return 0 or ENOENT |
4940 | +*/ |
4941 | +int StorageEngine::deleteTable(Session *session, const char *path, |
4942 | + const char *db, const char *alias, |
4943 | + bool generate_warning) |
4944 | +{ |
4945 | + TableShare dummy_share; |
4946 | + Table dummy_table; |
4947 | + memset(&dummy_table, 0, sizeof(dummy_table)); |
4948 | + memset(&dummy_share, 0, sizeof(dummy_share)); |
4949 | + |
4950 | + dummy_table.s= &dummy_share; |
4951 | + |
4952 | + int error= ENOENT; |
4953 | + handler *file= NULL; |
4954 | + |
4955 | + for_each(all_engines.begin(), all_engines.end(), |
4956 | + DeleteTableStorageEngine(session, path, &file, &error)); |
4957 | + |
4958 | + if (error == ENOENT) /* proto may be left behind */ |
4959 | + error= delete_table_proto_file(path); |
4960 | + |
4961 | + if (error && generate_warning) |
4962 | + { |
4963 | + /* |
4964 | + Because file->print_error() use my_error() to generate the error message |
4965 | + we use an internal error handler to intercept it and store the text |
4966 | + in a temporary buffer. Later the message will be presented to user |
4967 | + as a warning. |
4968 | + */ |
4969 | + Ha_delete_table_error_handler ha_delete_table_error_handler; |
4970 | + |
4971 | + /* Fill up strucutures that print_error may need */ |
4972 | + dummy_share.path.str= (char*) path; |
4973 | + dummy_share.path.length= strlen(path); |
4974 | + dummy_share.db.str= (char*) db; |
4975 | + dummy_share.db.length= strlen(db); |
4976 | + dummy_share.table_name.str= (char*) alias; |
4977 | + dummy_share.table_name.length= strlen(alias); |
4978 | + dummy_table.alias= alias; |
4979 | + |
4980 | + if(file != NULL) |
4981 | + { |
4982 | + file->change_table_ptr(&dummy_table, &dummy_share); |
4983 | + |
4984 | + session->push_internal_handler(&ha_delete_table_error_handler); |
4985 | + file->print_error(error, 0); |
4986 | + |
4987 | + session->pop_internal_handler(); |
4988 | + } |
4989 | + else |
4990 | + error= -1; /* General form of fail. maybe bad FRM */ |
4991 | + |
4992 | + /* |
4993 | + XXX: should we convert *all* errors to warnings here? |
4994 | + What if the error is fatal? |
4995 | + */ |
4996 | + push_warning(session, DRIZZLE_ERROR::WARN_LEVEL_ERROR, error, |
4997 | + ha_delete_table_error_handler.buff); |
4998 | + } |
4999 | + |
5000 | + if(file) |
zomg. slots slots and more slots. We're getting somewhere...