Merge lp:~mordred/drizzle/plugin-slot-reorg into lp:~drizzle-trunk/drizzle/development

Proposed by Monty Taylor
Status: Merged
Merged at revision: not available
Proposed branch: lp:~mordred/drizzle/plugin-slot-reorg
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: 9298 lines
114 files modified
.bzrignore (+1/-0)
drizzled/Makefile.am (+129/-136)
drizzled/authentication.h (+0/-31)
drizzled/db.cc (+4/-2)
drizzled/definitions.h (+1/-0)
drizzled/drizzled.cc (+17/-19)
drizzled/errmsg.h (+0/-33)
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/item/create.cc (+2/-3)
drizzled/logging.h (+0/-34)
drizzled/plugin.h (+33/-4)
drizzled/plugin/authentication.cc (+30/-22)
drizzled/plugin/authentication.h (+12/-6)
drizzled/plugin/command_applier.cc (+41/-0)
drizzled/plugin/command_applier.h (+10/-13)
drizzled/plugin/command_replicator.cc (+44/-0)
drizzled/plugin/command_replicator.h (+10/-13)
drizzled/plugin/error_message.cc (+28/-22)
drizzled/plugin/error_message.h (+23/-11)
drizzled/plugin/function.cc (+27/-16)
drizzled/plugin/function.h (+19/-0)
drizzled/plugin/info_schema_table.cc (+145/-0)
drizzled/plugin/info_schema_table.h (+17/-3)
drizzled/plugin/listen.cc (+22/-27)
drizzled/plugin/listen.h (+34/-2)
drizzled/plugin/listen_tcp.cc (+5/-1)
drizzled/plugin/loader.cc (+0/-5)
drizzled/plugin/logging.cc (+47/-40)
drizzled/plugin/logging.h (+20/-9)
drizzled/plugin/query_cache.cc (+50/-61)
drizzled/plugin/query_cache.h (+24/-5)
drizzled/plugin/registry.cc (+4/-99)
drizzled/plugin/registry.h (+30/-36)
drizzled/plugin/scheduler.cc (+12/-10)
drizzled/plugin/scheduler.h (+6/-0)
drizzled/plugin/storage_engine.cc (+282/-268)
drizzled/plugin/storage_engine.h (+99/-14)
drizzled/qcache.h (+0/-40)
drizzled/registry.h (+1/-0)
drizzled/replication_services.cc (+0/-23)
drizzled/replication_services.h (+12/-9)
drizzled/scheduling.h (+0/-32)
drizzled/server_includes.h (+2/-4)
drizzled/session.cc (+7/-6)
drizzled/session.h (+3/-4)
drizzled/set_var.cc (+7/-6)
drizzled/set_var.h (+3/-3)
drizzled/show.cc (+24/-139)
drizzled/show.h (+8/-4)
drizzled/slot/function.h (+0/-66)
drizzled/slot/listen.h (+0/-91)
drizzled/sql_base.cc (+7/-8)
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 (+18/-17)
drizzled/sql_table.h (+1/-1)
drizzled/sql_yacc.yy (+7/-8)
drizzled/statement/alter_table.cc (+7/-7)
drizzled/statement/rename_table.cc (+4/-4)
drizzled/statement/show_engine_status.h (+2/-2)
drizzled/table.cc (+3/-2)
drizzled/table_list.h (+10/-3)
drizzled/table_proto.h (+6/-0)
drizzled/table_proto_write.cc (+1/-1)
drizzled/table_share.h (+2/-2)
drizzled/unireg.h (+0/-10)
drizzled/xid.h (+1/-1)
plugin/archive/ha_archive.cc (+10/-8)
plugin/archive/ha_archive.h (+1/-1)
plugin/ascii/ascii.cc (+2/-2)
plugin/auth_http/auth_http.cc (+2/-2)
plugin/auth_pam/auth_pam.cc (+2/-2)
plugin/benchmark/benchmarkudf.cc (+2/-2)
plugin/blackhole/ha_blackhole.cc (+4/-4)
plugin/blackhole/ha_blackhole.h (+1/-1)
plugin/charlength/charlength.cc (+2/-2)
plugin/command_log/command_log.cc (+6/-4)
plugin/compression/compressionudf.cc (+6/-6)
plugin/connection_id/connection_id.cc (+2/-2)
plugin/console/console.cc (+5/-3)
plugin/crc32/crc32udf.cc (+2/-2)
plugin/csv/ha_tina.cc (+3/-3)
plugin/csv/ha_tina.h (+1/-1)
plugin/errmsg_stderr/errmsg_stderr.cc (+2/-2)
plugin/gearman_udf/gearman_udf.cc (+15/-15)
plugin/heap/ha_heap.cc (+6/-3)
plugin/heap/ha_heap.h (+1/-1)
plugin/hello_world/hello_world.cc (+3/-3)
plugin/info_schema/info_schema.cc (+148/-147)
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 (+15/-15)
plugin/info_schema/info_schema_methods.h (+25/-21)
plugin/innobase/handler/ha_innodb.cc (+11/-9)
plugin/innobase/handler/ha_innodb.h (+2/-1)
plugin/innobase/handler/i_s.cc (+58/-58)
plugin/innobase/handler/i_s.h (+48/-48)
plugin/length/length.cc (+3/-3)
plugin/logging_gearman/logging_gearman.cc (+7/-5)
plugin/logging_query/logging_query.cc (+5/-3)
plugin/logging_syslog/logging_syslog.cc (+5/-3)
plugin/md5/md5.cc (+3/-3)
plugin/myisam/ha_myisam.cc (+19/-17)
plugin/myisam/ha_myisam.h (+1/-1)
plugin/oldlibdrizzle/oldlibdrizzle.cc (+5/-3)
plugin/version/versionudf.cc (+3/-3)
To merge this branch: bzr merge lp:~mordred/drizzle/plugin-slot-reorg
Reviewer Review Type Date Requested Status
Jay Pipes Pending
Brian Aker Pending
Review via email: mp+12687@code.launchpad.net

This proposal supersedes a proposal from 2009-09-29.

To post a comment you must log in.
Revision history for this message
Monty Taylor (mordred) wrote : Posted in a previous version of this proposal

zomg. slots slots and more slots. We're getting somewhere...

Revision history for this message
Jay Pipes (jaypipes) wrote : Posted in a previous version of this proposal

Please merge with trunk :)

review: Needs Fixing
Revision history for this message
Jay Pipes (jaypipes) wrote : Posted in a previous version of this proposal

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::InfoSchemaTable or plugin::InfoSchemaView. Because plugin::InfoSchema is actually the table/view, not the schema itself.

review: Needs Fixing
Revision history for this message
Monty Taylor (mordred) wrote : Posted in a previous version of this proposal

-----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::InfoSchemaTable or plugin::InfoSchemaView.
> 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://enigmail.mozdev.org

iEYEARECAAYFAkq72RIACgkQ2Jv7/VK1RgFQFgCg08ujA3d80RB+j4UXyKIWAgwk
RQAAoJpUT5y4whsa6zIHxsrfZkeVT9+L
=KDz2
-----END PGP SIGNATURE-----

Revision history for this message
Jay Pipes (jaypipes) wrote : Posted in a previous version of this proposal

Great! All tests passing on all my build platforms. This is now in lp:~jaypipes/drizzle/captain-20090924-02 and is proposed for merging into trunk.

review: Approve
Revision history for this message
Monty Taylor (mordred) wrote : Posted in a previous version of this proposal

Addressed Brian's review comments.

Revision history for this message
Brian Aker (brianaker) wrote : Posted in a previous version of this proposal
Download full text (435.0 KiB)

Hi!

Is there a 1 to 1 correlation between slot and plugin? If so we
should have them named the same (or... should slot... be a part of
plugin).

Cheers,
 -Brian

On Sep 27, 2009, at 4:10 PM, Monty Taylor wrote:

> Monty Taylor has proposed merging lp:~mordred/drizzle/plugin-slot-
> reorg into lp:drizzle.
>
> Requested reviews:
> Brian Aker (brianaker):
> Jay Pipes (jaypipes)
>
> --
> https://code.launchpad.net/~mordred/drizzle/plugin-slot-reorg/+merge/12502
> You are requested to review the proposed merge of lp:~mordred/
> drizzle/plugin-slot-reorg into lp:drizzle.
> === modified file '.bzrignore'
> --- .bzrignore 2009-08-03 14:23:22 +0000
> +++ .bzrignore 2009-09-27 23:10:30 +0000
> @@ -275,3 +275,4 @@
> drizzled/message/command_reader
> TAGS
> *replication.pb.*
> +drizzled/message/table_raw_reader
>
> === modified file 'drizzled/Makefile.am'
> --- drizzled/Makefile.am 2009-09-23 17:01:21 +0000
> +++ drizzled/Makefile.am 2009-09-27 23:10:30 +0000
> @@ -38,53 +38,10 @@
> atomic/pthread_traits.h \
> atomic/sun_studio.h \
> atomics.h \
> - authentication.h \
> base.h \
> cached_item.h \
> calendar.h \
> check_stack_overrun.h \
> - statement.h \
> - statement/alter_schema.h \
> - statement/alter_table.h \
> - statement/analyze.h \
> - statement/change_schema.h \
> - statement/check.h \
> - statement/checksum.h \
> - statement/commit.h \
> - statement/create_index.h \
> - statement/create_schema.h \
> - statement/create_table.h \
> - statement/delete.h \
> - statement/drop_index.h \
> - statement/drop_schema.h \
> - statement/drop_table.h \
> - statement/empty_query.h \
> - statement/flush.h \
> - statement/insert.h \
> - statement/insert_select.h \
> - statement/kill.h \
> - statement/load.h \
> - statement/optimize.h \
> - statement/release_savepoint.h \
> - statement/rename_table.h \
> - statement/replace.h \
> - statement/replace_select.h \
> - statement/rollback.h \
> - statement/rollback_to_savepoint.h \
> - statement/savepoint.h \
> - statement/select.h \
> - statement/set_option.h \
> - statement/show_create.h \
> - statement/show_create_schema.h \
> - statement/show_engine_status.h \
> - statement/show_errors.h \
> - statement/show_processlist.h \
> - statement/show_status.h \
> - statement/show_warnings.h \
> - statement/start_transaction.h \
> - statement/truncate.h \
> - statement/unlock_tables.h \
> - statement/update.h \
> common.h \
> comp_creator.h \
> cost_vect.h \
> @@ -98,7 +55,6 @@
> dtcollation.h \
> enum.h \
> enum_nested_loop_state.h \
> - errmsg.h \
> errmsg_print.h \
> error.h \
> field.h \
> @@ -240,7 +196,6 @@
> hybrid_type_traits_decimal.h \
> hybrid_type_traits_integer.h \
> index_hint.h \
> - info_schema.h \
> internal_error_handler.h \
> item.h \
> item/basic_constant.h \
> @@ -293,7 +248,6 @@
> lex_string.h \
> lex_symbol.h \
> lock.h \
> - logging.h \
> lookup_symbol.h \
> my_decimal.h\
> my_var.h \
> @@ -302,36 +256,35 @@
> natural_join_column.h \
> nested_join.h \
> open_tables_state.h \
> + opt_range.h \
> optimizer/key_field.h \
> optimizer/position.h \
> optimizer/sargable_param...

Revision history for this message
Brian Aker (brianaker) wrote : Posted in a previous version of this proposal

Hi!

Found another thing:

namespace drizzled
{
namespace plugin
{
   class InfoSchemaTable;
}
}

That is too wordy, collapse into a single line.

One more note on my previous comment about slot (now service),... is
this the same thing as plugin? Is a plugin a collection of services? I
see two things named info_schema (which should be information schema)
and they are named differently, but everything else is nearly 1=1.

What is the end goal of the architecture?

Cheers,
 -Brian

On Sep 27, 2009, at 4:06 PM, Monty Taylor wrote:

> You have been requested to review the proposed merge of lp:~mordred/
> drizzle/plugin-slot-reorg into lp:drizzle.
>
>
>
> --
> https://code.edge.launchpad.net/~mordred/drizzle/plugin-slot-reorg/+merge/12502
> You are requested to review the proposed merge of lp:~mordred/
> drizzle/plugin-slot-reorg into lp:drizzle.

Revision history for this message
Monty Taylor (mordred) wrote : Posted in a previous version of this proposal

I've made changes based on Brian's comments. What were the slot/service methods are now static methods on the plugin classes themselves. This did allow us to achieve a very nice code cleanup in drizzled/plugin/registry.h - which is still compile-time safe, so I'm happy about that.

After this branch, I have a style-cleanup branch that builds on this one, and then a branch which adds a Plugin base class to all plugin types.

Revision history for this message
Monty Taylor (mordred) wrote :

Changed the method naming and plugin::Registry::add error handling based on Brian's feedback. There are a couple of other things - some indentation issues and actually printing the error message in plugin::Registry::add() that still need to be done, but will need to wait until after plugin-base-class and memory-file-move have been merged in, otherwise it'll cause a giant bag of hurt. (and if all goes well, perhaps those can be merge in today too)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.bzrignore'
--- .bzrignore 2009-08-03 14:23:22 +0000
+++ .bzrignore 2009-09-30 21:30:29 +0000
@@ -275,3 +275,4 @@
275drizzled/message/command_reader275drizzled/message/command_reader
276TAGS276TAGS
277*replication.pb.*277*replication.pb.*
278drizzled/message/table_raw_reader
278279
=== modified file 'drizzled/Makefile.am'
--- drizzled/Makefile.am 2009-09-29 15:38:49 +0000
+++ drizzled/Makefile.am 2009-09-30 21:30:29 +0000
@@ -38,53 +38,10 @@
38 atomic/pthread_traits.h \38 atomic/pthread_traits.h \
39 atomic/sun_studio.h \39 atomic/sun_studio.h \
40 atomics.h \40 atomics.h \
41 authentication.h \
42 base.h \41 base.h \
43 cached_item.h \42 cached_item.h \
44 calendar.h \43 calendar.h \
45 check_stack_overrun.h \44 check_stack_overrun.h \
46 statement.h \
47 statement/alter_schema.h \
48 statement/alter_table.h \
49 statement/analyze.h \
50 statement/change_schema.h \
51 statement/check.h \
52 statement/checksum.h \
53 statement/commit.h \
54 statement/create_index.h \
55 statement/create_schema.h \
56 statement/create_table.h \
57 statement/delete.h \
58 statement/drop_index.h \
59 statement/drop_schema.h \
60 statement/drop_table.h \
61 statement/empty_query.h \
62 statement/flush.h \
63 statement/insert.h \
64 statement/insert_select.h \
65 statement/kill.h \
66 statement/load.h \
67 statement/optimize.h \
68 statement/release_savepoint.h \
69 statement/rename_table.h \
70 statement/replace.h \
71 statement/replace_select.h \
72 statement/rollback.h \
73 statement/rollback_to_savepoint.h \
74 statement/savepoint.h \
75 statement/select.h \
76 statement/set_option.h \
77 statement/show_create.h \
78 statement/show_create_schema.h \
79 statement/show_engine_status.h \
80 statement/show_errors.h \
81 statement/show_processlist.h \
82 statement/show_status.h \
83 statement/show_warnings.h \
84 statement/start_transaction.h \
85 statement/truncate.h \
86 statement/unlock_tables.h \
87 statement/update.h \
88 common.h \45 common.h \
89 comp_creator.h \46 comp_creator.h \
90 cost_vect.h \47 cost_vect.h \
@@ -99,7 +56,6 @@
99 dtcollation.h \56 dtcollation.h \
100 enum.h \57 enum.h \
101 enum_nested_loop_state.h \58 enum_nested_loop_state.h \
102 errmsg.h \
103 errmsg_print.h \59 errmsg_print.h \
104 error.h \60 error.h \
105 field.h \61 field.h \
@@ -241,7 +197,6 @@
241 hybrid_type_traits_decimal.h \197 hybrid_type_traits_decimal.h \
242 hybrid_type_traits_integer.h \198 hybrid_type_traits_integer.h \
243 index_hint.h \199 index_hint.h \
244 info_schema.h \
245 internal_error_handler.h \200 internal_error_handler.h \
246 item.h \201 item.h \
247 item/basic_constant.h \202 item/basic_constant.h \
@@ -294,7 +249,6 @@
294 lex_string.h \249 lex_string.h \
295 lex_symbol.h \250 lex_symbol.h \
296 lock.h \251 lock.h \
297 logging.h \
298 lookup_symbol.h \252 lookup_symbol.h \
299 my_decimal.h\253 my_decimal.h\
300 my_var.h \254 my_var.h \
@@ -303,37 +257,36 @@
303 natural_join_column.h \257 natural_join_column.h \
304 nested_join.h \258 nested_join.h \
305 open_tables_state.h \259 open_tables_state.h \
260 opt_range.h \
306 optimizer/key_field.h \261 optimizer/key_field.h \
307 optimizer/key_use.h \262 optimizer/key_use.h \
308 optimizer/position.h \263 optimizer/position.h \
309 optimizer/sargable_param.h \264 optimizer/sargable_param.h \
310 opt_range.h \
311 order.h \265 order.h \
312 plugin.h \266 plugin.h \
313 plugin/registry.h \267 plugin/authentication.h \
268 plugin/client.h \
314 plugin/command_applier.h \269 plugin/command_applier.h \
315 plugin/command_reader.h \270 plugin/command_reader.h \
316 plugin/command_replicator.h \271 plugin/command_replicator.h \
317 plugin/authentication.h \272 plugin/error_message.h \
318 plugin/client.h \
319 plugin/error_message_handler.h \
320 plugin/function.h \273 plugin/function.h \
321 plugin/handle.h \274 plugin/handle.h \
275 plugin/info_schema_table.h \
322 plugin/library.h \276 plugin/library.h \
323 plugin/listen.h \277 plugin/listen.h \
324 plugin/listen_tcp.h \278 plugin/listen_tcp.h \
325 plugin/logging_handler.h \279 plugin/logging.h \
326 plugin/manifest.h \280 plugin/manifest.h \
327 plugin/null_client.h \281 plugin/null_client.h \
328 plugin/qcache.h \282 plugin/query_cache.h \
283 plugin/registry.h \
329 plugin/scheduler.h \284 plugin/scheduler.h \
330 plugin/storage_engine.h \285 plugin/storage_engine.h \
331 probes.h \286 probes.h \
332 qcache.h \
333 query_id.h \287 query_id.h \
334 registry.h \288 registry.h \
335 replication_services.h \289 replication_services.h \
336 scheduling.h \
337 security_context.h \290 security_context.h \
338 select_create.h \291 select_create.h \
339 select_dump.h \292 select_dump.h \
@@ -352,8 +305,6 @@
352 session.h \305 session.h \
353 set_var.h \306 set_var.h \
354 show.h \307 show.h \
355 slot/function.h \
356 slot/listen.h \
357 sql_alloc.h \308 sql_alloc.h \
358 sql_array.h \309 sql_array.h \
359 sql_base.h \310 sql_base.h \
@@ -364,7 +315,6 @@
364 sql_load.h \315 sql_load.h \
365 sql_locale.h \316 sql_locale.h \
366 sql_parse.h \317 sql_parse.h \
367 sql_plugin.h \
368 sql_select.h \318 sql_select.h \
369 sql_sort.h \319 sql_sort.h \
370 sql_state.h \320 sql_state.h \
@@ -372,6 +322,48 @@
372 sql_table.h \322 sql_table.h \
373 sql_union.h \323 sql_union.h \
374 stacktrace.h \324 stacktrace.h \
325 statement.h \
326 statement/alter_schema.h \
327 statement/alter_table.h \
328 statement/analyze.h \
329 statement/change_schema.h \
330 statement/check.h \
331 statement/checksum.h \
332 statement/commit.h \
333 statement/create_index.h \
334 statement/create_schema.h \
335 statement/create_table.h \
336 statement/delete.h \
337 statement/drop_index.h \
338 statement/drop_schema.h \
339 statement/drop_table.h \
340 statement/empty_query.h \
341 statement/flush.h \
342 statement/insert.h \
343 statement/insert_select.h \
344 statement/kill.h \
345 statement/load.h \
346 statement/optimize.h \
347 statement/release_savepoint.h \
348 statement/rename_table.h \
349 statement/replace.h \
350 statement/replace_select.h \
351 statement/rollback.h \
352 statement/rollback_to_savepoint.h \
353 statement/savepoint.h \
354 statement/select.h \
355 statement/set_option.h \
356 statement/show_create.h \
357 statement/show_create_schema.h \
358 statement/show_engine_status.h \
359 statement/show_errors.h \
360 statement/show_processlist.h \
361 statement/show_status.h \
362 statement/show_warnings.h \
363 statement/start_transaction.h \
364 statement/truncate.h \
365 statement/unlock_tables.h \
366 statement/update.h \
375 stored_key.h \367 stored_key.h \
376 structs.h \368 structs.h \
377 symbol_hash.h \369 symbol_hash.h \
@@ -379,8 +371,8 @@
379 table_ident.h \371 table_ident.h \
380 table_list.h \372 table_list.h \
381 table_map_iterator.h \373 table_map_iterator.h \
374 table_proto.h \
382 table_reference.h \375 table_reference.h \
383 table_proto.h \
384 table_share.h \376 table_share.h \
385 temporal.h \377 temporal.h \
386 temporal_format.h \378 temporal_format.h \
@@ -390,11 +382,11 @@
390 tztime.h \382 tztime.h \
391 unique.h \383 unique.h \
392 unireg.h \384 unireg.h \
385 user_var_entry.h \
393 utf8.h \386 utf8.h \
394 utf8/checked.h \387 utf8/checked.h \
395 utf8/core.h \388 utf8/core.h \
396 utf8/unchecked.h \389 utf8/unchecked.h \
397 user_var_entry.h \
398 xid.h390 xid.h
399391
400noinst_LTLIBRARIES = \392noinst_LTLIBRARIES = \
@@ -425,51 +417,9 @@
425417
426drizzled_SOURCES = \418drizzled_SOURCES = \
427 alter_info.cc \419 alter_info.cc \
428 authentication.cc \
429 cached_item.cc \420 cached_item.cc \
430 calendar.cc \421 calendar.cc \
431 check_stack_overrun.cc \422 check_stack_overrun.cc \
432 statement/alter_schema.cc \
433 statement/alter_table.cc \
434 statement/analyze.cc \
435 statement/change_schema.cc \
436 statement/check.cc \
437 statement/checksum.cc \
438 statement/commit.cc \
439 statement/create_index.cc \
440 statement/create_schema.cc \
441 statement/create_table.cc \
442 statement/delete.cc \
443 statement/drop_index.cc \
444 statement/drop_schema.cc \
445 statement/drop_table.cc \
446 statement/empty_query.cc \
447 statement/flush.cc \
448 statement/insert.cc \
449 statement/insert_select.cc \
450 statement/kill.cc \
451 statement/load.cc \
452 statement/optimize.cc \
453 statement/release_savepoint.cc \
454 statement/rename_table.cc \
455 statement/replace.cc \
456 statement/replace_select.cc \
457 statement/rollback.cc \
458 statement/rollback_to_savepoint.cc \
459 statement/savepoint.cc \
460 statement/select.cc \
461 statement/set_option.cc \
462 statement/show_create.cc \
463 statement/show_create_schema.cc \
464 statement/show_engine_status.cc \
465 statement/show_errors.cc \
466 statement/show_processlist.cc \
467 statement/show_status.cc \
468 statement/show_warnings.cc \
469 statement/start_transaction.cc \
470 statement/truncate.cc \
471 statement/unlock_tables.cc \
472 statement/update.cc \
473 comp_creator.cc \423 comp_creator.cc \
474 crc32.cc \424 crc32.cc \
475 create_field.cc \425 create_field.cc \
@@ -477,15 +427,15 @@
477 diagnostics_area.cc \427 diagnostics_area.cc \
478 drizzled.cc \428 drizzled.cc \
479 dtcollation.cc \429 dtcollation.cc \
480 errmsg.cc \430 errmsg_print.cc \
481 error.cc \431 error.cc \
482 errmsg_print.cc \432 field.cc \
483 field/blob.cc \433 field/blob.cc \
484 field/date.cc \434 field/date.cc \
485 field/datetime.cc \435 field/datetime.cc \
486 field/enum.cc \
487 field/decimal.cc \436 field/decimal.cc \
488 field/double.cc \437 field/double.cc \
438 field/enum.cc \
489 field/int64_t.cc \439 field/int64_t.cc \
490 field/long.cc \440 field/long.cc \
491 field/null.cc \441 field/null.cc \
@@ -494,7 +444,6 @@
494 field/str.cc \444 field/str.cc \
495 field/timestamp.cc \445 field/timestamp.cc \
496 field/varstring.cc \446 field/varstring.cc \
497 field.cc \
498 field_conv.cc \447 field_conv.cc \
499 field_iterator.cc \448 field_iterator.cc \
500 filesort.cc \449 filesort.cc \
@@ -510,17 +459,6 @@
510 function/get_user_var.cc \459 function/get_user_var.cc \
511 function/last_insert.cc \460 function/last_insert.cc \
512 function/locate.cc \461 function/locate.cc \
513 function/min_max.cc \
514 function/num1.cc \
515 function/numhybrid.cc \
516 function/num_op.cc \
517 function/row_count.cc \
518 function/set_user_var.cc \
519 function/sign.cc \
520 function/signed.cc \
521 function/units.cc \
522 function/unsigned.cc \
523 function/user_var_as_out_param.cc \
524 function/math/abs.cc \462 function/math/abs.cc \
525 function/math/acos.cc \463 function/math/acos.cc \
526 function/math/asin.cc \464 function/math/asin.cc \
@@ -531,10 +469,10 @@
531 function/math/divide.cc \469 function/math/divide.cc \
532 function/math/exp.cc \470 function/math/exp.cc \
533 function/math/floor.cc \471 function/math/floor.cc \
472 function/math/int.cc \
534 function/math/int_divide.cc \473 function/math/int_divide.cc \
474 function/math/int_val.cc \
535 function/math/integer.cc \475 function/math/integer.cc \
536 function/math/int.cc \
537 function/math/int_val.cc \
538 function/math/ln.cc \476 function/math/ln.cc \
539 function/math/log.cc \477 function/math/log.cc \
540 function/math/minus.cc \478 function/math/minus.cc \
@@ -550,6 +488,14 @@
550 function/math/sin.cc \488 function/math/sin.cc \
551 function/math/sqrt.cc \489 function/math/sqrt.cc \
552 function/math/tan.cc \490 function/math/tan.cc \
491 function/min_max.cc \
492 function/num1.cc \
493 function/num_op.cc \
494 function/numhybrid.cc \
495 function/row_count.cc \
496 function/set_user_var.cc \
497 function/sign.cc \
498 function/signed.cc \
553 function/str/alloc_buffer.cc \499 function/str/alloc_buffer.cc \
554 function/str/binary.cc \500 function/str/binary.cc \
555 function/str/char.cc \501 function/str/char.cc \
@@ -586,8 +532,8 @@
586 function/time/date_format.cc \532 function/time/date_format.cc \
587 function/time/dayname.cc \533 function/time/dayname.cc \
588 function/time/dayofmonth.cc \534 function/time/dayofmonth.cc \
535 function/time/dayofyear.cc \
589 function/time/extract.cc \536 function/time/extract.cc \
590 function/time/dayofyear.cc \
591 function/time/from_days.cc \537 function/time/from_days.cc \
592 function/time/from_unixtime.cc \538 function/time/from_unixtime.cc \
593 function/time/hour.cc \539 function/time/hour.cc \
@@ -597,9 +543,9 @@
597 function/time/minute.cc \543 function/time/minute.cc \
598 function/time/month.cc \544 function/time/month.cc \
599 function/time/now.cc \545 function/time/now.cc \
600 function/time/quarter.cc \
601 function/time/period_add.cc \546 function/time/period_add.cc \
602 function/time/period_diff.cc \547 function/time/period_diff.cc \
548 function/time/quarter.cc \
603 function/time/second.cc \549 function/time/second.cc \
604 function/time/sysdate_local.cc \550 function/time/sysdate_local.cc \
605 function/time/timestamp_diff.cc \551 function/time/timestamp_diff.cc \
@@ -608,11 +554,15 @@
608 function/time/unix_timestamp.cc \554 function/time/unix_timestamp.cc \
609 function/time/weekday.cc \555 function/time/weekday.cc \
610 function/time/year.cc \556 function/time/year.cc \
557 function/units.cc \
558 function/unsigned.cc \
559 function/user_var_as_out_param.cc \
611 ha_trx_info.cc \560 ha_trx_info.cc \
612 hybrid_type_traits.cc \561 hybrid_type_traits.cc \
613 hybrid_type_traits_decimal.cc \562 hybrid_type_traits_decimal.cc \
614 hybrid_type_traits_integer.cc \563 hybrid_type_traits_integer.cc \
615 index_hint.cc \564 index_hint.cc \
565 item.cc \
616 item/bin_string.cc \566 item/bin_string.cc \
617 item/cache.cc \567 item/cache.cc \
618 item/cache_decimal.cc \568 item/cache_decimal.cc \
@@ -630,10 +580,10 @@
630 item/field.cc \580 item/field.cc \
631 item/float.cc \581 item/float.cc \
632 item/hex_string.cc \582 item/hex_string.cc \
583 item/ident.cc \
633 item/insert_value.cc \584 item/insert_value.cc \
585 item/int.cc \
634 item/int_with_ref.cc \586 item/int_with_ref.cc \
635 item/ident.cc \
636 item/int.cc \
637 item/null.cc \587 item/null.cc \
638 item/num.cc \588 item/num.cc \
639 item/outer_ref.cc \589 item/outer_ref.cc \
@@ -646,32 +596,39 @@
646 item/sum.cc \596 item/sum.cc \
647 item/type_holder.cc \597 item/type_holder.cc \
648 item/uint.cc \598 item/uint.cc \
649 item.cc \
650 join.cc \599 join.cc \
651 join_cache.cc \600 join_cache.cc \
652 join_table.cc \601 join_table.cc \
653 key.cc \602 key.cc \
654 key_map.cc \603 key_map.cc \
655 lock.cc \604 lock.cc \
656 logging.cc \
657 lookup_symbol.cc \605 lookup_symbol.cc \
658 my_decimal.cc \606 my_decimal.cc \
659 name_resolution_context_state.cc \607 name_resolution_context_state.cc \
660 natural_join_column.cc \608 natural_join_column.cc \
661 optimizer/key_field.cc \
662 opt_range.cc \609 opt_range.cc \
663 opt_sum.cc \610 opt_sum.cc \
611 optimizer/key_field.cc \
612 plugin/authentication.cc \
613 plugin/command_applier.cc \
614 plugin/command_replicator.cc \
615 plugin/error_message.cc \
616 plugin/function.cc \
617 plugin/info_schema_table.cc \
618 plugin/listen.cc \
664 plugin/listen_tcp.cc \619 plugin/listen_tcp.cc \
620 plugin/loader.cc \
621 plugin/logging.cc \
622 plugin/query_cache.cc \
665 plugin/registry.cc \623 plugin/registry.cc \
666 qcache.cc \624 plugin/scheduler.cc \
667 query_id.cc \625 query_id.cc \
668 records.cc \626 records.cc \
669 scheduling.cc \627 replication_services.cc \
670 session.cc \628 session.cc \
671 set_var.cc \629 set_var.cc \
672 show.cc \630 show.cc \
673 slot/function.cc \631 sql_alloc.cc \
674 slot/listen.cc \
675 sql_base.cc \632 sql_base.cc \
676 sql_delete.cc \633 sql_delete.cc \
677 sql_derived.cc \634 sql_derived.cc \
@@ -682,7 +639,6 @@
682 sql_load.cc \639 sql_load.cc \
683 sql_locale.cc \640 sql_locale.cc \
684 sql_parse.cc \641 sql_parse.cc \
685 sql_plugin.cc \
686 sql_select.cc \642 sql_select.cc \
687 sql_state.cc \643 sql_state.cc \
688 sql_string.cc \644 sql_string.cc \
@@ -691,17 +647,56 @@
691 sql_update.cc \647 sql_update.cc \
692 sql_yacc.yy \648 sql_yacc.yy \
693 stacktrace.cc \649 stacktrace.cc \
650 statement/alter_schema.cc \
651 statement/alter_table.cc \
652 statement/analyze.cc \
653 statement/change_schema.cc \
654 statement/check.cc \
655 statement/checksum.cc \
656 statement/commit.cc \
657 statement/create_index.cc \
658 statement/create_schema.cc \
659 statement/create_table.cc \
660 statement/delete.cc \
661 statement/drop_index.cc \
662 statement/drop_schema.cc \
663 statement/drop_table.cc \
664 statement/empty_query.cc \
665 statement/flush.cc \
666 statement/insert.cc \
667 statement/insert_select.cc \
668 statement/kill.cc \
669 statement/load.cc \
670 statement/optimize.cc \
671 statement/release_savepoint.cc \
672 statement/rename_table.cc \
673 statement/replace.cc \
674 statement/replace_select.cc \
675 statement/rollback.cc \
676 statement/rollback_to_savepoint.cc \
677 statement/savepoint.cc \
678 statement/select.cc \
679 statement/set_option.cc \
680 statement/show_create.cc \
681 statement/show_create_schema.cc \
682 statement/show_engine_status.cc \
683 statement/show_errors.cc \
684 statement/show_processlist.cc \
685 statement/show_status.cc \
686 statement/show_warnings.cc \
687 statement/start_transaction.cc \
688 statement/truncate.cc \
689 statement/unlock_tables.cc \
690 statement/update.cc \
694 strfunc.cc \691 strfunc.cc \
695 table.cc \692 table.cc \
696 table_list.cc \693 table_list.cc \
697 table_map_iterator.cc \694 table_map_iterator.cc \
698 table_share.cc \695 table_share.cc \
699 temporal.cc \696 temporal.cc \
700 temporal_format.cc \697 temporal_format.cc \
701 temporal_interval.cc \698 temporal_interval.cc \
702 thr_malloc.cc \
703 time.cc \699 time.cc \
704 replication_services.cc \
705 tztime.cc \700 tztime.cc \
706 uniques.cc \701 uniques.cc \
707 user_var_entry.cc \702 user_var_entry.cc \
@@ -722,7 +717,6 @@
722 plugin/storage_engine.h.gch \717 plugin/storage_engine.h.gch \
723 sql_base.h.gch \718 sql_base.h.gch \
724 sql_parse.h.gch \719 sql_parse.h.gch \
725 sql_plugin.h.gch \
726 util/convert.h.gch \720 util/convert.h.gch \
727 util/test.h.gch721 util/test.h.gch
728else722else
@@ -738,7 +732,6 @@
738 $(PCHHEADERS) 732 $(PCHHEADERS)
739733
740EXTRA_DIST = \734EXTRA_DIST = \
741 plugin/config.h.in \
742 $(BUILT_MAINT_SRC) \735 $(BUILT_MAINT_SRC) \
743 symbol_hash.gperf \736 symbol_hash.gperf \
744 function_hash.gperf \737 function_hash.gperf \
745738
=== removed file 'drizzled/authentication.h'
--- drizzled/authentication.h 2009-05-11 17:50:22 +0000
+++ drizzled/authentication.h 1970-01-01 00:00:00 +0000
@@ -1,31 +0,0 @@
1/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *
4 * Copyright (C) 2008 Sun Microsystems
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21
22#ifndef DRIZZLED_AUTHENTICATION_H
23#define DRIZZLED_AUTHENTICATION_H
24
25#include <drizzled/plugin/authentication.h>
26
27bool authenticate_user(Session *session, const char *password);
28void add_authentication(Authentication *auth);
29void remove_authentication(Authentication *auth);
30
31#endif /* DRIZZLED_AUTHENTICATION_H */
320
=== modified file 'drizzled/db.cc'
--- drizzled/db.cc 2009-08-19 23:35:29 +0000
+++ drizzled/db.cc 2009-09-30 21:30:29 +0000
@@ -38,8 +38,6 @@
3838
39using namespace drizzled;39using namespace drizzled;
4040
41extern drizzled::ReplicationServices replication_services;
42
43#define MY_DB_OPT_FILE "db.opt"41#define MY_DB_OPT_FILE "db.opt"
44#define MAX_DROP_TABLE_Q_LEN 102442#define MAX_DROP_TABLE_Q_LEN 1024
4543
@@ -190,6 +188,7 @@
190188
191bool mysql_create_db(Session *session, const char *db, HA_CREATE_INFO *create_info)189bool mysql_create_db(Session *session, const char *db, HA_CREATE_INFO *create_info)
192{190{
191 ReplicationServices &replication_services= ReplicationServices::singleton();
193 char path[FN_REFLEN+16];192 char path[FN_REFLEN+16];
194 long result= 1;193 long result= 1;
195 int error_erno;194 int error_erno;
@@ -277,6 +276,7 @@
277276
278bool mysql_alter_db(Session *session, const char *db, HA_CREATE_INFO *create_info)277bool mysql_alter_db(Session *session, const char *db, HA_CREATE_INFO *create_info)
279{278{
279 ReplicationServices &replication_services= ReplicationServices::singleton();
280 long result=1;280 long result=1;
281 int error= 0;281 int error= 0;
282 char path[FN_REFLEN+16];282 char path[FN_REFLEN+16];
@@ -420,6 +420,7 @@
420 query= session->query;420 query= session->query;
421 query_length= session->query_length;421 query_length= session->query_length;
422 }422 }
423 ReplicationServices &replication_services= ReplicationServices::singleton();
423 replication_services.rawStatement(session, session->getQueryString(), session->getQueryLength());424 replication_services.rawStatement(session, session->getQueryString(), session->getQueryLength());
424 session->clear_error();425 session->clear_error();
425 session->server_status|= SERVER_STATUS_DB_DROPPED;426 session->server_status|= SERVER_STATUS_DB_DROPPED;
@@ -438,6 +439,7 @@
438 query_end= query + MAX_DROP_TABLE_Q_LEN;439 query_end= query + MAX_DROP_TABLE_Q_LEN;
439 db_len= strlen(db);440 db_len= strlen(db);
440441
442 ReplicationServices &replication_services= ReplicationServices::singleton();
441 for (tbl= dropped_tables; tbl; tbl= tbl->next_local)443 for (tbl= dropped_tables; tbl; tbl= tbl->next_local)
442 {444 {
443 uint32_t tbl_name_len;445 uint32_t tbl_name_len;
444446
=== modified file 'drizzled/definitions.h'
--- drizzled/definitions.h 2009-09-24 05:55:00 +0000
+++ drizzled/definitions.h 2009-09-30 21:30:29 +0000
@@ -329,6 +329,7 @@
329typedef uint64_t query_id_t;329typedef uint64_t query_id_t;
330typedef void *range_seq_t;330typedef void *range_seq_t;
331331
332enum ha_stat_type { HA_ENGINE_STATUS, HA_ENGINE_LOGS, HA_ENGINE_MUTEX };
332// the following is for checking tables333// the following is for checking tables
333334
334#define HA_ADMIN_ALREADY_DONE 1335#define HA_ADMIN_ALREADY_DONE 1
335336
=== modified file 'drizzled/drizzled.cc'
--- drizzled/drizzled.cc 2009-09-24 06:23:51 +0000
+++ drizzled/drizzled.cc 2009-09-30 21:30:30 +0000
@@ -39,12 +39,12 @@
39#include <drizzled/session.h>39#include <drizzled/session.h>
40#include <drizzled/db.h>40#include <drizzled/db.h>
41#include <drizzled/item/create.h>41#include <drizzled/item/create.h>
42#include <drizzled/errmsg.h>
43#include <drizzled/unireg.h>42#include <drizzled/unireg.h>
44#include <drizzled/scheduling.h>
45#include "drizzled/temporal_format.h" /* For init_temporal_formats() */43#include "drizzled/temporal_format.h" /* For init_temporal_formats() */
46#include "drizzled/slot/listen.h"44#include "drizzled/plugin/listen.h"
45#include "drizzled/plugin/error_message.h"
47#include "drizzled/plugin/client.h"46#include "drizzled/plugin/client.h"
47#include "drizzled/plugin/scheduler.h"
48#include "drizzled/probes.h"48#include "drizzled/probes.h"
4949
50#include <google/protobuf/stubs/common.h>50#include <google/protobuf/stubs/common.h>
@@ -243,10 +243,10 @@
243size_t my_thread_stack_size= 65536;243size_t my_thread_stack_size= 65536;
244244
245/*245/*
246 Legacy global StorageEngine. These will be removed (please do not add more).246 Legacy global plugin::StorageEngine. These will be removed (please do not add more).
247*/247*/
248StorageEngine *heap_engine;248plugin::StorageEngine *heap_engine;
249StorageEngine *myisam_engine;249plugin::StorageEngine *myisam_engine;
250250
251char* opt_secure_file_priv= 0;251char* opt_secure_file_priv= 0;
252252
@@ -395,7 +395,7 @@
395drizzled::atomic<uint32_t> refresh_version; /* Increments on each reload */395drizzled::atomic<uint32_t> refresh_version; /* Increments on each reload */
396396
397/* Function declarations */397/* Function declarations */
398bool drizzle_rm_tmp_tables(drizzled::slot::Listen &listen);398bool drizzle_rm_tmp_tables();
399399
400extern "C" pthread_handler_t signal_hand(void *arg);400extern "C" pthread_handler_t signal_hand(void *arg);
401static void drizzle_init_variables(void);401static void drizzle_init_variables(void);
@@ -419,10 +419,8 @@
419419
420void close_connections(void)420void close_connections(void)
421{421{
422 plugin::Registry &plugins= plugin::Registry::singleton();
423
424 /* Abort listening to new connections */422 /* Abort listening to new connections */
425 plugins.listen.shutdown();423 plugin::Listen::shutdown();
426424
427 /* kill connection thread */425 /* kill connection thread */
428 (void) pthread_mutex_lock(&LOCK_thread_count);426 (void) pthread_mutex_lock(&LOCK_thread_count);
@@ -1391,7 +1389,7 @@
1391 scheduler_name= opt_scheduler_default;1389 scheduler_name= opt_scheduler_default;
1392 }1390 }
13931391
1394 if (set_scheduler_factory(scheduler_name))1392 if (plugin::SchedulerFactory::setFactory(scheduler_name))
1395 {1393 {
1396 errmsg_printf(ERRMSG_LVL_ERROR,1394 errmsg_printf(ERRMSG_LVL_ERROR,
1397 _("No scheduler found, cannot continue!\n"));1395 _("No scheduler found, cannot continue!\n"));
@@ -1411,8 +1409,8 @@
1411 */1409 */
1412 const std::string myisam_engine_name("MyISAM");1410 const std::string myisam_engine_name("MyISAM");
1413 const std::string heap_engine_name("MEMORY");1411 const std::string heap_engine_name("MEMORY");
1414 myisam_engine= ha_resolve_by_name(NULL, myisam_engine_name);1412 myisam_engine= plugin::StorageEngine::findByName(NULL, myisam_engine_name);
1415 heap_engine= ha_resolve_by_name(NULL, heap_engine_name);1413 heap_engine= plugin::StorageEngine::findByName(NULL, heap_engine_name);
14161414
1417 /*1415 /*
1418 Check that the default storage engine is actually available.1416 Check that the default storage engine is actually available.
@@ -1420,9 +1418,9 @@
1420 if (default_storage_engine_str)1418 if (default_storage_engine_str)
1421 {1419 {
1422 const std::string name(default_storage_engine_str);1420 const std::string name(default_storage_engine_str);
1423 StorageEngine *engine;1421 plugin::StorageEngine *engine;
14241422
1425 engine= ha_resolve_by_name(0, name);1423 engine= plugin::StorageEngine::findByName(0, name);
1426 if (engine == NULL)1424 if (engine == NULL)
1427 {1425 {
1428 errmsg_printf(ERRMSG_LVL_ERROR, _("Unknown/unsupported table type: %s"),1426 errmsg_printf(ERRMSG_LVL_ERROR, _("Unknown/unsupported table type: %s"),
@@ -1539,7 +1537,7 @@
15391537
1540 set_default_port();1538 set_default_port();
15411539
1542 if (plugins.listen.setup())1540 if (plugin::Listen::setup())
1543 unireg_abort(1);1541 unireg_abort(1);
15441542
1545 /*1543 /*
@@ -1548,7 +1546,7 @@
1548 */1546 */
1549 error_handler_hook= my_message_sql;1547 error_handler_hook= my_message_sql;
15501548
1551 if (drizzle_rm_tmp_tables(plugins.listen) ||1549 if (drizzle_rm_tmp_tables() ||
1552 my_tz_init((Session *)0, default_tz_name))1550 my_tz_init((Session *)0, default_tz_name))
1553 {1551 {
1554 abort_loop= true;1552 abort_loop= true;
@@ -1569,7 +1567,7 @@
1569 /* Listen for new connections and start new session for each connection1567 /* Listen for new connections and start new session for each connection
1570 accepted. The listen.getClient() method will return NULL when the server1568 accepted. The listen.getClient() method will return NULL when the server
1571 should be shutdown. */1569 should be shutdown. */
1572 while ((client= plugins.listen.getClient()) != NULL)1570 while ((client= plugin::Listen::getClient()) != NULL)
1573 {1571 {
1574 if (!(session= new Session(client)))1572 if (!(session= new Session(client)))
1575 {1573 {
@@ -2409,7 +2407,7 @@
2409 /* Don't print warnings for --loose options during bootstrap */2407 /* Don't print warnings for --loose options during bootstrap */
2410 if (level == ERROR_LEVEL || global_system_variables.log_warnings)2408 if (level == ERROR_LEVEL || global_system_variables.log_warnings)
2411 {2409 {
2412 errmsg_vprintf (current_session, ERROR_LEVEL, format, args);2410 plugin::ErrorMessage::vprintf(current_session, ERROR_LEVEL, format, args);
2413 }2411 }
2414 va_end(args);2412 va_end(args);
2415}2413}
24162414
=== removed file 'drizzled/errmsg.h'
--- drizzled/errmsg.h 2009-05-11 17:50:22 +0000
+++ drizzled/errmsg.h 1970-01-01 00:00:00 +0000
@@ -1,33 +0,0 @@
1/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *
4 * Copyright (C) 2008 Sun Microsystems
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#ifndef DRIZZLED_ERRMSG_H
21#define DRIZZLED_ERRMSG_H
22
23#include <drizzled/plugin/error_message_handler.h>
24
25// need stdarg for va_list
26#include <stdarg.h>
27
28void add_errmsg_handler(Error_message_handler *handler);
29void remove_errmsg_handler(Error_message_handler *handler);
30
31bool errmsg_vprintf (Session *session, int priority, char const *format, va_list ap);
32
33#endif /* DRIZZLED_ERRMSG_H */
340
=== modified file 'drizzled/errmsg_print.cc'
--- drizzled/errmsg_print.cc 2009-07-07 09:06:29 +0000
+++ drizzled/errmsg_print.cc 2009-09-30 21:30:30 +0000
@@ -23,13 +23,16 @@
23*/23*/
2424
25#include <drizzled/server_includes.h>25#include <drizzled/server_includes.h>
26#include <drizzled/errmsg.h>26#include <drizzled/plugin/registry.h>
27#include <drizzled/errmsg_print.h>27#include <drizzled/errmsg_print.h>
28#include <drizzled/current_session.h>28#include <drizzled/current_session.h>
29#include <drizzled/plugin/error_message.h>
2930
30// need this for stderr31// need this for stderr
31#include <string.h>32#include <string.h>
3233
34using namespace drizzled;
35
33void sql_perror(const char *message)36void sql_perror(const char *message)
34{37{
35 // is stderr threadsafe?38 // is stderr threadsafe?
@@ -41,7 +44,7 @@
41 bool rv;44 bool rv;
42 va_list args;45 va_list args;
43 va_start(args, format);46 va_start(args, format);
44 rv= errmsg_vprintf(current_session, priority, format, args);47 rv= plugin::ErrorMessage::vprintf(current_session, priority, format, args);
45 va_end(args);48 va_end(args);
46 return rv;49 return rv;
47}50}
4851
=== modified file 'drizzled/ha_trx_info.cc'
--- drizzled/ha_trx_info.cc 2009-03-25 08:39:58 +0000
+++ drizzled/ha_trx_info.cc 2009-09-30 21:30:30 +0000
@@ -22,8 +22,10 @@
22#include <drizzled/plugin/storage_engine.h>22#include <drizzled/plugin/storage_engine.h>
23#include <drizzled/session.h>23#include <drizzled/session.h>
2424
25using namespace drizzled;
2526
26void Ha_trx_info::register_ha(Session_TRANS *trans, StorageEngine *engine_arg)27void Ha_trx_info::register_ha(Session_TRANS *trans,
28 plugin::StorageEngine *engine_arg)
27{29{
28 assert(m_flags == 0);30 assert(m_flags == 0);
29 assert(m_engine == NULL);31 assert(m_engine == NULL);
@@ -86,7 +88,7 @@
86}88}
8789
8890
89StorageEngine *Ha_trx_info::engine() const91plugin::StorageEngine *Ha_trx_info::engine() const
90{92{
91 assert(is_started());93 assert(is_started());
92 return m_engine;94 return m_engine;
9395
=== modified file 'drizzled/ha_trx_info.h'
--- drizzled/ha_trx_info.h 2009-03-25 08:39:58 +0000
+++ drizzled/ha_trx_info.h 2009-09-30 21:30:30 +0000
@@ -22,7 +22,13 @@
2222
2323
24class Session_TRANS;24class Session_TRANS;
25namespace drizzled
26{
27namespace plugin
28{
25class StorageEngine;29class StorageEngine;
30}
31}
2632
27/**33/**
28 Either statement transaction or normal transaction - related34 Either statement transaction or normal transaction - related
@@ -45,7 +51,8 @@
45{51{
46public:52public:
47 /** Register this storage engine in the given transaction context. */53 /** Register this storage engine in the given transaction context. */
48 void register_ha(Session_TRANS *trans, StorageEngine *engine_arg);54 void register_ha(Session_TRANS *trans,
55 drizzled::plugin::StorageEngine *engine_arg);
4956
50 /** Clear, prepare for reuse. */57 /** Clear, prepare for reuse. */
51 void reset();58 void reset();
@@ -58,7 +65,7 @@
58 /** Mark this transaction read-write if the argument is read-write. */65 /** Mark this transaction read-write if the argument is read-write. */
59 void coalesce_trx_with(const Ha_trx_info *stmt_trx);66 void coalesce_trx_with(const Ha_trx_info *stmt_trx);
60 Ha_trx_info *next() const;67 Ha_trx_info *next() const;
61 StorageEngine *engine() const;68 drizzled::plugin::StorageEngine *engine() const;
6269
63private:70private:
64 enum { TRX_READ_ONLY= 0, TRX_READ_WRITE= 1 };71 enum { TRX_READ_ONLY= 0, TRX_READ_WRITE= 1 };
@@ -69,7 +76,7 @@
69 for the same storage engine, 'engine' is not-NULL only when the76 for the same storage engine, 'engine' is not-NULL only when the
70 corresponding storage is a part of a transaction.77 corresponding storage is a part of a transaction.
71 */78 */
72 StorageEngine *m_engine;79 drizzled::plugin::StorageEngine *m_engine;
73 /**80 /**
74 Transaction flags related to this engine.81 Transaction flags related to this engine.
75 Not-null only if this instance is a part of transaction.82 Not-null only if this instance is a part of transaction.
7683
=== modified file 'drizzled/handler.cc'
--- drizzled/handler.cc 2009-09-23 21:40:36 +0000
+++ drizzled/handler.cc 2009-09-30 21:30:30 +0000
@@ -44,8 +44,6 @@
44using namespace std;44using namespace std;
45using namespace drizzled;45using namespace drizzled;
4646
47extern drizzled::ReplicationServices replication_services;
48
49KEY_CREATE_INFO default_key_create_info= { HA_KEY_ALG_UNDEF, 0, {NULL,0} };47KEY_CREATE_INFO default_key_create_info= { HA_KEY_ALG_UNDEF, 0, {NULL,0} };
5048
51/* number of entries in storage_engines[] */49/* number of entries in storage_engines[] */
@@ -365,7 +363,7 @@
365 in each engine independently. The two-phase commit protocol363 in each engine independently. The two-phase commit protocol
366 is used only if:364 is used only if:
367 - all participating engines support two-phase commit (provide365 - all participating engines support two-phase commit (provide
368 StorageEngine::prepare PSEA API call) and366 plugin::StorageEngine::prepare PSEA API call) and
369 - transactions in at least two engines modify data (i.e. are367 - transactions in at least two engines modify data (i.e. are
370 not read-only).368 not read-only).
371369
@@ -429,10 +427,10 @@
429427
430 At the end of a statement, server call428 At the end of a statement, server call
431 ha_autocommit_or_rollback() is invoked. This call in turn429 ha_autocommit_or_rollback() is invoked. This call in turn
432 invokes StorageEngine::prepare() for every involved engine.430 invokes plugin::StorageEngine::prepare() for every involved engine.
433 Prepare is followed by a call to StorageEngine::commit_one_phase()431 Prepare is followed by a call to plugin::StorageEngine::commit_one_phase()
434 If a one-phase commit will suffice, StorageEngine::prepare() is not432 If a one-phase commit will suffice, plugin::StorageEngine::prepare() is not
435 invoked and the server only calls StorageEngine::commit_one_phase().433 invoked and the server only calls plugin::StorageEngine::commit_one_phase().
436 At statement commit, the statement-related read-write engine434 At statement commit, the statement-related read-write engine
437 flag is propagated to the corresponding flag in the normal435 flag is propagated to the corresponding flag in the normal
438 transaction. When the commit is complete, the list of registered436 transaction. When the commit is complete, the list of registered
@@ -491,7 +489,7 @@
491 times per transaction.489 times per transaction.
492490
493*/491*/
494void trans_register_ha(Session *session, bool all, StorageEngine *engine)492void trans_register_ha(Session *session, bool all, plugin::StorageEngine *engine)
495{493{
496 Session_TRANS *trans;494 Session_TRANS *trans;
497 Ha_trx_info *ha_info;495 Ha_trx_info *ha_info;
@@ -623,7 +621,7 @@
623 for (; ha_info && !error; ha_info= ha_info->next())621 for (; ha_info && !error; ha_info= ha_info->next())
624 {622 {
625 int err;623 int err;
626 StorageEngine *engine= ha_info->engine();624 plugin::StorageEngine *engine= ha_info->engine();
627 /*625 /*
628 Do not call two-phase commit if this particular626 Do not call two-phase commit if this particular
629 transaction is read-only. This allows for simpler627 transaction is read-only. This allows for simpler
@@ -672,7 +670,7 @@
672 for (; ha_info; ha_info= ha_info_next)670 for (; ha_info; ha_info= ha_info_next)
673 {671 {
674 int err;672 int err;
675 StorageEngine *engine= ha_info->engine();673 plugin::StorageEngine *engine= ha_info->engine();
676 if ((err= engine->commit(session, all)))674 if ((err= engine->commit(session, all)))
677 {675 {
678 my_error(ER_ERROR_DURING_COMMIT, MYF(0), err);676 my_error(ER_ERROR_DURING_COMMIT, MYF(0), err);
@@ -715,7 +713,7 @@
715 for (; ha_info; ha_info= ha_info_next)713 for (; ha_info; ha_info= ha_info_next)
716 {714 {
717 int err;715 int err;
718 StorageEngine *engine= ha_info->engine();716 plugin::StorageEngine *engine= ha_info->engine();
719 if ((err= engine->rollback(session, all)))717 if ((err= engine->rollback(session, all)))
720 { // cannot happen718 { // cannot happen
721 my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), err);719 my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), err);
@@ -847,7 +845,7 @@
847 for (ha_info= sv->ha_list; ha_info; ha_info= ha_info->next())845 for (ha_info= sv->ha_list; ha_info; ha_info= ha_info->next())
848 {846 {
849 int err;847 int err;
850 StorageEngine *engine= ha_info->engine();848 plugin::StorageEngine *engine= ha_info->engine();
851 assert(engine);849 assert(engine);
852 if ((err= engine->savepoint_rollback(session,850 if ((err= engine->savepoint_rollback(session,
853 (void *)(sv+1))))851 (void *)(sv+1))))
@@ -866,7 +864,7 @@
866 ha_info= ha_info_next)864 ha_info= ha_info_next)
867 {865 {
868 int err;866 int err;
869 StorageEngine *engine= ha_info->engine();867 plugin::StorageEngine *engine= ha_info->engine();
870 if ((err= engine->rollback(session, !(0))))868 if ((err= engine->rollback(session, !(0))))
871 { // cannot happen869 { // cannot happen
872 my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), err);870 my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), err);
@@ -894,7 +892,7 @@
894 for (; ha_info; ha_info= ha_info->next())892 for (; ha_info; ha_info= ha_info->next())
895 {893 {
896 int err;894 int err;
897 StorageEngine *engine= ha_info->engine();895 plugin::StorageEngine *engine= ha_info->engine();
898 assert(engine);896 assert(engine);
899#ifdef NOT_IMPLEMENTED /*- TODO (examine this againt the original code base) */897#ifdef NOT_IMPLEMENTED /*- TODO (examine this againt the original code base) */
900 if (! engine->savepoint_set)898 if (! engine->savepoint_set)
@@ -927,7 +925,7 @@
927 for (; ha_info; ha_info= ha_info->next())925 for (; ha_info; ha_info= ha_info->next())
928 {926 {
929 int err;927 int err;
930 StorageEngine *engine= ha_info->engine();928 plugin::StorageEngine *engine= ha_info->engine();
931 /* Savepoint life time is enclosed into transaction life time. */929 /* Savepoint life time is enclosed into transaction life time. */
932 assert(engine);930 assert(engine);
933 if ((err= engine->savepoint_release(session,931 if ((err= engine->savepoint_release(session,
@@ -2614,7 +2612,7 @@
2614 return false;2612 return false;
2615}2613}
26162614
2617bool ha_show_status(Session *session, StorageEngine *engine, enum ha_stat_type stat)2615bool ha_show_status(Session *session, plugin::StorageEngine *engine, enum ha_stat_type stat)
2618{2616{
2619 List<Item> field_list;2617 List<Item> field_list;
2620 bool result;2618 bool result;
@@ -2650,6 +2648,7 @@
2650 const unsigned char *before_record,2648 const unsigned char *before_record,
2651 const unsigned char *after_record)2649 const unsigned char *after_record)
2652{2650{
2651 ReplicationServices &replication_services= ReplicationServices::singleton();
2653 Session *const session= table->in_use;2652 Session *const session= table->in_use;
26542653
2655 switch (session->lex->sql_command)2654 switch (session->lex->sql_command)
26562655
=== modified file 'drizzled/handler.h'
--- drizzled/handler.h 2009-09-15 21:01:42 +0000
+++ drizzled/handler.h 2009-09-30 21:30:30 +0000
@@ -45,6 +45,8 @@
45#include <algorithm>45#include <algorithm>
4646
47#define HA_MAX_ALTER_FLAGS 4047#define HA_MAX_ALTER_FLAGS 40
48
49
48typedef std::bitset<HA_MAX_ALTER_FLAGS> HA_ALTER_FLAGS;50typedef std::bitset<HA_MAX_ALTER_FLAGS> HA_ALTER_FLAGS;
4951
50extern drizzled::atomic<uint32_t> refresh_version; /* Increments on each reload */52extern drizzled::atomic<uint32_t> refresh_version; /* Increments on each reload */
@@ -171,7 +173,7 @@
171173
172 ha_rows estimation_rows_to_insert;174 ha_rows estimation_rows_to_insert;
173public:175public:
174 StorageEngine *engine; /* storage engine of this handler */176 drizzled::plugin::StorageEngine *engine; /* storage engine of this handler */
175 unsigned char *ref; /* Pointer to current row */177 unsigned char *ref; /* Pointer to current row */
176 unsigned char *dup_ref; /* Pointer to duplicate row */178 unsigned char *dup_ref; /* Pointer to duplicate row */
177179
@@ -234,7 +236,7 @@
234 */236 */
235 Discrete_interval auto_inc_interval_for_cur_row;237 Discrete_interval auto_inc_interval_for_cur_row;
236238
237 handler(StorageEngine *engine_arg, TableShare *share_arg)239 handler(drizzled::plugin::StorageEngine *engine_arg, TableShare *share_arg)
238 :table_share(share_arg), table(0),240 :table_share(share_arg), table(0),
239 estimation_rows_to_insert(0), engine(engine_arg),241 estimation_rows_to_insert(0), engine(engine_arg),
240 ref(0), in_range_check_pushed_down(false),242 ref(0), in_range_check_pushed_down(false),
@@ -803,37 +805,26 @@
803int ha_init(void);805int ha_init(void);
804int ha_end(void);806int ha_end(void);
805807
806void add_storage_engine(StorageEngine *engine);808void add_storage_engine(drizzled::plugin::StorageEngine *engine);
807void remove_storage_engine(StorageEngine *engine);809void remove_storage_engine(drizzled::plugin::StorageEngine *engine);
808810
809void ha_close_connection(Session* session);
810bool ha_flush_logs(StorageEngine *db_type);
811void ha_drop_database(char* path);
812int ha_create_table(Session *session, const char *path,811int ha_create_table(Session *session, const char *path,
813 const char *db, const char *table_name,812 const char *db, const char *table_name,
814 HA_CREATE_INFO *create_info,813 HA_CREATE_INFO *create_info,
815 bool update_create_info,814 bool update_create_info,
816 drizzled::message::Table *table_proto);815 drizzled::message::Table *table_proto);
817int ha_delete_table(Session *session, const char *path,
818 const char *db, const char *alias, bool generate_warning);
819816
820/* statistics and info */817/* statistics and info */
821bool ha_show_status(Session *session, StorageEngine *db_type, enum ha_stat_type stat);818bool ha_show_status(Session *session, drizzled::plugin::StorageEngine *db_type, enum ha_stat_type stat);
822819
823int ha_find_files(Session *session,const char *db,const char *path,820int ha_find_files(Session *session,const char *db,const char *path,
824 const char *wild, bool dir, List<LEX_STRING>* files);821 const char *wild, bool dir, List<LEX_STRING>* files);
825822
826/* report to InnoDB that control passes to the client */823/* transactions: interface to plugin::StorageEngine functions */
827int ha_release_temporary_latches(Session *session);
828
829/* transactions: interface to StorageEngine functions */
830int ha_start_consistent_snapshot(Session *session);
831int ha_commit_or_rollback_by_xid(XID *xid, bool commit);
832int ha_commit_one_phase(Session *session, bool all);824int ha_commit_one_phase(Session *session, bool all);
833int ha_rollback_trans(Session *session, bool all);825int ha_rollback_trans(Session *session, bool all);
834int ha_recover(HASH *commit_list);
835826
836/* transactions: these functions never call StorageEngine functions directly */827/* transactions: these functions never call plugin::StorageEngine functions directly */
837int ha_commit_trans(Session *session, bool all);828int ha_commit_trans(Session *session, bool all);
838int ha_autocommit_or_rollback(Session *session, int error);829int ha_autocommit_or_rollback(Session *session, int error);
839int ha_enable_transaction(Session *session, bool on);830int ha_enable_transaction(Session *session, bool on);
@@ -844,7 +835,7 @@
844int ha_release_savepoint(Session *session, SAVEPOINT *sv);835int ha_release_savepoint(Session *session, SAVEPOINT *sv);
845836
846/* these are called by storage engines */837/* these are called by storage engines */
847void trans_register_ha(Session *session, bool all, StorageEngine *engine);838void trans_register_ha(Session *session, bool all, drizzled::plugin::StorageEngine *engine);
848839
849uint32_t filename_to_tablename(const char *from, char *to, uint32_t to_length);840uint32_t filename_to_tablename(const char *from, char *to, uint32_t to_length);
850bool tablename_to_filename(const char *from, char *to, size_t to_length);841bool tablename_to_filename(const char *from, char *to, size_t to_length);
@@ -911,7 +902,7 @@
911bool mysql_create_like_table(Session *session, TableList *table,902bool mysql_create_like_table(Session *session, TableList *table,
912 TableList *src_table,903 TableList *src_table,
913 HA_CREATE_INFO *create_info);904 HA_CREATE_INFO *create_info);
914bool mysql_rename_table(StorageEngine *base, const char *old_db,905bool mysql_rename_table(drizzled::plugin::StorageEngine *base, const char *old_db,
915 const char * old_name, const char *new_db,906 const char * old_name, const char *new_db,
916 const char * new_name, uint32_t flags);907 const char * new_name, uint32_t flags);
917bool mysql_prepare_update(Session *session, TableList *table_list,908bool mysql_prepare_update(Session *session, TableList *table_list,
918909
=== modified file 'drizzled/handler_structs.h'
--- drizzled/handler_structs.h 2009-09-16 20:58:28 +0000
+++ drizzled/handler_structs.h 2009-09-30 21:30:30 +0000
@@ -29,12 +29,19 @@
29#include <drizzled/lex_string.h>29#include <drizzled/lex_string.h>
3030
31class Ha_trx_info;31class Ha_trx_info;
32struct StorageEngine;
33struct st_key;32struct st_key;
34typedef struct st_key KEY;33typedef struct st_key KEY;
35struct st_key_cache;34struct st_key_cache;
36typedef struct st_key_cache KEY_CACHE;35typedef struct st_key_cache KEY_CACHE;
3736
37namespace drizzled
38{
39namespace plugin
40{
41class StorageEngine;
42}
43}
44
38struct Session_TRANS45struct Session_TRANS
39{46{
40 Session_TRANS() {};47 Session_TRANS() {};
@@ -85,7 +92,7 @@
85 uint32_t used_fields;92 uint32_t used_fields;
86 uint32_t key_block_size;93 uint32_t key_block_size;
87 enum row_type row_type;94 enum row_type row_type;
88 StorageEngine *db_type;95 drizzled::plugin::StorageEngine *db_type;
89 uint32_t options; /* OR of HA_CREATE_ options */96 uint32_t options; /* OR of HA_CREATE_ options */
90 bool table_existed; /* 1 in create if table existed */97 bool table_existed; /* 1 in create if table existed */
91} HA_CREATE_INFO;98} HA_CREATE_INFO;
9299
=== modified file 'drizzled/item/create.cc'
--- drizzled/item/create.cc 2009-08-25 18:22:32 +0000
+++ drizzled/item/create.cc 2009-09-30 21:30:30 +0000
@@ -58,7 +58,7 @@
58#include <drizzled/function/time/weekday.h>58#include <drizzled/function/time/weekday.h>
5959
60#include <drizzled/item/cmpfunc.h>60#include <drizzled/item/cmpfunc.h>
61#include <drizzled/slot/function.h>61#include <drizzled/plugin/function.h>
62#include <drizzled/session.h>62#include <drizzled/session.h>
6363
64/* Function declarations */64/* Function declarations */
@@ -1459,8 +1459,7 @@
1459Item*1459Item*
1460Create_udf_func::create(Session *session, LEX_STRING name, List<Item> *item_list)1460Create_udf_func::create(Session *session, LEX_STRING name, List<Item> *item_list)
1461{1461{
1462 plugin::Registry &plugins= plugin::Registry::singleton();1462 const plugin::Function *udf= plugin::Function::get(name.str, name.length);
1463 const plugin::Function *udf= plugins.function.get(name.str, name.length);
1464 assert(udf);1463 assert(udf);
1465 return create(session, udf, item_list);1464 return create(session, udf, item_list);
1466}1465}
14671466
=== removed file 'drizzled/logging.h'
--- drizzled/logging.h 2009-05-11 17:50:22 +0000
+++ drizzled/logging.h 1970-01-01 00:00:00 +0000
@@ -1,34 +0,0 @@
1/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *
4 * Copyright (C) 2008 Sun Microsystems
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#ifndef DRIZZLED_LOGGING_H
21#define DRIZZLED_LOGGING_H
22
23#include <drizzled/plugin/logging_handler.h>
24
25/* there are no parameters other than the session because logging can
26 * pull everything it needs out of the session. If need to add
27 * parameters, look at how errmsg.h and errmsg.cc do it. */
28
29bool logging_pre_do (Session *session);
30bool logging_post_do (Session *session);
31void add_logger(Logging_handler *handler);
32void remove_logger(Logging_handler *handler);
33
34#endif /* DRIZZLED_LOGGING_H */
350
=== modified file 'drizzled/plugin.h'
--- drizzled/plugin.h 2009-08-17 20:54:05 +0000
+++ drizzled/plugin.h 2009-09-30 21:30:30 +0000
@@ -22,6 +22,9 @@
2222
23#include <drizzled/lex_string.h>23#include <drizzled/lex_string.h>
24#include <drizzled/xid.h>24#include <drizzled/xid.h>
25#include <drizzled/plugin/manifest.h>
26#include <drizzled/plugin/library.h>
27#include <drizzled/plugin/handle.h>
2528
26class Session;29class Session;
27class Item;30class Item;
@@ -32,6 +35,14 @@
32*/35*/
3336
3437
38class sys_var;
39typedef struct st_mysql_lex_string LEX_STRING;
40struct my_option;
41
42extern char *opt_plugin_load;
43extern char *opt_plugin_dir_ptr;
44extern char opt_plugin_dir[FN_REFLEN];
45
35/*46/*
36 Macros for beginning and ending plugin declarations. Between47 Macros for beginning and ending plugin declarations. Between
37 drizzle_declare_plugin and drizzle_declare_plugin_end there should48 drizzle_declare_plugin and drizzle_declare_plugin_end there should
@@ -347,7 +358,13 @@
347 (*(DRIZZLE_SYSVAR_NAME(name).resolve(session, DRIZZLE_SYSVAR_NAME(name).offset)))358 (*(DRIZZLE_SYSVAR_NAME(name).resolve(session, DRIZZLE_SYSVAR_NAME(name).offset)))
348359
349360
350struct StorageEngine;361namespace drizzled
362{
363namespace plugin
364{
365class StorageEngine;
366}
367}
351368
352369
353class Plugin370class Plugin
@@ -402,13 +419,25 @@
402extern "C" {419extern "C" {
403#endif420#endif
404421
422extern int plugin_init(drizzled::plugin::Registry &plugins,
423 int *argc, char **argv, int init_flags);
424extern void plugin_shutdown(drizzled::plugin::Registry &plugins);
425extern void my_print_help_inc_plugins(my_option *options);
426extern bool plugin_is_ready(const LEX_STRING *name, int type);
427extern bool mysql_install_plugin(Session *session, const LEX_STRING *name,
428 const LEX_STRING *dl);
429extern bool mysql_uninstall_plugin(Session *session, const LEX_STRING *name);
430extern void plugin_sessionvar_init(Session *session);
431extern void plugin_sessionvar_cleanup(Session *session);
432extern sys_var *intern_find_sys_var(const char *str, uint32_t, bool no_error);
433
405int session_in_lock_tables(const Session *session);434int session_in_lock_tables(const Session *session);
406int session_tablespace_op(const Session *session);435int session_tablespace_op(const Session *session);
407void set_session_proc_info(Session *session, const char *info);436void set_session_proc_info(Session *session, const char *info);
408const char *get_session_proc_info(Session *session);437const char *get_session_proc_info(Session *session);
409int64_t session_test_options(const Session *session, int64_t test_options);438int64_t session_test_options(const Session *session, int64_t test_options);
410int session_sql_command(const Session *session);439int session_sql_command(const Session *session);
411void **session_ha_data(const Session *session, const struct StorageEngine *engine);440void **session_ha_data(const Session *session, const drizzled::plugin::StorageEngine *engine);
412int session_tx_isolation(const Session *session);441int session_tx_isolation(const Session *session);
413/* Increments the row counter, see Session::row_count */442/* Increments the row counter, see Session::row_count */
414void session_inc_row_count(Session *session);443void session_inc_row_count(Session *session);
@@ -524,7 +553,7 @@
524*/553*/
525inline554inline
526void *555void *
527session_get_ha_data(const Session *session, const struct StorageEngine *engine)556session_get_ha_data(const Session *session, const drizzled::plugin::StorageEngine *engine)
528{557{
529 return *session_ha_data(session, engine);558 return *session_ha_data(session, engine);
530}559}
@@ -534,7 +563,7 @@
534*/563*/
535inline564inline
536void565void
537session_set_ha_data(const Session *session, const struct StorageEngine *engine,566session_set_ha_data(const Session *session, const drizzled::plugin::StorageEngine *engine,
538 const void *ha_data)567 const void *ha_data)
539{568{
540 *session_ha_data(session, engine)= (void*) ha_data;569 *session_ha_data(session, engine)= (void*) ha_data;
541570
=== renamed file 'drizzled/authentication.cc' => 'drizzled/plugin/authentication.cc'
--- drizzled/authentication.cc 2009-08-05 09:29:04 +0000
+++ drizzled/plugin/authentication.cc 2009-09-30 21:30:30 +0000
@@ -19,38 +19,44 @@
19 */19 */
2020
21#include "drizzled/server_includes.h"21#include "drizzled/server_includes.h"
22#include "drizzled/authentication.h"22#include "drizzled/plugin/authentication.h"
23#include "drizzled/gettext.h"
24#include "drizzled/errmsg_print.h"23#include "drizzled/errmsg_print.h"
25#include "drizzled/plugin/registry.h"24#include "drizzled/plugin/registry.h"
25#include "drizzled/gettext.h"
2626
27#include <vector>27#include <vector>
2828
29using namespace std;29using namespace std;
3030
31static vector<Authentication *> all_authentication;31namespace drizzled
3232{
33static bool are_plugins_loaded= false;33
3434std::vector<plugin::Authentication *> all_authentication;
35void add_authentication(Authentication *auth)35bool are_plugins_loaded= false;
36{36
37 all_authentication.push_back(auth);37
38}38bool plugin::Authentication::addPlugin(plugin::Authentication *auth)
3939{
40void remove_authentication(Authentication *auth)40 if (auth != NULL)
41{41 all_authentication.push_back(auth);
42 all_authentication.erase(find(all_authentication.begin(),42 return false;
43 all_authentication.end(),43}
44 auth));44
45}45void plugin::Authentication::removePlugin(plugin::Authentication *auth)
4646{
47class AuthenticateBy : public unary_function<Authentication *, bool>47 if (auth != NULL)
48 all_authentication.erase(find(all_authentication.begin(),
49 all_authentication.end(),
50 auth));
51}
52
53class AuthenticateBy : public unary_function<plugin::Authentication *, bool>
48{54{
49 Session *session;55 Session *session;
50 const char *password;56 const char *password;
51public:57public:
52 AuthenticateBy(Session *session_arg, const char *password_arg) :58 AuthenticateBy(Session *session_arg, const char *password_arg) :
53 unary_function<Authentication *, bool>(),59 unary_function<plugin::Authentication *, bool>(),
54 session(session_arg), password(password_arg) {}60 session(session_arg), password(password_arg) {}
5561
56 inline result_type operator()(argument_type auth)62 inline result_type operator()(argument_type auth)
@@ -59,14 +65,15 @@
59 }65 }
60};66};
6167
62bool authenticate_user(Session *session, const char *password)68bool plugin::Authentication::isAuthenticated(Session *session,
69 const char *password)
63{70{
64 /* If we never loaded any auth plugins, just return true */71 /* If we never loaded any auth plugins, just return true */
65 if (are_plugins_loaded != true)72 if (are_plugins_loaded != true)
66 return true;73 return true;
6774
68 /* Use find_if instead of foreach so that we can collect return codes */75 /* Use find_if instead of foreach so that we can collect return codes */
69 vector<Authentication *>::iterator iter=76 vector<plugin::Authentication *>::iterator iter=
70 find_if(all_authentication.begin(), all_authentication.end(),77 find_if(all_authentication.begin(), all_authentication.end(),
71 AuthenticateBy(session, password));78 AuthenticateBy(session, password));
72 /* If iter is == end() here, that means that all of the plugins returned79 /* If iter is == end() here, that means that all of the plugins returned
@@ -76,3 +83,4 @@
76 return iter != all_authentication.end();83 return iter != all_authentication.end();
77}84}
7885
86} /* namespace drizzled */
7987
=== modified file 'drizzled/plugin/authentication.h'
--- drizzled/plugin/authentication.h 2009-05-11 17:50:22 +0000
+++ drizzled/plugin/authentication.h 2009-09-30 21:30:30 +0000
@@ -1,8 +1,7 @@
1/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-1/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
33 *
4 * Definitions required for Authentication plugin4 * Definitions required for Authentication plugin
5
6 *5 *
7 * Copyright (C) 2008 Sun Microsystems6 * Copyright (C) 2008 Sun Microsystems
8 *7 *
@@ -20,13 +19,14 @@
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 */20 */
2221
23/*
24 Definitions required for Authentication plugin
25*/
26
27#ifndef DRIZZLED_PLUGIN_AUTHENTICATION_H22#ifndef DRIZZLED_PLUGIN_AUTHENTICATION_H
28#define DRIZZLED_PLUGIN_AUTHENTICATION_H23#define DRIZZLED_PLUGIN_AUTHENTICATION_H
2924
25namespace drizzled
26{
27namespace plugin
28{
29
30class Authentication30class Authentication
31{31{
32public:32public:
@@ -35,6 +35,12 @@
3535
36 virtual bool authenticate(Session *, const char *)= 0;36 virtual bool authenticate(Session *, const char *)= 0;
3737
38 static bool addPlugin(plugin::Authentication *auth);
39 static void removePlugin(plugin::Authentication *auth);
40 static bool isAuthenticated(Session *session, const char *password);
38};41};
3942
43} /* namespace plugin */
44} /* namespace drizzled */
45
40#endif /* DRIZZLED_PLUGIN_AUTHENTICATION_H */46#endif /* DRIZZLED_PLUGIN_AUTHENTICATION_H */
4147
=== added file 'drizzled/plugin/command_applier.cc'
--- drizzled/plugin/command_applier.cc 1970-01-01 00:00:00 +0000
+++ drizzled/plugin/command_applier.cc 2009-09-30 21:30:30 +0000
@@ -0,0 +1,41 @@
1/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *
4 * Copyright (C) 2009 Sun Microsystems
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#include "drizzled/global.h"
21
22#include "drizzled/replication_services.h"
23#include "drizzled/plugin/command_applier.h"
24
25using namespace std;
26using namespace drizzled;
27
28bool plugin::CommandApplier::addPlugin(plugin::CommandApplier *applier)
29{
30 ReplicationServices &replication_services= ReplicationServices::singleton();
31 /** @TODO ReplicationServices should indicate error in some way here */
32 replication_services.attachApplier(applier);
33 return false;
34}
35
36void plugin::CommandApplier::removePlugin(plugin::CommandApplier *applier)
37{
38 ReplicationServices &replication_services= ReplicationServices::singleton();
39 replication_services.detachApplier(applier);
40}
41
042
=== modified file 'drizzled/plugin/command_applier.h'
--- drizzled/plugin/command_applier.h 2009-08-10 19:07:57 +0000
+++ drizzled/plugin/command_applier.h 2009-09-30 21:30:30 +0000
@@ -32,17 +32,11 @@
32 * call.32 * call.
33 */33 */
3434
35/* some forward declarations needed */35namespace drizzled
36namespace drizzled36{
37{37
38 namespace message38namespace message { class Command; }
39 {39
40 class Command;
41 }
42}
43
44namespace drizzled
45{
46namespace plugin40namespace plugin
47{41{
4842
@@ -75,9 +69,12 @@
75 * internal method for determining if it is active or not.69 * internal method for determining if it is active or not.
76 */70 */
77 virtual bool isActive() {return false;}71 virtual bool isActive() {return false;}
72
73 static bool addPlugin(CommandApplier *applier);
74 static void removePlugin(CommandApplier *applier);
78};75};
7976
80} /* end namespace drizzled::plugin */77} /* namespace plugin */
81} /* end namespace drizzled */78} /* namespace drizzled */
8279
83#endif /* DRIZZLED_PLUGIN_APPLIER_H */80#endif /* DRIZZLED_PLUGIN_APPLIER_H */
8481
=== added file 'drizzled/plugin/command_replicator.cc'
--- drizzled/plugin/command_replicator.cc 1970-01-01 00:00:00 +0000
+++ drizzled/plugin/command_replicator.cc 2009-09-30 21:30:30 +0000
@@ -0,0 +1,44 @@
1/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *
4 * Copyright (C) 2009 Sun Microsystems
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#include "drizzled/global.h"
21
22#include "drizzled/replication_services.h"
23#include "drizzled/plugin/command_replicator.h"
24
25using namespace std;
26
27namespace drizzled
28{
29
30bool plugin::CommandReplicator::addPlugin(plugin::CommandReplicator *replicator)
31{
32 ReplicationServices &replication_services= ReplicationServices::singleton();
33 /** @TODO ReplicationServices should indicate error in some way here */
34 replication_services.attachReplicator(replicator);
35 return false;
36}
37
38void plugin::CommandReplicator::removePlugin(plugin::CommandReplicator *replicator)
39{
40 ReplicationServices &replication_services= ReplicationServices::singleton();
41 replication_services.detachReplicator(replicator);
42}
43
44}
045
=== modified file 'drizzled/plugin/command_replicator.h'
--- drizzled/plugin/command_replicator.h 2009-08-10 19:07:57 +0000
+++ drizzled/plugin/command_replicator.h 2009-09-30 21:30:30 +0000
@@ -33,17 +33,11 @@
33 * An applier is responsible for applying events, not a replicator...33 * An applier is responsible for applying events, not a replicator...
34 */34 */
3535
36/* some forward declarations needed */36
37namespace drizzled37namespace drizzled
38{38{
39 namespace message39namespace message { class Command; }
40 {40
41 class Command;
42 }
43}
44
45namespace drizzled
46{
47namespace plugin41namespace plugin
48{42{
4943
@@ -80,9 +74,12 @@
80 * internal method for determining if it is active or not.74 * internal method for determining if it is active or not.
81 */75 */
82 virtual bool isActive() {return false;}76 virtual bool isActive() {return false;}
77
78 static bool addPlugin(CommandReplicator *replicator);
79 static void removePlugin(CommandReplicator *replicator);
83};80};
8481
85} /* end namespace drizzled::plugin */82} /* namespace plugin */
86} /* end namespace drizzled */83} /* namespace drizzled */
8784
88#endif /* DRIZZLED_PLUGIN_COMMAND_REPLICATOR_H */85#endif /* DRIZZLED_PLUGIN_COMMAND_REPLICATOR_H */
8986
=== renamed file 'drizzled/errmsg.cc' => 'drizzled/plugin/error_message.cc'
--- drizzled/errmsg.cc 2009-08-05 09:29:04 +0000
+++ drizzled/plugin/error_message.cc 2009-09-30 21:30:30 +0000
@@ -17,48 +17,53 @@
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */18 */
1919
20#include <drizzled/server_includes.h>20#include "drizzled/server_includes.h"
21#include <drizzled/errmsg.h>21#include "drizzled/plugin/error_message.h"
22#include <drizzled/gettext.h>
23#include "drizzled/plugin/registry.h"22#include "drizzled/plugin/registry.h"
2423
24#include "drizzled/gettext.h"
25
25#include <vector>26#include <vector>
2627
27using namespace std;28using namespace std;
2829
29static vector<Error_message_handler *> all_errmsg_handler;30namespace drizzled
3031{
31static bool errmsg_has= false;32
3233vector<plugin::ErrorMessage *> all_errmsg_handler;
33void add_errmsg_handler(Error_message_handler *handler)34bool errmsg_has= false;
35
36
37bool plugin::ErrorMessage::addPlugin(plugin::ErrorMessage *handler)
34{38{
35 all_errmsg_handler.push_back(handler);39 all_errmsg_handler.push_back(handler);
36 errmsg_has= true;40 errmsg_has= true;
41 return false;
37}42}
3843
39void remove_errmsg_handler(Error_message_handler *handler)44void plugin::ErrorMessage::removePlugin(plugin::ErrorMessage *handler)
40{45{
41 all_errmsg_handler.erase(find(all_errmsg_handler.begin(),46 all_errmsg_handler.erase(find(all_errmsg_handler.begin(),
42 all_errmsg_handler.end(), handler));47 all_errmsg_handler.end(), handler));
43}48}
4449
4550
46class ErrorMessagePrint : public unary_function<Error_message_handler *, bool>51class Print : public unary_function<plugin::ErrorMessage *, bool>
47{52{
48 Session *session;53 Session *session;
49 int priority;54 int priority;
50 const char *format;55 const char *format;
51 va_list ap;56 va_list ap;
52public:57public:
53 ErrorMessagePrint(Session *session_arg, int priority_arg,58 Print(Session *session_arg, int priority_arg,
54 const char *format_arg, va_list ap_arg) :59 const char *format_arg, va_list ap_arg)
55 unary_function<Error_message_handler *, bool>(), session(session_arg),60 : unary_function<plugin::ErrorMessage *, bool>(), session(session_arg),
56 priority(priority_arg), format(format_arg)61 priority(priority_arg), format(format_arg)
57 {62 {
58 va_copy(ap, ap_arg);63 va_copy(ap, ap_arg);
59 }64 }
6065
61 ~ErrorMessagePrint() { va_end(ap); }66 ~Print() { va_end(ap); }
6267
63 inline result_type operator()(argument_type handler)68 inline result_type operator()(argument_type handler)
64 {69 {
@@ -76,10 +81,11 @@
76 }81 }
77 return false;82 return false;
78 }83 }
79};84};
8085
81bool errmsg_vprintf (Session *session, int priority,86
82 char const *format, va_list ap)87bool plugin::ErrorMessage::vprintf(Session *session, int priority,
88 char const *format, va_list ap)
83{89{
8490
85 /* check to see if any errmsg plugin has been loaded91 /* check to see if any errmsg plugin has been loaded
@@ -95,9 +101,9 @@
95 }101 }
96102
97 /* Use find_if instead of foreach so that we can collect return codes */103 /* Use find_if instead of foreach so that we can collect return codes */
98 vector<Error_message_handler *>::iterator iter=104 vector<plugin::ErrorMessage *>::iterator iter=
99 find_if(all_errmsg_handler.begin(), all_errmsg_handler.end(),105 find_if(all_errmsg_handler.begin(), all_errmsg_handler.end(),
100 ErrorMessagePrint(session, priority, format, ap)); 106 Print(session, priority, format, ap));
101 /* If iter is == end() here, that means that all of the plugins returned107 /* If iter is == end() here, that means that all of the plugins returned
102 * false, which in this case means they all succeeded. Since we want to 108 * false, which in this case means they all succeeded. Since we want to
103 * return false on success, we return the value of the two being != 109 * return false on success, we return the value of the two being !=
@@ -105,4 +111,4 @@
105 return iter != all_errmsg_handler.end();111 return iter != all_errmsg_handler.end();
106}112}
107113
108114} /* namespace drizzled */
109115
=== renamed file 'drizzled/plugin/error_message_handler.h' => 'drizzled/plugin/error_message.h'
--- drizzled/plugin/error_message_handler.h 2009-05-11 17:50:22 +0000
+++ drizzled/plugin/error_message.h 2009-09-30 21:30:30 +0000
@@ -1,9 +1,8 @@
1/*1/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
3 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
43 *
5 * Definitions required for Error Message plugin4 * Definitions required for Error Message plugin
65 *
7 * Copyright (C) 2008 Sun Microsystems6 * Copyright (C) 2008 Sun Microsystems
8 *7 *
9 * This program is free software; you can redistribute it and/or modify8 * This program is free software; you can redistribute it and/or modify
@@ -20,24 +19,37 @@
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 */20 */
2221
23#ifndef DRIZZLED_PLUGIN_ERRMSG_H22#ifndef DRIZZLED_PLUGIN_ERROR_MESSAGE_H
24#define DRIZZLED_PLUGIN_ERRMSG_H23#define DRIZZLED_PLUGIN_ERROR_MESSAGE_H
2524
26#include <stdarg.h>25#include <stdarg.h>
27#include <string>26#include <string>
2827
29class Error_message_handler28namespace drizzled
29{
30namespace plugin
31{
32
33class ErrorMessage
30{34{
31 std::string name;35 std::string name;
32public:36public:
33 Error_message_handler(std::string name_arg): name(name_arg) {}37 ErrorMessage(std::string name_arg): name(name_arg) {}
34 Error_message_handler(const char *name_arg): name(name_arg) {}38 virtual ~ErrorMessage() {}
35 virtual ~Error_message_handler() {}
3639
37 std::string getName() { return name; }40 std::string getName() { return name; }
3841
39 virtual bool errmsg(Session *session, int priority,42 virtual bool errmsg(Session *session, int priority,
40 const char *format, va_list ap)=0;43 const char *format, va_list ap)=0;
44
45 static bool addPlugin(plugin::ErrorMessage *handler);
46 static void removePlugin(plugin::ErrorMessage *handler);
47
48 static bool vprintf(Session *session, int priority, char const *format,
49 va_list ap);
41};50};
4251
43#endif /* DRIZZLED_PLUGIN_ERRMSG_H */52} /* namespace plugin */
53} /* namespace drizzled */
54
55#endif /* DRIZZLED_PLUGIN_ERROR_MESSAGE_H */
4456
=== renamed file 'drizzled/slot/function.cc' => 'drizzled/plugin/function.cc'
--- drizzled/slot/function.cc 2009-08-17 20:54:05 +0000
+++ drizzled/plugin/function.cc 2009-09-30 21:30:30 +0000
@@ -17,25 +17,36 @@
17#include <drizzled/server_includes.h>17#include <drizzled/server_includes.h>
18#include <drizzled/gettext.h>18#include <drizzled/gettext.h>
19#include <drizzled/registry.h>19#include <drizzled/registry.h>
20#include "drizzled/slot/function.h"20#include "drizzled/plugin/function.h"
2121
22using namespace std;22using namespace std;
23using namespace drizzled;23
2424namespace drizzled
2525{
26const plugin::Function *slot::Function::get(const char *name, size_t length) const26
27Registry<const plugin::Function *> udf_registry;
28
29bool plugin::Function::addPlugin(const plugin::Function *udf)
30{
31 if (udf_registry.add(udf))
32 {
33 errmsg_printf(ERRMSG_LVL_ERROR,
34 _("Could not add Function!"));
35 return true;
36 }
37 return false;
38}
39
40
41void plugin::Function::removePlugin(const plugin::Function *udf)
42{
43 udf_registry.remove(udf);
44}
45
46
47const plugin::Function *plugin::Function::get(const char *name, size_t length)
27{48{
28 return udf_registry.find(name, length);49 return udf_registry.find(name, length);
29}50}
3051
31void slot::Function::add(const plugin::Function *udf)52} /* namespace drizzled */
32{
33 udf_registry.add(udf);
34}
35
36void slot::Function::remove(const plugin::Function *udf)
37{
38 udf_registry.remove(udf);
39}
40
41
4253
=== modified file 'drizzled/plugin/function.h'
--- drizzled/plugin/function.h 2009-08-17 20:54:05 +0000
+++ drizzled/plugin/function.h 2009-09-30 21:30:30 +0000
@@ -24,6 +24,8 @@
24#include <drizzled/item.h>24#include <drizzled/item.h>
25#include <drizzled/sql_list.h>25#include <drizzled/sql_list.h>
26#include <drizzled/item/bin_string.h>26#include <drizzled/item/bin_string.h>
27#include "drizzled/function/func.h"
28
2729
28#include <string>30#include <string>
29#include <vector>31#include <vector>
@@ -62,6 +64,23 @@
62 {64 {
63 aliases.push_back(alias);65 aliases.push_back(alias);
64 }66 }
67
68 /**
69 * Add a new Function factory to the list of factories we manage.
70 */
71 static bool addPlugin(const plugin::Function *function_obj);
72
73 /**
74 * Remove a Function factory from the list of factory we manage.
75 */
76 static void removePlugin(const plugin::Function *function_obj);
77
78 /**
79 * Accept a new connection (Protocol object) on one of the configured
80 * listener interfaces.
81 */
82 static const plugin::Function *get(const char *name, size_t len=0);
83
65};84};
6685
67template<class T>86template<class T>
6887
=== added file 'drizzled/plugin/info_schema_table.cc'
--- drizzled/plugin/info_schema_table.cc 1970-01-01 00:00:00 +0000
+++ drizzled/plugin/info_schema_table.cc 2009-09-30 21:30:30 +0000
@@ -0,0 +1,145 @@
1/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *
4 * Copyright (C) 2008 Sun Microsystems
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include "drizzled/server_includes.h"
22#include "drizzled/plugin/info_schema_table.h"
23#include "drizzled/gettext.h"
24#include "drizzled/session.h"
25#include "drizzled/lex_string.h"
26
27#include <vector>
28
29using namespace std;
30
31namespace drizzled
32{
33
34vector<plugin::InfoSchemaTable *> all_schema_tables;
35
36
37bool plugin::InfoSchemaTable::addPlugin(plugin::InfoSchemaTable *schema_table)
38{
39 if (schema_table->getFirstColumnIndex() == 0)
40 schema_table->setFirstColumnIndex(-1);
41 if (schema_table->getSecondColumnIndex() == 0)
42 schema_table->setSecondColumnIndex(-1);
43
44 all_schema_tables.push_back(schema_table);
45 return false;
46}
47
48void plugin::InfoSchemaTable::removePlugin(plugin::InfoSchemaTable *table)
49{
50 all_schema_tables.erase(remove_if(all_schema_tables.begin(),
51 all_schema_tables.end(),
52 bind2nd(equal_to<plugin::InfoSchemaTable *>(),
53 table)),
54 all_schema_tables.end());
55}
56
57
58class AddSchemaTable : public unary_function<plugin::InfoSchemaTable *, bool>
59{
60 Session *session;
61 const char *wild;
62 vector<LEX_STRING*> &files;
63
64public:
65 AddSchemaTable(Session *session_arg, vector<LEX_STRING*> &files_arg, const char *wild_arg)
66 : session(session_arg), wild(wild_arg), files(files_arg)
67 {}
68
69 result_type operator() (argument_type schema_table)
70 {
71 if (schema_table->isHidden())
72 {
73 return false;
74 }
75
76 const string &schema_table_name= schema_table->getTableName();
77
78 if (wild && wild_case_compare(files_charset_info, schema_table_name.c_str(), wild))
79 {
80 return false;
81 }
82
83 LEX_STRING *file_name= 0;
84 file_name= session->make_lex_string(file_name, schema_table_name.c_str(),
85 schema_table_name.length(), true);
86 if (file_name == NULL)
87 {
88 return true;
89 }
90
91 files.push_back(file_name);
92 return false;
93 }
94};
95
96class FindSchemaTableByName : public unary_function<plugin::InfoSchemaTable *, bool>
97{
98 const char *table_name;
99public:
100 FindSchemaTableByName(const char *table_name_arg)
101 : table_name(table_name_arg) {}
102 result_type operator() (argument_type schema_table)
103 {
104 return ! my_strcasecmp(system_charset_info,
105 schema_table->getTableName().c_str(),
106 table_name);
107 }
108};
109
110plugin::InfoSchemaTable *plugin::InfoSchemaTable::getTable(const char *table_name)
111{
112 vector<plugin::InfoSchemaTable *>::iterator iter=
113 find_if(all_schema_tables.begin(),
114 all_schema_tables.end(),
115 FindSchemaTableByName(table_name));
116
117 if (iter != all_schema_tables.end())
118 {
119 return *iter;
120 }
121
122 return NULL;
123
124}
125
126
127int plugin::InfoSchemaTable::addTableToList(Session *session,
128 vector<LEX_STRING*> &files,
129 const char *wild)
130{
131
132 vector<plugin::InfoSchemaTable *>::iterator iter=
133 find_if(all_schema_tables.begin(),
134 all_schema_tables.end(),
135 AddSchemaTable(session, files, wild));
136
137 if (iter != all_schema_tables.end())
138 {
139 return 1;
140 }
141
142 return 0;
143}
144
145} /* namespace drizzled */
0146
=== renamed file 'drizzled/info_schema.h' => 'drizzled/plugin/info_schema_table.h'
--- drizzled/info_schema.h 2009-07-07 04:47:22 +0000
+++ drizzled/plugin/info_schema_table.h 2009-09-30 21:30:30 +0000
@@ -18,11 +18,16 @@
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */19 */
2020
21#ifndef DRIZZLED_INFO_SCHEMA_H21#ifndef DRIZZLE_PLUGIN_INFO_SCHEMA_TABLE_H
22#define DRIZZLED_INFO_SCHEMA_H22#define DRIZZLE_PLUGIN_INFO_SCHEMA_TABLE_H
2323
24#include <string>24#include <string>
2525
26namespace drizzled
27{
28namespace plugin
29{
30
26/**31/**
27 * @file32 * @file
28 * info_schema.h33 * info_schema.h
@@ -471,6 +476,15 @@
471 */476 */
472 InfoSchemaMethods *i_s_methods;477 InfoSchemaMethods *i_s_methods;
473478
479public:
480 static bool addPlugin(plugin::InfoSchemaTable *schema_table);
481 static void removePlugin(plugin::InfoSchemaTable *table);
482
483 static plugin::InfoSchemaTable *getTable(const char *table_name);
484 static int addTableToList(Session *session, std::vector<LEX_STRING*> &files,
485 const char *wild);
474};486};
475487
476#endif /* DRIZZLED_INFO_SCHEMA_H */488} /* namespace plugin */
489} /* namespace drizzled */
490#endif /* DRIZZLE_PLUGIN_INFO_SCHEMA_TABLE_H */
477491
=== renamed file 'drizzled/slot/listen.cc' => 'drizzled/plugin/listen.cc'
--- drizzled/slot/listen.cc 2009-08-28 00:07:54 +0000
+++ drizzled/plugin/listen.cc 2009-09-30 21:30:30 +0000
@@ -20,7 +20,7 @@
20#include <drizzled/server_includes.h>20#include <drizzled/server_includes.h>
21#include <drizzled/gettext.h>21#include <drizzled/gettext.h>
22#include <drizzled/error.h>22#include <drizzled/error.h>
23#include <drizzled/slot/listen.h>23#include <drizzled/plugin/listen.h>
24#include <drizzled/plugin/listen.h>24#include <drizzled/plugin/listen.h>
25#include <drizzled/plugin/null_client.h>25#include <drizzled/plugin/null_client.h>
2626
@@ -29,32 +29,27 @@
29using namespace std;29using namespace std;
30using namespace drizzled;30using namespace drizzled;
3131
32slot::Listen::Listen():32std::vector<plugin::Listen *> listen_list;
33 fd_list(NULL),33std::vector<plugin::Listen *> listen_fd_list;
34 fd_count(0)34struct pollfd *fd_list= NULL;
35{35uint32_t fd_count= 0;
36}36int wakeup_pipe[2];
3737
38slot::Listen::~Listen()38bool plugin::Listen::addPlugin(plugin::Listen *listen_obj)
39{39{
40 if (fd_list != NULL)40 listen_list.push_back(listen_obj);
41 free(fd_list);41 return false;
42}42}
4343
44void slot::Listen::add(plugin::Listen &listen_obj)44void plugin::Listen::removePlugin(plugin::Listen *listen_obj)
45{45{
46 listen_list.push_back(&listen_obj);46 listen_list.erase(remove(listen_list.begin(),
47}47 listen_list.end(),
4848 listen_obj),
49void slot::Listen::remove(plugin::Listen &listen_obj)
50{
51 listen_list.erase(::std::remove(listen_list.begin(),
52 listen_list.end(),
53 &listen_obj),
54 listen_list.end());49 listen_list.end());
55}50}
5651
57bool slot::Listen::setup(void)52bool plugin::Listen::setup(void)
58{53{
59 vector<plugin::Listen *>::iterator it;54 vector<plugin::Listen *>::iterator it;
60 struct pollfd *tmp_fd_list;55 struct pollfd *tmp_fd_list;
@@ -121,7 +116,7 @@
121 return false;116 return false;
122}117}
123118
124plugin::Client *slot::Listen::getClient(void) const119plugin::Client *plugin::Listen::getClient(void)
125{120{
126 int ready;121 int ready;
127 uint32_t x;122 uint32_t x;
@@ -173,12 +168,12 @@
173 }168 }
174}169}
175170
176plugin::Client *slot::Listen::getNullClient(void) const171plugin::Client *plugin::Listen::getNullClient(void)
177{172{
178 return new plugin::NullClient();173 return new plugin::NullClient();
179}174}
180175
181void slot::Listen::shutdown(void)176void plugin::Listen::shutdown(void)
182{177{
183 ssize_t ret= write(wakeup_pipe[1], "\0", 1);178 ssize_t ret= write(wakeup_pipe[1], "\0", 1);
184 assert(ret == 1);179 assert(ret == 1);
185180
=== modified file 'drizzled/plugin/listen.h'
--- drizzled/plugin/listen.h 2009-08-27 07:26:22 +0000
+++ drizzled/plugin/listen.h 2009-09-30 21:30:30 +0000
@@ -53,9 +53,41 @@
53 * @param[in] fd File descriptor that had activity.53 * @param[in] fd File descriptor that had activity.
54 */54 */
55 virtual drizzled::plugin::Client *getClient(int fd)= 0;55 virtual drizzled::plugin::Client *getClient(int fd)= 0;
56
57 /**
58 * Add a new Listen object to the list of listeners we manage.
59 */
60 static bool addPlugin(Listen *listen_obj);
61
62 /**
63 * Remove a Listen object from the list of listeners we manage.
64 */
65 static void removePlugin(Listen *listen_obj);
66
67 /**
68 * Setup all configured listen plugins.
69 */
70 static bool setup(void);
71
72 /**
73 * Accept a new connection (Client object) on one of the configured
74 * listener interfaces.
75 */
76 static plugin::Client *getClient(void);
77
78 /**
79 * Some internal functions drizzled require a temporary Client object to
80 * create a valid session object, this just returns a dummy client object.
81 */
82 static plugin::Client *getNullClient(void);
83
84 /**
85 * Shutdown and cleanup listen loop for server shutdown.
86 */
87 static void shutdown(void);
56};88};
5789
58} /* end namespace drizzled::plugin */90} /* namespace plugin */
59} /* end namespace drizzled */91} /* namespace drizzled */
6092
61#endif /* DRIZZLED_PLUGIN_LISTEN_H */93#endif /* DRIZZLED_PLUGIN_LISTEN_H */
6294
=== modified file 'drizzled/plugin/listen_tcp.cc'
--- drizzled/plugin/listen_tcp.cc 2009-08-27 18:06:03 +0000
+++ drizzled/plugin/listen_tcp.cc 2009-09-30 21:30:30 +0000
@@ -26,7 +26,9 @@
26#include <netinet/tcp.h>26#include <netinet/tcp.h>
2727
28using namespace std;28using namespace std;
29using namespace drizzled;29
30namespace drizzled
31{
3032
31int plugin::ListenTcp::acceptTcp(int fd)33int plugin::ListenTcp::acceptTcp(int fd)
32{34{
@@ -211,3 +213,5 @@
211213
212 return false;214 return false;
213}215}
216
217} /* namespace drizzled */
214218
=== renamed file 'drizzled/sql_plugin.cc' => 'drizzled/plugin/loader.cc'
--- drizzled/sql_plugin.cc 2009-09-14 18:25:40 +0000
+++ drizzled/plugin/loader.cc 2009-09-30 21:30:30 +0000
@@ -17,12 +17,7 @@
17#include <mysys/my_getopt.h>17#include <mysys/my_getopt.h>
18#include <mysys/hash.h>18#include <mysys/hash.h>
1919
20#include <drizzled/authentication.h>
21#include <drizzled/logging.h>
22#include <drizzled/errmsg.h>
23#include <drizzled/qcache.h>
24#include <drizzled/sql_parse.h>20#include <drizzled/sql_parse.h>
25#include <drizzled/scheduling.h>
26#include <drizzled/replication_services.h>21#include <drizzled/replication_services.h>
27#include <drizzled/show.h>22#include <drizzled/show.h>
28#include <drizzled/handler.h>23#include <drizzled/handler.h>
2924
=== renamed file 'drizzled/logging.cc' => 'drizzled/plugin/logging.cc'
--- drizzled/logging.cc 2009-08-05 09:29:04 +0000
+++ drizzled/plugin/logging.cc 2009-09-30 21:30:30 +0000
@@ -18,7 +18,7 @@
18 */18 */
1919
20#include <drizzled/server_includes.h>20#include <drizzled/server_includes.h>
21#include <drizzled/logging.h>21#include <drizzled/plugin/logging.h>
22#include <drizzled/gettext.h>22#include <drizzled/gettext.h>
23#include "drizzled/plugin/registry.h"23#include "drizzled/plugin/registry.h"
2424
@@ -26,27 +26,32 @@
2626
27using namespace std;27using namespace std;
2828
29static vector<Logging_handler *> all_loggers;29namespace drizzled
3030{
31void add_logger(Logging_handler *handler)31
32vector<plugin::Logging *> all_loggers;
33
34
35bool plugin::Logging::addPlugin(plugin::Logging *handler)
32{36{
33 if (handler != NULL)37 if (handler != NULL)
34 all_loggers.push_back(handler);38 all_loggers.push_back(handler);
39 return false;
35}40}
3641
37void remove_logger(Logging_handler *handler)42void plugin::Logging::removePlugin(plugin::Logging *handler)
38{43{
39 if (handler != NULL)44 if (handler != NULL)
40 all_loggers.erase(find(all_loggers.begin(), all_loggers.end(), handler));45 all_loggers.erase(find(all_loggers.begin(), all_loggers.end(), handler));
41}46}
4247
4348
44class LoggingPreIterate : public unary_function<Logging_handler *, bool>49class PreIterate : public unary_function<plugin::Logging *, bool>
45{50{
46 Session *session;51 Session *session;
47public:52public:
48 LoggingPreIterate(Session *session_arg) :53 PreIterate(Session *session_arg) :
49 unary_function<Logging_handler *, bool>(),54 unary_function<plugin::Logging *, bool>(),
50 session(session_arg) {}55 session(session_arg) {}
5156
52 inline result_type operator()(argument_type handler)57 inline result_type operator()(argument_type handler)
@@ -65,12 +70,12 @@
65};70};
6671
6772
68class LoggingPostIterate : public unary_function<Logging_handler *, bool>73class PostIterate : public unary_function<plugin::Logging *, bool>
69{74{
70 Session *session;75 Session *session;
71public:76public:
72 LoggingPostIterate(Session *session_arg) :77 PostIterate(Session *session_arg) :
73 unary_function<Logging_handler *, bool>(),78 unary_function<plugin::Logging *, bool>(),
74 session(session_arg) {}79 session(session_arg) {}
7580
76 /* This gets called once for each loaded logging plugin */81 /* This gets called once for each loaded logging plugin */
@@ -90,32 +95,34 @@
90};95};
9196
9297
93/* This is the logging_pre_do entry point.98/* This is the Logging::preDo entry point.
94 This gets called by the rest of the Drizzle server code */99 This gets called by the rest of the Drizzle server code */
95bool logging_pre_do (Session *session)100bool plugin::Logging::preDo(Session *session)
96{101{
97 /* Use find_if instead of foreach so that we can collect return codes */102 /* Use find_if instead of foreach so that we can collect return codes */
98 vector<Logging_handler *>::iterator iter=103 vector<plugin::Logging *>::iterator iter=
99 find_if(all_loggers.begin(), all_loggers.end(),104 find_if(all_loggers.begin(), all_loggers.end(),
100 LoggingPreIterate(session)); 105 PreIterate(session));
101 /* If iter is == end() here, that means that all of the plugins returned106 /* If iter is == end() here, that means that all of the plugins returned
102 * false, which in this case means they all succeeded. Since we want to 107 * false, which in this case means they all succeeded. Since we want to
103 * return false on success, we return the value of the two being != 108 * return false on success, we return the value of the two being !=
104 */109 */
105 return iter != all_loggers.end();110 return iter != all_loggers.end();
106}111}
107112
108/* This is the logging_post_do entry point.113/* This is the Logging::postDo entry point.
109 This gets called by the rest of the Drizzle server code */114 This gets called by the rest of the Drizzle server code */
110bool logging_post_do (Session *session)115bool plugin::Logging::postDo(Session *session)
111{116{
112 /* Use find_if instead of foreach so that we can collect return codes */117 /* Use find_if instead of foreach so that we can collect return codes */
113 vector<Logging_handler *>::iterator iter=118 vector<plugin::Logging *>::iterator iter=
114 find_if(all_loggers.begin(), all_loggers.end(),119 find_if(all_loggers.begin(), all_loggers.end(),
115 LoggingPostIterate(session)); 120 PostIterate(session));
116 /* If iter is == end() here, that means that all of the plugins returned121 /* If iter is == end() here, that means that all of the plugins returned
117 * false, which in this case means they all succeeded. Since we want to 122 * false, which in this case means they all succeeded. Since we want to
118 * return false on success, we return the value of the two being != 123 * return false on success, we return the value of the two being !=
119 */124 */
120 return iter != all_loggers.end();125 return iter != all_loggers.end();
121}126}
127
128} /* namespace drizzled */
122129
=== renamed file 'drizzled/plugin/logging_handler.h' => 'drizzled/plugin/logging.h'
--- drizzled/plugin/logging_handler.h 2009-05-11 17:50:22 +0000
+++ drizzled/plugin/logging.h 2009-09-30 21:30:30 +0000
@@ -1,9 +1,8 @@
1/*1/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
3 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
43 *
5 * Definitions required for Query Logging plugin4 * Definitions required for Query Logging plugin
65 *
7 * Copyright (C) 2008 Sun Microsystems6 * Copyright (C) 2008 Sun Microsystems
8 *7 *
9 * This program is free software; you can redistribute it and/or modify8 * This program is free software; you can redistribute it and/or modify
@@ -25,21 +24,33 @@
2524
26#include <string>25#include <string>
2726
28class Logging_handler27namespace drizzled
28{
29namespace plugin
30{
31
32class Logging
29{33{
30 std::string name;34 std::string name;
31public:35public:
32 Logging_handler(std::string name_arg): name(name_arg) {}36 Logging(std::string name_arg): name(name_arg) {}
33 Logging_handler(const char *name_arg): name(name_arg) {}37 virtual ~Logging() {}
34 virtual ~Logging_handler() {}
3538
36 std::string getName() { return name; }39 std::string getName() { return name; }
37 /**40 /**
38 * Make these no-op rather than pure-virtual so that it's easy for a plugin41 * Make these no-op rather than pure-virtual so that it's easy for a plugin
39 * to only 42 * to only implement one.
40 */43 */
41 virtual bool pre(Session *) {return false;}44 virtual bool pre(Session *) {return false;}
42 virtual bool post(Session *) {return false;}45 virtual bool post(Session *) {return false;}
46
47 static bool addPlugin(Logging *handler);
48 static void removePlugin(Logging *handler);
49 static bool preDo(Session *session);
50 static bool postDo(Session *session);
43};51};
4452
53} /* namespace plugin */
54} /* namespace drizzled */
55
45#endif /* DRIZZLED_PLUGIN_LOGGING_H */56#endif /* DRIZZLED_PLUGIN_LOGGING_H */
4657
=== renamed file 'drizzled/qcache.cc' => 'drizzled/plugin/query_cache.cc'
--- drizzled/qcache.cc 2009-08-05 09:29:04 +0000
+++ drizzled/plugin/query_cache.cc 2009-09-30 21:30:30 +0000
@@ -17,47 +17,36 @@
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */18 */
1919
20#include <drizzled/server_includes.h>20#include "drizzled/server_includes.h"
21#include <drizzled/qcache.h>21#include "drizzled/plugin/query_cache.h"
22#include <drizzled/gettext.h>
23#include "drizzled/plugin/registry.h"22#include "drizzled/plugin/registry.h"
23
24#include "drizzled/gettext.h"
25
24#include <vector>26#include <vector>
2527
26using namespace std;28using namespace std;
2729
28static vector<QueryCache *> all_query_cache;30namespace drizzled
2931{
30void add_query_cache(QueryCache *handler)32
31{33vector<plugin::QueryCache *> all_query_cache;
32 all_query_cache.push_back(handler);
33}
34
35void remove_query_cache(QueryCache *handler)
36{
37 all_query_cache.erase(find(all_query_cache.begin(), all_query_cache.end(),
38 handler));
39}
40
41
4234
43/* Namespaces are here to prevent global symbol clashes with these classes */35/* Namespaces are here to prevent global symbol clashes with these classes */
4436
45namespace drizzled {
46namespace query_cache {
47
48class TryFetchAndSendIterate37class TryFetchAndSendIterate
49 : public unary_function<QueryCache *, bool>38 : public unary_function<plugin::QueryCache *, bool>
50{39{
51 Session *session;40 Session *session;
52 bool is_transactional;41 bool is_transactional;
53public:42public:
54 TryFetchAndSendIterate(Session *session_arg, bool is_transactional_arg) :43 TryFetchAndSendIterate(Session *session_arg, bool is_transactional_arg) :
55 unary_function<QueryCache *, bool>(),44 unary_function<plugin::QueryCache *, bool>(),
56 session(session_arg), is_transactional(is_transactional_arg) { }45 session(session_arg), is_transactional(is_transactional_arg) { }
5746
58 inline result_type operator()(argument_type handler)47 inline result_type operator()(argument_type handler)
59 {48 {
60 if (handler->try_fetch_and_send(session, is_transactional))49 if (handler->tryFetchAndSend(session, is_transactional))
61 {50 {
62 errmsg_printf(ERRMSG_LVL_ERROR,51 errmsg_printf(ERRMSG_LVL_ERROR,
63 _("qcache plugin '%s' try_fetch_and_send() failed"),52 _("qcache plugin '%s' try_fetch_and_send() failed"),
@@ -69,13 +58,13 @@
69};58};
7059
71class SetIterate60class SetIterate
72 : public unary_function<QueryCache *, bool>61 : public unary_function<plugin::QueryCache *, bool>
73{62{
74 Session *session;63 Session *session;
75 bool is_transactional;64 bool is_transactional;
76public:65public:
77 SetIterate(Session *session_arg, bool is_transactional_arg) :66 SetIterate(Session *session_arg, bool is_transactional_arg) :
78 unary_function<QueryCache *, bool>(),67 unary_function<plugin::QueryCache *, bool>(),
79 session(session_arg), is_transactional(is_transactional_arg) { }68 session(session_arg), is_transactional(is_transactional_arg) { }
8069
81 inline result_type operator()(argument_type handler)70 inline result_type operator()(argument_type handler)
@@ -92,22 +81,22 @@
92};81};
9382
94class InvalidateTableIterate83class InvalidateTableIterate
95 : public unary_function<QueryCache *, bool>84 : public unary_function<plugin::QueryCache *, bool>
96{85{
97 Session *session;86 Session *session;
98 bool is_transactional;87 bool is_transactional;
99public:88public:
100 InvalidateTableIterate(Session *session_arg, bool is_transactional_arg) :89 InvalidateTableIterate(Session *session_arg, bool is_transactional_arg) :
101 unary_function<QueryCache *, bool>(),90 unary_function<plugin::QueryCache *, bool>(),
102 session(session_arg), is_transactional(is_transactional_arg) { }91 session(session_arg), is_transactional(is_transactional_arg) { }
10392
104 inline result_type operator()(argument_type handler)93 inline result_type operator()(argument_type handler)
105 {94 {
10695
107 if (handler->invalidate_table(session, is_transactional))96 if (handler->invalidateTable(session, is_transactional))
108 {97 {
109 errmsg_printf(ERRMSG_LVL_ERROR,98 errmsg_printf(ERRMSG_LVL_ERROR,
110 _("qcache plugin '%s' invalidate_table() failed"),99 _("qcache plugin '%s' invalidateTable() failed"),
111 handler->getName().c_str());100 handler->getName().c_str());
112 return true;101 return true;
113 }102 }
@@ -117,7 +106,7 @@
117106
118107
119class InvalidateDbIterate108class InvalidateDbIterate
120 : public unary_function<QueryCache *, bool>109 : public unary_function<plugin::QueryCache *, bool>
121{110{
122 Session *session;111 Session *session;
123 const char *dbname;112 const char *dbname;
@@ -125,16 +114,16 @@
125public:114public:
126 InvalidateDbIterate(Session *session_arg, const char *dbname_arg,115 InvalidateDbIterate(Session *session_arg, const char *dbname_arg,
127 bool is_transactional_arg) :116 bool is_transactional_arg) :
128 unary_function<QueryCache *, bool>(),117 unary_function<plugin::QueryCache *, bool>(),
129 session(session_arg), dbname(dbname_arg),118 session(session_arg), dbname(dbname_arg),
130 is_transactional(is_transactional_arg) { }119 is_transactional(is_transactional_arg) { }
131120
132 inline result_type operator()(argument_type handler)121 inline result_type operator()(argument_type handler)
133 {122 {
134 if (handler->invalidate_db(session, dbname, is_transactional))123 if (handler->invalidateDb(session, dbname, is_transactional))
135 {124 {
136 errmsg_printf(ERRMSG_LVL_ERROR,125 errmsg_printf(ERRMSG_LVL_ERROR,
137 _("qcache plugin '%s' invalidate_db() failed"),126 _("qcache plugin '%s' invalidateDb() failed"),
138 handler->getName().c_str());127 handler->getName().c_str());
139 return true;128 return true;
140 }129 }
@@ -143,12 +132,12 @@
143};132};
144133
145class FlushIterate134class FlushIterate
146 : public unary_function<QueryCache *, bool>135 : public unary_function<plugin::QueryCache *, bool>
147{136{
148 Session *session;137 Session *session;
149public:138public:
150 FlushIterate(Session *session_arg) :139 FlushIterate(Session *session_arg) :
151 unary_function<QueryCache *, bool>(), session(session_arg) { }140 unary_function<plugin::QueryCache *, bool>(), session(session_arg) { }
152141
153 inline result_type operator()(argument_type handler)142 inline result_type operator()(argument_type handler)
154 {143 {
@@ -162,23 +151,24 @@
162 }151 }
163};152};
164153
165/*154bool plugin::QueryCache::addPlugin(plugin::QueryCache *handler)
166 Following functions:155{
167156 all_query_cache.push_back(handler);
168 try_fetch_and_send();157 return false;
169 set();158}
170 invalidate_table();159
171 invalidate_db();160void plugin::QueryCache::removePlugin(plugin::QueryCache *handler)
172 flush();161{
173162 all_query_cache.erase(find(all_query_cache.begin(), all_query_cache.end(),
174 are the entry points to the query cache plugin that is called by the163 handler));
175 rest of the Drizzle server code.164}
176*/165
177166
178bool try_fetch_and_send(Session *session, bool transactional)167bool plugin::QueryCache::tryFetchAndSendDo(Session *session,
168 bool transactional)
179{169{
180 /* Use find_if instead of foreach so that we can collect return codes */170 /* Use find_if instead of foreach so that we can collect return codes */
181 vector<QueryCache *>::iterator iter=171 vector<plugin::QueryCache *>::iterator iter=
182 find_if(all_query_cache.begin(), all_query_cache.end(),172 find_if(all_query_cache.begin(), all_query_cache.end(),
183 TryFetchAndSendIterate(session, transactional));173 TryFetchAndSendIterate(session, transactional));
184 /* If iter is == end() here, that means that all of the plugins returned174 /* If iter is == end() here, that means that all of the plugins returned
@@ -188,10 +178,10 @@
188 return iter != all_query_cache.end();178 return iter != all_query_cache.end();
189}179}
190180
191bool set(Session *session, bool transactional)181bool plugin::QueryCache::setDo(Session *session, bool transactional)
192{182{
193 /* Use find_if instead of foreach so that we can collect return codes */183 /* Use find_if instead of foreach so that we can collect return codes */
194 vector<QueryCache *>::iterator iter=184 vector<plugin::QueryCache *>::iterator iter=
195 find_if(all_query_cache.begin(), all_query_cache.end(),185 find_if(all_query_cache.begin(), all_query_cache.end(),
196 SetIterate(session, transactional));186 SetIterate(session, transactional));
197 /* If iter is == end() here, that means that all of the plugins returned187 /* If iter is == end() here, that means that all of the plugins returned
@@ -201,10 +191,11 @@
201 return iter != all_query_cache.end();191 return iter != all_query_cache.end();
202}192}
203193
204bool invalidate_table(Session *session, bool transactional)194bool plugin::QueryCache::invalidateTableDo(Session *session,
195 bool transactional)
205{196{
206 /* Use find_if instead of foreach so that we can collect return codes */197 /* Use find_if instead of foreach so that we can collect return codes */
207 vector<QueryCache *>::iterator iter=198 vector<plugin::QueryCache *>::iterator iter=
208 find_if(all_query_cache.begin(), all_query_cache.end(),199 find_if(all_query_cache.begin(), all_query_cache.end(),
209 InvalidateTableIterate(session, transactional));200 InvalidateTableIterate(session, transactional));
210 /* If iter is == end() here, that means that all of the plugins returned201 /* If iter is == end() here, that means that all of the plugins returned
@@ -214,11 +205,11 @@
214 return iter != all_query_cache.end();205 return iter != all_query_cache.end();
215}206}
216207
217bool invalidate_db(Session *session, const char *dbname,208bool plugin::QueryCache::invalidateDbDo(Session *session, const char *dbname,
218 bool transactional)209 bool transactional)
219{210{
220 /* Use find_if instead of foreach so that we can collect return codes */211 /* Use find_if instead of foreach so that we can collect return codes */
221 vector<QueryCache *>::iterator iter=212 vector<plugin::QueryCache *>::iterator iter=
222 find_if(all_query_cache.begin(), all_query_cache.end(),213 find_if(all_query_cache.begin(), all_query_cache.end(),
223 InvalidateDbIterate(session, dbname, transactional));214 InvalidateDbIterate(session, dbname, transactional));
224 /* If iter is == end() here, that means that all of the plugins returned215 /* If iter is == end() here, that means that all of the plugins returned
@@ -228,10 +219,10 @@
228 return iter != all_query_cache.end();219 return iter != all_query_cache.end();
229}220}
230221
231bool flush(Session *session)222bool plugin::QueryCache::flushDo(Session *session)
232{223{
233 /* Use find_if instead of foreach so that we can collect return codes */224 /* Use find_if instead of foreach so that we can collect return codes */
234 vector<QueryCache *>::iterator iter=225 vector<plugin::QueryCache *>::iterator iter=
235 find_if(all_query_cache.begin(), all_query_cache.end(),226 find_if(all_query_cache.begin(), all_query_cache.end(),
236 FlushIterate(session));227 FlushIterate(session));
237 /* If iter is == end() here, that means that all of the plugins returned228 /* If iter is == end() here, that means that all of the plugins returned
@@ -241,6 +232,4 @@
241 return iter != all_query_cache.end();232 return iter != all_query_cache.end();
242}233}
243234
244} /* namespace query_cache */
245} /* namespace drizzled */235} /* namespace drizzled */
246
247236
=== renamed file 'drizzled/plugin/qcache.h' => 'drizzled/plugin/query_cache.h'
--- drizzled/plugin/qcache.h 2009-05-11 17:50:22 +0000
+++ drizzled/plugin/query_cache.h 2009-09-30 21:30:30 +0000
@@ -23,6 +23,11 @@
23#ifndef DRIZZLED_PLUGIN_QUERY_CACHE_H23#ifndef DRIZZLED_PLUGIN_QUERY_CACHE_H
24#define DRIZZLED_PLUGIN_QUERY_CACHE_H24#define DRIZZLED_PLUGIN_QUERY_CACHE_H
2525
26namespace drizzled
27{
28namespace plugin
29{
30
26/* 31/*
27 This is the API that a qcache plugin must implement.32 This is the API that a qcache plugin must implement.
28 it should implement each of these function pointers.33 it should implement each of these function pointers.
@@ -43,14 +48,28 @@
4348
44 virtual ~QueryCache() {}49 virtual ~QueryCache() {}
45 /* Lookup the cache and transmit the data back to the client */50 /* Lookup the cache and transmit the data back to the client */
46 virtual bool try_fetch_and_send(Session *session,51 virtual bool tryFetchAndSend(Session *session,
47 bool is_transactional)= 0;52 bool is_transactional)= 0;
4853
49 virtual bool set(Session *session, bool is_transactional)= 0;54 virtual bool set(Session *session, bool is_transactional)= 0;
50 virtual bool invalidate_table(Session *session, bool is_transactional)= 0;55 virtual bool invalidateTable(Session *session, bool is_transactional)= 0;
51 virtual bool invalidate_db(Session *session, const char *db_name,56 virtual bool invalidateDb(Session *session, const char *db_name,
52 bool transactional)= 0;57 bool transactional)= 0;
53 virtual bool flush(Session *session)= 0;58 virtual bool flush(Session *session)= 0;
59
60 static bool addPlugin(QueryCache *handler);
61 static void removePlugin(QueryCache *handler);
62
63 /* These are the functions called by the rest of the Drizzle server */
64 static bool tryFetchAndSendDo(Session *session, bool transactional);
65 static bool setDo(Session *session, bool transactional);
66 static bool invalidateTableDo(Session *session, bool transactional);
67 static bool invalidateDbDo(Session *session, const char *db_name,
68 bool transactional);
69 static bool flushDo(Session *session);
54};70};
5571
72} /* namespace plugin */
73} /* namespace drizzled */
74
56#endif /* DRIZZLED_PLUGIN_QUERY_CACHE_H */75#endif /* DRIZZLED_PLUGIN_QUERY_CACHE_H */
5776
=== modified file 'drizzled/plugin/registry.cc'
--- drizzled/plugin/registry.cc 2009-09-16 17:10:18 +0000
+++ drizzled/plugin/registry.cc 2009-09-30 21:30:30 +0000
@@ -23,20 +23,15 @@
23#include "drizzled/plugin.h"23#include "drizzled/plugin.h"
24#include "drizzled/show.h"24#include "drizzled/show.h"
25#include "drizzled/handler.h"25#include "drizzled/handler.h"
26#include "drizzled/errmsg.h"
27#include "drizzled/authentication.h"
28#include "drizzled/qcache.h"
29#include "drizzled/scheduling.h"
30#include "drizzled/logging.h"
31#include "drizzled/replication_services.h"
3226
33#include <string>27#include <string>
34#include <vector>28#include <vector>
35#include <map>29#include <map>
3630
37using namespace std;31using namespace std;
38using namespace drizzled;
3932
33namespace drizzled
34{
4035
41plugin::Handle *plugin::Registry::find(const LEX_STRING *name)36plugin::Handle *plugin::Registry::find(const LEX_STRING *name)
42{37{
@@ -60,7 +55,7 @@
60}55}
6156
6257
63vector<plugin::Handle *> plugin::Registry::get_list(bool active)58vector<plugin::Handle *> plugin::Registry::getList(bool active)
64{59{
65 plugin::Handle *plugin= NULL;60 plugin::Handle *plugin= NULL;
6661
@@ -82,94 +77,4 @@
82 return plugins;77 return plugins;
83}78}
8479
85void plugin::Registry::add(StorageEngine *engine)80} /* namespace drizzled */
86{
87 add_storage_engine(engine);
88}
89
90void plugin::Registry::add(InfoSchemaTable *schema_table)
91{
92 add_infoschema_table(schema_table);
93}
94
95void plugin::Registry::add(Logging_handler *handler)
96{
97 add_logger(handler);
98}
99
100void plugin::Registry::add(Error_message_handler *handler)
101{
102 add_errmsg_handler(handler);
103}
104
105void plugin::Registry::add(Authentication *auth)
106{
107 add_authentication(auth);
108}
109
110void plugin::Registry::add(QueryCache *qcache)
111{
112 add_query_cache(qcache);
113}
114
115void plugin::Registry::add(plugin::SchedulerFactory *factory)
116{
117 add_scheduler_factory(factory);
118}
119
120
121void plugin::Registry::add(drizzled::plugin::CommandReplicator *replicator)
122{
123 add_replicator(replicator);
124}
125
126void plugin::Registry::add(drizzled::plugin::CommandApplier *applier)
127{
128 add_applier(applier);
129}
130
131void plugin::Registry::remove(StorageEngine *engine)
132{
133 remove_storage_engine(engine);
134}
135
136void plugin::Registry::remove(InfoSchemaTable *schema_table)
137{
138 remove_infoschema_table(schema_table);
139}
140
141void plugin::Registry::remove(Logging_handler *handler)
142{
143 remove_logger(handler);
144}
145
146void plugin::Registry::remove(Error_message_handler *handler)
147{
148 remove_errmsg_handler(handler);
149}
150
151void plugin::Registry::remove(Authentication *auth)
152{
153 remove_authentication(auth);
154}
155
156void plugin::Registry::remove(QueryCache *qcache)
157{
158 remove_query_cache(qcache);
159}
160
161void plugin::Registry::remove(plugin::SchedulerFactory *factory)
162{
163 remove_scheduler_factory(factory);
164}
165
166
167void plugin::Registry::remove(drizzled::plugin::CommandReplicator *replicator)
168{
169 remove_replicator(replicator);
170}
171
172void plugin::Registry::remove(drizzled::plugin::CommandApplier *applier)
173{
174 remove_applier(applier);
175}
17681
=== modified file 'drizzled/plugin/registry.h'
--- drizzled/plugin/registry.h 2009-09-16 20:04:11 +0000
+++ drizzled/plugin/registry.h 2009-09-30 21:30:30 +0000
@@ -20,28 +20,18 @@
20#ifndef DRIZZLED_PLUGIN_REGISTRY_H20#ifndef DRIZZLED_PLUGIN_REGISTRY_H
21#define DRIZZLED_PLUGIN_REGISTRY_H21#define DRIZZLED_PLUGIN_REGISTRY_H
2222
23#include "drizzled/slot/function.h"
24#include "drizzled/slot/listen.h"
25
26#include <string>23#include <string>
27#include <vector>24#include <vector>
28#include <map>25#include <map>
2926
30class StorageEngine;27#include "drizzled/gettext.h"
31class InfoSchemaTable;28#include "drizzled/unireg.h"
32class Logging_handler;
33class Error_message_handler;
34class Authentication;
35class QueryCache;
3629
37namespace drizzled30namespace drizzled
38{31{
39namespace plugin32namespace plugin
40{33{
41class CommandReplicator;
42class CommandApplier;
43class Handle;34class Handle;
44class SchedulerFactory;
4535
46class Registry36class Registry
47{37{
@@ -63,30 +53,34 @@
6353
64 void add(Handle *plugin);54 void add(Handle *plugin);
6555
66 std::vector<Handle *> get_list(bool active);56 std::vector<Handle *> getList(bool active);
6757
68 void add(StorageEngine *engine);58 template<class T>
69 void add(InfoSchemaTable *schema_table);59 void add(T *plugin)
70 void add(Logging_handler *handler);60 {
71 void add(Error_message_handler *handler);61 bool failed= T::addPlugin(plugin);
72 void add(Authentication *auth);62 if (failed)
73 void add(QueryCache *qcache);63 {
74 void add(SchedulerFactory *scheduler);64 /* Can't use errmsg_printf here because we might be initializing the
75 void add(drizzled::plugin::CommandReplicator *replicator);65 * error_message plugin.
76 void add(drizzled::plugin::CommandApplier *applier);66 */
7767 /**
78 void remove(StorageEngine *engine);68 * @TODO
79 void remove(InfoSchemaTable *schema_table);69 * Once plugin-base-class is merged, we'll add in this statment
80 void remove(Logging_handler *handler);70 * fprintf(stderr,
81 void remove(Error_message_handler *handler);71 * _("Fatal error: Failed initializing %s plugin."),
82 void remove(Authentication *auth);72 * plugin->getName().c_str());
83 void remove(QueryCache *qcache);73 */
84 void remove(SchedulerFactory *scheduler);74 unireg_abort(1);
85 void remove(drizzled::plugin::CommandReplicator *replicator);75 }
86 void remove(drizzled::plugin::CommandApplier *applier);76 }
8777
88 ::drizzled::slot::Function function;78 template<class T>
89 ::drizzled::slot::Listen listen;79 void remove(T *plugin)
80 {
81 T::removePlugin(plugin);
82 }
83
90};84};
9185
92} /* end namespace plugin */86} /* end namespace plugin */
9387
=== renamed file 'drizzled/scheduling.cc' => 'drizzled/plugin/scheduler.cc'
--- drizzled/scheduling.cc 2009-08-05 09:29:04 +0000
+++ drizzled/plugin/scheduler.cc 2009-09-30 21:30:30 +0000
@@ -17,19 +17,21 @@
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */18 */
1919
20#include <drizzled/server_includes.h>20#include "drizzled/server_includes.h"
21#include <drizzled/scheduling.h>21#include "drizzled/plugin/scheduler.h"
22#include <drizzled/gettext.h>
23#include "drizzled/plugin/registry.h"22#include "drizzled/plugin/registry.h"
24#include "drizzled/registry.h"23
24#include "drizzled/gettext.h"
2525
26using namespace std;26using namespace std;
27using namespace drizzled;27
28namespace drizzled
29{
2830
29plugin::SchedulerFactory *scheduler_factory= NULL;31plugin::SchedulerFactory *scheduler_factory= NULL;
30Registry<plugin::SchedulerFactory *> all_schedulers;32Registry<plugin::SchedulerFactory *> all_schedulers;
3133
32bool add_scheduler_factory(plugin::SchedulerFactory *factory)34bool plugin::SchedulerFactory::addPlugin(plugin::SchedulerFactory *factory)
33{35{
34 if (all_schedulers.count(factory->getName()) != 0)36 if (all_schedulers.count(factory->getName()) != 0)
35 {37 {
@@ -44,15 +46,14 @@
44}46}
4547
4648
47bool remove_scheduler_factory(plugin::SchedulerFactory *factory)49void plugin::SchedulerFactory::removePlugin(plugin::SchedulerFactory *factory)
48{50{
49 scheduler_factory= NULL;51 scheduler_factory= NULL;
50 all_schedulers.remove(factory);52 all_schedulers.remove(factory);
51 return false;
52}53}
5354
5455
55bool set_scheduler_factory(const string& name)56bool plugin::SchedulerFactory::setFactory(const string& name)
56{57{
57 58
58 plugin::SchedulerFactory *factory= all_schedulers.find(name);59 plugin::SchedulerFactory *factory= all_schedulers.find(name);
@@ -68,7 +69,7 @@
68 return false;69 return false;
69}70}
7071
71plugin::Scheduler *get_thread_scheduler()72plugin::Scheduler *plugin::SchedulerFactory::getScheduler()
72{73{
73 assert(scheduler_factory != NULL);74 assert(scheduler_factory != NULL);
74 plugin::Scheduler *sched= (*scheduler_factory)();75 plugin::Scheduler *sched= (*scheduler_factory)();
@@ -80,3 +81,4 @@
80 return sched;81 return sched;
81}82}
8283
84} /* namespace drizzled */
8385
=== modified file 'drizzled/plugin/scheduler.h'
--- drizzled/plugin/scheduler.h 2009-08-05 05:46:11 +0000
+++ drizzled/plugin/scheduler.h 2009-09-30 21:30:30 +0000
@@ -75,6 +75,12 @@
75 {75 {
76 aliases.push_back(alias);76 aliases.push_back(alias);
77 }77 }
78
79 static bool addPlugin(plugin::SchedulerFactory *factory);
80 static void removePlugin(plugin::SchedulerFactory *factory);
81 static bool setFactory(const std::string& name);
82 static plugin::Scheduler *getScheduler();
83
78};84};
7985
80} /* end namespace drizzled::plugin */86} /* end namespace drizzled::plugin */
8187
=== modified file 'drizzled/plugin/storage_engine.cc'
--- drizzled/plugin/storage_engine.cc 2009-08-19 23:35:29 +0000
+++ drizzled/plugin/storage_engine.cc 2009-09-30 21:30:30 +0000
@@ -18,6 +18,19 @@
18 */18 */
1919
20#include <drizzled/server_includes.h>20#include <drizzled/server_includes.h>
21
22#include CSTDINT_H
23#include <string>
24#include <vector>
25#include <algorithm>
26#include <functional>
27
28#include <google/protobuf/io/zero_copy_stream.h>
29#include <google/protobuf/io/zero_copy_stream_impl.h>
30
31#include "mysys/my_dir.h"
32#include "mysys/hash.h"
33
21#include <drizzled/definitions.h>34#include <drizzled/definitions.h>
22#include <drizzled/base.h>35#include <drizzled/base.h>
23#include <drizzled/handler.h>36#include <drizzled/handler.h>
@@ -28,37 +41,24 @@
28#include <drizzled/registry.h>41#include <drizzled/registry.h>
29#include <drizzled/unireg.h>42#include <drizzled/unireg.h>
30#include <drizzled/data_home.h>43#include <drizzled/data_home.h>
44#include "drizzled/errmsg_print.h"
31#include <drizzled/plugin/registry.h>45#include <drizzled/plugin/registry.h>
32#include <string>46#include "drizzled/xid.h"
3347
34#include <drizzled/table_proto.h>48#include <drizzled/table_proto.h>
3549
36#include <google/protobuf/io/zero_copy_stream.h>
37#include <google/protobuf/io/zero_copy_stream_impl.h>
38
39#include <mysys/my_dir.h>
40
41#include CSTDINT_H
42
43using namespace std;50using namespace std;
44using namespace drizzled;51
4552
46drizzled::Registry<StorageEngine *> all_engines;53namespace drizzled
4754{
48void add_storage_engine(StorageEngine *engine)55
49{56Registry<plugin::StorageEngine *> all_engines;
50 all_engines.add(engine);57
51}58plugin::StorageEngine::StorageEngine(const string name_arg,
5259 const bitset<HTON_BIT_SIZE> &flags_arg,
53void remove_storage_engine(StorageEngine *engine)60 size_t savepoint_offset_arg,
54{61 bool support_2pc)
55 all_engines.remove(engine);
56}
57
58StorageEngine::StorageEngine(const std::string name_arg,
59 const std::bitset<HTON_BIT_SIZE> &flags_arg,
60 size_t savepoint_offset_arg,
61 bool support_2pc)
62 : name(name_arg), two_phase_commit(support_2pc), enabled(true),62 : name(name_arg), two_phase_commit(support_2pc), enabled(true),
63 flags(flags_arg),63 flags(flags_arg),
64 savepoint_offset(savepoint_alloc_size),64 savepoint_offset(savepoint_alloc_size),
@@ -75,12 +75,12 @@
75}75}
7676
7777
78StorageEngine::~StorageEngine()78plugin::StorageEngine::~StorageEngine()
79{79{
80 savepoint_alloc_size-= orig_savepoint_offset;80 savepoint_alloc_size-= orig_savepoint_offset;
81}81}
8282
83void StorageEngine::setTransactionReadWrite(Session* session)83void plugin::StorageEngine::setTransactionReadWrite(Session* session)
84{84{
85 Ha_trx_info *ha_info= &session->ha_data[getSlot()].ha_info[0];85 Ha_trx_info *ha_info= &session->ha_data[getSlot()].ha_info[0];
86 /*86 /*
@@ -102,41 +102,113 @@
102}102}
103103
104104
105/**105
106 Return the default storage engine StorageEngine for thread106int plugin::StorageEngine::renameTableImplementation(Session *,
107107 const char *from,
108 @param ha_default_storage_engine(session)108 const char *to)
109 @param session current thread109{
110110 int error= 0;
111 @return111 for (const char **ext= bas_ext(); *ext ; ext++)
112 pointer to StorageEngine112 {
113*/113 if (rename_file_ext(from, to, *ext))
114StorageEngine *ha_default_storage_engine(Session *session)114 {
115{115 if ((error=my_errno) != ENOENT)
116 if (session->variables.storage_engine)116 break;
117 return session->variables.storage_engine;117 error= 0;
118 return global_system_variables.storage_engine;118 }
119}119 }
120120 return error;
121121}
122/**122
123 Return the storage engine StorageEngine for the supplied name123
124124/**
125 @param session current thread125 Delete all files with extension from bas_ext().
126 @param name name of storage engine126
127127 @param name Base name of table
128 @return128
129 pointer to storage engine plugin handle129 @note
130*/130 We assume that the handler may return more extensions than
131StorageEngine *ha_resolve_by_name(Session *session, std::string find_str)131 was actually used for the file.
132{132
133 @retval
134 0 If we successfully deleted at least one file from base_ext and
135 didn't get any other errors than ENOENT
136 @retval
137 !0 Error
138*/
139int plugin::StorageEngine::deleteTableImplementation(Session *,
140 const string table_path)
141{
142 int error= 0;
143 int enoent_or_zero= ENOENT; // Error if no file was deleted
144 char buff[FN_REFLEN];
145
146 for (const char **ext=bas_ext(); *ext ; ext++)
147 {
148 fn_format(buff, table_path.c_str(), "", *ext,
149 MY_UNPACK_FILENAME|MY_APPEND_EXT);
150 if (my_delete_with_symlink(buff, MYF(0)))
151 {
152 if ((error= my_errno) != ENOENT)
153 break;
154 }
155 else
156 enoent_or_zero= 0; // No error for ENOENT
157 error= enoent_or_zero;
158 }
159 return error;
160}
161
162const char *plugin::StorageEngine::checkLowercaseNames(const char *path,
163 char *tmp_path)
164{
165 if (flags.test(HTON_BIT_FILE_BASED))
166 return path;
167
168 /* Ensure that table handler get path in lower case */
169 if (tmp_path != path)
170 strcpy(tmp_path, path);
171
172 /*
173 we only should turn into lowercase database/table part
174 so start the process after homedirectory
175 */
176 if (strstr(tmp_path, drizzle_tmpdir) == tmp_path)
177 my_casedn_str(files_charset_info, tmp_path + strlen(drizzle_tmpdir));
178 else
179 my_casedn_str(files_charset_info, tmp_path + drizzle_data_home_len);
180
181 return tmp_path;
182}
183
184
185bool plugin::StorageEngine::addPlugin(plugin::StorageEngine *engine)
186{
187 if (all_engines.add(engine))
188 {
189 errmsg_printf(ERRMSG_LVL_ERROR,
190 _("Couldn't add StorageEngine"));
191 return true;
192 }
193 return false;
194}
195
196void plugin::StorageEngine::removePlugin(plugin::StorageEngine *engine)
197{
198 all_engines.remove(engine);
199}
200
201plugin::StorageEngine *plugin::StorageEngine::findByName(Session *session,
202 string find_str)
203{
204
133 transform(find_str.begin(), find_str.end(),205 transform(find_str.begin(), find_str.end(),
134 find_str.begin(), ::tolower);206 find_str.begin(), ::tolower);
135 string default_str("default");207 string default_str("default");
136 if (find_str == default_str)208 if (find_str == default_str)
137 return ha_default_storage_engine(session);209 return ha_default_storage_engine(session);
138210
139 StorageEngine *engine= all_engines.find(find_str);211 plugin::StorageEngine *engine= all_engines.find(find_str);
140212
141 if (engine && engine->is_user_selectable())213 if (engine && engine->is_user_selectable())
142 return engine;214 return engine;
@@ -144,28 +216,8 @@
144 return NULL;216 return NULL;
145}217}
146218
147
148handler *get_new_handler(TableShare *share, MEM_ROOT *alloc,
149 StorageEngine *engine)
150{
151 handler *file;
152
153 if (engine && engine->is_enabled())
154 {
155 if ((file= engine->create(share, alloc)))
156 file->init();
157 return(file);
158 }
159 /*
160 Try the default table type
161 Here the call to current_session() is ok as we call this function a lot of
162 times but we enter this branch very seldom.
163 */
164 return(get_new_handler(share, alloc, ha_default_storage_engine(current_session)));
165}
166
167class StorageEngineCloseConnection219class StorageEngineCloseConnection
168 : public unary_function<StorageEngine *, void>220 : public unary_function<plugin::StorageEngine *, void>
169{221{
170 Session *session;222 Session *session;
171public:223public:
@@ -186,28 +238,28 @@
186 @note238 @note
187 don't bother to rollback here, it's done already239 don't bother to rollback here, it's done already
188*/240*/
189void ha_close_connection(Session* session)241void plugin::StorageEngine::closeConnection(Session* session)
190{242{
191 for_each(all_engines.begin(), all_engines.end(),243 for_each(all_engines.begin(), all_engines.end(),
192 StorageEngineCloseConnection(session));244 StorageEngineCloseConnection(session));
193}245}
194246
195void ha_drop_database(char* path)247void plugin::StorageEngine::dropDatabase(char* path)
196{248{
197 for_each(all_engines.begin(), all_engines.end(),249 for_each(all_engines.begin(), all_engines.end(),
198 bind2nd(mem_fun(&StorageEngine::drop_database),path));250 bind2nd(mem_fun(&plugin::StorageEngine::drop_database),path));
199}251}
200252
201int ha_commit_or_rollback_by_xid(XID *xid, bool commit)253int plugin::StorageEngine::commitOrRollbackByXID(XID *xid, bool commit)
202{254{
203 vector<int> results;255 vector<int> results;
204 256
205 if (commit)257 if (commit)
206 transform(all_engines.begin(), all_engines.end(), results.begin(),258 transform(all_engines.begin(), all_engines.end(), results.begin(),
207 bind2nd(mem_fun(&StorageEngine::commit_by_xid),xid));259 bind2nd(mem_fun(&plugin::StorageEngine::commit_by_xid),xid));
208 else260 else
209 transform(all_engines.begin(), all_engines.end(), results.begin(),261 transform(all_engines.begin(), all_engines.end(), results.begin(),
210 bind2nd(mem_fun(&StorageEngine::rollback_by_xid),xid));262 bind2nd(mem_fun(&plugin::StorageEngine::rollback_by_xid),xid));
211263
212 if (find_if(results.begin(), results.end(), bind2nd(equal_to<int>(),0))264 if (find_if(results.begin(), results.end(), bind2nd(equal_to<int>(),0))
213 == results.end())265 == results.end())
@@ -215,7 +267,6 @@
215 return 0;267 return 0;
216}268}
217269
218
219/**270/**
220 @details271 @details
221 This function should be called when MySQL sends rows of a SELECT result set272 This function should be called when MySQL sends rows of a SELECT result set
@@ -234,20 +285,19 @@
234 @return285 @return
235 always 0286 always 0
236*/287*/
237int ha_release_temporary_latches(Session *session)288int plugin::StorageEngine::releaseTemporaryLatches(Session *session)
238{289{
239 for_each(all_engines.begin(), all_engines.end(),290 for_each(all_engines.begin(), all_engines.end(),
240 bind2nd(mem_fun(&StorageEngine::release_temporary_latches),session));291 bind2nd(mem_fun(&plugin::StorageEngine::release_temporary_latches),session));
241 return 0;292 return 0;
242}293}
243294
244295bool plugin::StorageEngine::flushLogs(plugin::StorageEngine *engine)
245bool ha_flush_logs(StorageEngine *engine)
246{296{
247 if (engine == NULL)297 if (engine == NULL)
248 {298 {
249 if (find_if(all_engines.begin(), all_engines.end(),299 if (find_if(all_engines.begin(), all_engines.end(),
250 mem_fun(&StorageEngine::flush_logs))300 mem_fun(&plugin::StorageEngine::flush_logs))
251 != all_engines.begin())301 != all_engines.begin())
252 return true;302 return true;
253 }303 }
@@ -276,7 +326,7 @@
276 in this case commit_list==0, tc_heuristic_recover == 0326 in this case commit_list==0, tc_heuristic_recover == 0
277 there should be no prepared transactions in this case.327 there should be no prepared transactions in this case.
278*/328*/
279class XARecover : unary_function<StorageEngine *, void>329class XARecover : unary_function<plugin::StorageEngine *, void>
280{330{
281 int trans_len, found_foreign_xids, found_my_xids;331 int trans_len, found_foreign_xids, found_my_xids;
282 bool result;332 bool result;
@@ -345,10 +395,9 @@
345 }395 }
346 }396 }
347 }397 }
348
349};398};
350399
351int ha_recover(HASH *commit_list)400int plugin::StorageEngine::recover(HASH *commit_list)
352{401{
353 XID *trans_list= NULL;402 XID *trans_list= NULL;
354 int trans_len= 0;403 int trans_len= 0;
@@ -414,13 +463,36 @@
414 return(0);463 return(0);
415}464}
416465
417int ha_start_consistent_snapshot(Session *session)466int plugin::StorageEngine::startConsistentSnapshot(Session *session)
418{467{
419 for_each(all_engines.begin(), all_engines.end(),468 for_each(all_engines.begin(), all_engines.end(),
420 bind2nd(mem_fun(&StorageEngine::start_consistent_snapshot),session));469 bind2nd(mem_fun(&plugin::StorageEngine::start_consistent_snapshot),
470 session));
421 return 0;471 return 0;
422}472}
423473
474class StorageEngineGetTableProto: public unary_function<plugin::StorageEngine *,bool>
475{
476 const char* path;
477 message::Table *table_proto;
478 int *err;
479public:
480 StorageEngineGetTableProto(const char* path_arg,
481 message::Table *table_proto_arg,
482 int *err_arg)
483 :path(path_arg), table_proto(table_proto_arg), err(err_arg) {}
484
485 result_type operator() (argument_type engine)
486 {
487 int ret= engine->getTableProtoImplementation(path, table_proto);
488
489 if (ret != ENOENT)
490 *err= ret;
491
492 return *err == EEXIST;
493 }
494};
495
424static int drizzle_read_table_proto(const char* path, message::Table* table)496static int drizzle_read_table_proto(const char* path, message::Table* table)
425{497{
426 int fd= open(path, O_RDONLY);498 int fd= open(path, O_RDONLY);
@@ -443,39 +515,17 @@
443 return 0;515 return 0;
444}516}
445517
446class StorageEngineGetTableProto: public unary_function<StorageEngine *,bool>
447{
448 const char* path;
449 message::Table *table_proto;
450 int *err;
451public:
452 StorageEngineGetTableProto(const char* path_arg,
453 message::Table *table_proto_arg,
454 int *err_arg)
455 :path(path_arg), table_proto(table_proto_arg), err(err_arg) {}
456
457 result_type operator() (argument_type engine)
458 {
459 int ret= engine->getTableProtoImplementation(path, table_proto);
460
461 if (ret != ENOENT)
462 *err= ret;
463
464 return *err == EEXIST;
465 }
466};
467
468/**518/**
469 Call this function in order to give the handler the possiblity519 Call this function in order to give the handler the possiblity
470 to ask engine if there are any new tables that should be written to disk520 to ask engine if there are any new tables that should be written to disk
471 or any dropped tables that need to be removed from disk521 or any dropped tables that need to be removed from disk
472*/522*/
473int StorageEngine::getTableProto(const char* path,523int plugin::StorageEngine::getTableProto(const char* path,
474 message::Table *table_proto)524 message::Table *table_proto)
475{525{
476 int err= ENOENT;526 int err= ENOENT;
477527
478 drizzled::Registry<StorageEngine *>::iterator iter=528 ::drizzled::Registry<plugin::StorageEngine *>::iterator iter=
479 find_if(all_engines.begin(), all_engines.end(),529 find_if(all_engines.begin(), all_engines.end(),
480 StorageEngineGetTableProto(path, table_proto, &err));530 StorageEngineGetTableProto(path, table_proto, &err));
481 if (iter == all_engines.end())531 if (iter == all_engines.end())
@@ -504,60 +554,6 @@
504 return err;554 return err;
505}555}
506556
507
508int StorageEngine::renameTableImplementation(Session *, const char *from, const char *to)
509{
510 int error= 0;
511 for (const char **ext= bas_ext(); *ext ; ext++)
512 {
513 if (rename_file_ext(from, to, *ext))
514 {
515 if ((error=my_errno) != ENOENT)
516 break;
517 error= 0;
518 }
519 }
520 return error;
521}
522
523
524/**
525 Delete all files with extension from bas_ext().
526
527 @param name Base name of table
528
529 @note
530 We assume that the handler may return more extensions than
531 was actually used for the file.
532
533 @retval
534 0 If we successfully deleted at least one file from base_ext and
535 didn't get any other errors than ENOENT
536 @retval
537 !0 Error
538*/
539int StorageEngine::deleteTableImplementation(Session *, const std::string table_path)
540{
541 int error= 0;
542 int enoent_or_zero= ENOENT; // Error if no file was deleted
543 char buff[FN_REFLEN];
544
545 for (const char **ext=bas_ext(); *ext ; ext++)
546 {
547 fn_format(buff, table_path.c_str(), "", *ext,
548 MY_UNPACK_FILENAME|MY_APPEND_EXT);
549 if (my_delete_with_symlink(buff, MYF(0)))
550 {
551 if ((error= my_errno) != ENOENT)
552 break;
553 }
554 else
555 enoent_or_zero= 0; // No error for ENOENT
556 error= enoent_or_zero;
557 }
558 return error;
559}
560
561/**557/**
562 An interceptor to hijack the text of the error message without558 An interceptor to hijack the text of the error message without
563 setting an error in the thread. We need the text to present it559 setting an error in the thread. We need the text to present it
@@ -590,7 +586,7 @@
590586
591587
592class DeleteTableStorageEngine588class DeleteTableStorageEngine
593 : public unary_function<StorageEngine *, void>589 : public unary_function<plugin::StorageEngine *, void>
594{590{
595 Session *session;591 Session *session;
596 const char *path;592 const char *path;
@@ -621,7 +617,7 @@
621 return;617 return;
622618
623 path= engine->checkLowercaseNames(path, tmp_path);619 path= engine->checkLowercaseNames(path, tmp_path);
624 const std::string table_path(path);620 const string table_path(path);
625 int tmp_error= engine->deleteTable(session, table_path);621 int tmp_error= engine->deleteTable(session, table_path);
626622
627 if (tmp_error != ENOENT)623 if (tmp_error != ENOENT)
@@ -647,12 +643,14 @@
647 }643 }
648};644};
649645
646
650/**647/**
651 This should return ENOENT if the file doesn't exists.648 This should return ENOENT if the file doesn't exists.
652 The .frm file will be deleted only if we return 0 or ENOENT649 The .frm file will be deleted only if we return 0 or ENOENT
653*/650*/
654int ha_delete_table(Session *session, const char *path,651int plugin::StorageEngine::deleteTable(Session *session, const char *path,
655 const char *db, const char *alias, bool generate_warning)652 const char *db, const char *alias,
653 bool generate_warning)
656{654{
657 TableShare dummy_share;655 TableShare dummy_share;
658 Table dummy_table;656 Table dummy_table;
@@ -689,7 +687,6 @@
689 dummy_share.table_name.length= strlen(alias);687 dummy_share.table_name.length= strlen(alias);
690 dummy_table.alias= alias;688 dummy_table.alias= alias;
691689
692
693 if(file != NULL)690 if(file != NULL)
694 {691 {
695 file->change_table_ptr(&dummy_table, &dummy_share);692 file->change_table_ptr(&dummy_table, &dummy_share);
@@ -716,101 +713,22 @@
716 return error;713 return error;
717}714}
718715
719/**716class DFETableNameIterator: public plugin::TableNameIteratorImplementation
720 Initiates table-file and calls appropriate database-creator.
721
722 @retval
723 0 ok
724 @retval
725 1 error
726*/
727int ha_create_table(Session *session, const char *path,
728 const char *db, const char *table_name,
729 HA_CREATE_INFO *create_info,
730 bool update_create_info,
731 message::Table *table_proto)
732{
733 int error= 1;
734 Table table;
735 TableShare share(db, 0, table_name, path);
736 message::Table tmp_proto;
737
738 if (table_proto)
739 {
740 if (parse_table_proto(session, *table_proto, &share))
741 goto err;
742 }
743 else
744 {
745 table_proto= &tmp_proto;
746 if (open_table_def(session, &share))
747 goto err;
748 }
749
750 if (open_table_from_share(session, &share, "", 0, (uint32_t) READ_ALL, 0,
751 &table, OTM_CREATE))
752 goto err;
753
754 if (update_create_info)
755 table.updateCreateInfo(create_info, table_proto);
756
757 error= share.storage_engine->createTable(session, path, &table,
758 create_info, table_proto);
759 table.closefrm(false);
760 if (error)
761 {
762 char name_buff[FN_REFLEN];
763 sprintf(name_buff,"%s.%s",db,table_name);
764 my_error(ER_CANT_CREATE_TABLE, MYF(ME_BELL+ME_WAITTANG), name_buff, error);
765 }
766err:
767 share.free_table_share();
768 return(error != 0);
769}
770
771
772const string ha_resolve_storage_engine_name(const StorageEngine *engine)
773{
774 return engine == NULL ? string("UNKNOWN") : engine->getName();
775}
776
777const char *StorageEngine::checkLowercaseNames(const char *path, char *tmp_path)
778{
779 if (flags.test(HTON_BIT_FILE_BASED))
780 return path;
781
782 /* Ensure that table handler get path in lower case */
783 if (tmp_path != path)
784 strcpy(tmp_path, path);
785
786 /*
787 we only should turn into lowercase database/table part
788 so start the process after homedirectory
789 */
790 if (strstr(tmp_path, drizzle_tmpdir) == tmp_path)
791 my_casedn_str(files_charset_info, tmp_path + strlen(drizzle_tmpdir));
792 else
793 my_casedn_str(files_charset_info, tmp_path + drizzle_data_home_len);
794
795 return tmp_path;
796}
797
798class DFETableNameIterator: public TableNameIteratorImplementation
799{717{
800private:718private:
801 MY_DIR *dirp;719 MY_DIR *dirp;
802 uint32_t current_entry;720 uint32_t current_entry;
803721
804public:722public:
805 DFETableNameIterator(const std::string &database)723 DFETableNameIterator(const string &database)
806 : TableNameIteratorImplementation(database),724 : plugin::TableNameIteratorImplementation(database),
807 dirp(NULL),725 dirp(NULL),
808 current_entry(-1)726 current_entry(-1)
809 {};727 {};
810728
811 ~DFETableNameIterator();729 ~DFETableNameIterator();
812730
813 int next(std::string *name);731 int next(string *name);
814732
815};733};
816734
@@ -880,33 +798,36 @@
880 }798 }
881}799}
882800
883TableNameIterator::TableNameIterator(const std::string &db)801
802plugin::TableNameIterator::TableNameIterator(const string &db)
884 : current_implementation(NULL), database(db)803 : current_implementation(NULL), database(db)
885{804{
886 engine_iter= all_engines.begin();805 engine_iter= all_engines.begin();
887 default_implementation= new DFETableNameIterator(database);806 default_implementation= new DFETableNameIterator(database);
888}807}
889808
890TableNameIterator::~TableNameIterator()809plugin::TableNameIterator::~TableNameIterator()
891{810{
892 delete current_implementation;811 delete current_implementation;
893}812}
894813
895int TableNameIterator::next(std::string *name)814int plugin::TableNameIterator::next(string *name)
896{815{
897 int err= 0;816 int err= 0;
898817
899next:818next:
900 if (current_implementation == NULL)819 if (current_implementation == NULL)
901 {820 {
902 while(current_implementation == NULL && engine_iter != all_engines.end())821 while(current_implementation == NULL &&
822 (engine_iter != all_engines.end()))
903 {823 {
904 StorageEngine *engine= *engine_iter;824 plugin::StorageEngine *engine= *engine_iter;
905 current_implementation= engine->tableNameIterator(database);825 current_implementation= engine->tableNameIterator(database);
906 engine_iter++;826 engine_iter++;
907 }827 }
908828
909 if (current_implementation == NULL && engine_iter == all_engines.end())829 if (current_implementation == NULL &&
830 (engine_iter == all_engines.end()))
910 {831 {
911 current_implementation= default_implementation;832 current_implementation= default_implementation;
912 }833 }
@@ -927,3 +848,96 @@
927 return err;848 return err;
928}849}
929850
851
852} /* namespace drizzled */
853
854
855
856handler *get_new_handler(TableShare *share, MEM_ROOT *alloc,
857 drizzled::plugin::StorageEngine *engine)
858{
859 handler *file;
860
861 if (engine && engine->is_enabled())
862 {
863 if ((file= engine->create(share, alloc)))
864 file->init();
865 return(file);
866 }
867 /*
868 Try the default table type
869 Here the call to current_session() is ok as we call this function a lot of
870 times but we enter this branch very seldom.
871 */
872 return(get_new_handler(share, alloc, ha_default_storage_engine(current_session)));
873}
874
875
876/**
877 Return the default storage engine plugin::StorageEngine for thread
878
879 @param ha_default_storage_engine(session)
880 @param session current thread
881
882 @return
883 pointer to plugin::StorageEngine
884*/
885drizzled::plugin::StorageEngine *ha_default_storage_engine(Session *session)
886{
887 if (session->variables.storage_engine)
888 return session->variables.storage_engine;
889 return global_system_variables.storage_engine;
890}
891
892/**
893 Initiates table-file and calls appropriate database-creator.
894
895 @retval
896 0 ok
897 @retval
898 1 error
899*/
900int ha_create_table(Session *session, const char *path,
901 const char *db, const char *table_name,
902 HA_CREATE_INFO *create_info,
903 bool update_create_info,
904 drizzled::message::Table *table_proto)
905{
906 int error= 1;
907 Table table;
908 TableShare share(db, 0, table_name, path);
909 drizzled::message::Table tmp_proto;
910
911 if (table_proto)
912 {
913 if (parse_table_proto(session, *table_proto, &share))
914 goto err;
915 }
916 else
917 {
918 table_proto= &tmp_proto;
919 if (open_table_def(session, &share))
920 goto err;
921 }
922
923 if (open_table_from_share(session, &share, "", 0, (uint32_t) READ_ALL, 0,
924 &table, OTM_CREATE))
925 goto err;
926
927 if (update_create_info)
928 table.updateCreateInfo(create_info, table_proto);
929
930 error= share.storage_engine->createTable(session, path, &table,
931 create_info, table_proto);
932 table.closefrm(false);
933 if (error)
934 {
935 char name_buff[FN_REFLEN];
936 sprintf(name_buff,"%s.%s",db,table_name);
937 my_error(ER_CANT_CREATE_TABLE, MYF(ME_BELL+ME_WAITTANG), name_buff, error);
938 }
939err:
940 share.free_table_share();
941 return(error != 0);
942}
943
930944
=== modified file 'drizzled/plugin/storage_engine.h'
--- drizzled/plugin/storage_engine.h 2009-08-22 02:06:02 +0000
+++ drizzled/plugin/storage_engine.h 2009-09-30 21:30:30 +0000
@@ -22,7 +22,7 @@
2222
2323
24#include <drizzled/definitions.h>24#include <drizzled/definitions.h>
25#include <drizzled/sql_plugin.h>25#include <drizzled/plugin.h>
26#include <drizzled/handler_structs.h>26#include <drizzled/handler_structs.h>
27#include <drizzled/message/table.pb.h>27#include <drizzled/message/table.pb.h>
28#include <drizzled/registry.h>28#include <drizzled/registry.h>
@@ -41,7 +41,6 @@
41typedef bool (stat_print_fn)(Session *session, const char *type, uint32_t type_len,41typedef bool (stat_print_fn)(Session *session, const char *type, uint32_t type_len,
42 const char *file, uint32_t file_len,42 const char *file, uint32_t file_len,
43 const char *status, uint32_t status_len);43 const char *status, uint32_t status_len);
44enum ha_stat_type { HA_ENGINE_STATUS, HA_ENGINE_LOGS, HA_ENGINE_MUTEX };
4544
46/* Possible flags of a StorageEngine (there can be 32 of them) */45/* Possible flags of a StorageEngine (there can be 32 of them) */
47enum engine_flag_bits {46enum engine_flag_bits {
@@ -69,8 +68,15 @@
69static const std::bitset<HTON_BIT_SIZE> HTON_HAS_DATA_DICTIONARY(1 << HTON_BIT_HAS_DATA_DICTIONARY);68static const std::bitset<HTON_BIT_SIZE> HTON_HAS_DATA_DICTIONARY(1 << HTON_BIT_HAS_DATA_DICTIONARY);
7069
71class Table;70class Table;
71
72namespace drizzled
73{
74namespace plugin
75{
76
77const std::string UNKNOWN_STRING("UNKNOWN");
78
72class TableNameIteratorImplementation;79class TableNameIteratorImplementation;
73
74/*80/*
75 StorageEngine is a singleton structure - one instance per storage engine -81 StorageEngine is a singleton structure - one instance per storage engine -
76 to provide access to storage engine functionality that works on the82 to provide access to storage engine functionality that works on the
@@ -128,9 +134,6 @@
128134
129 virtual ~StorageEngine();135 virtual ~StorageEngine();
130136
131 static int getTableProto(const char* path,
132 drizzled::message::Table *table_proto);
133
134 virtual int getTableProtoImplementation(const char* path,137 virtual int getTableProtoImplementation(const char* path,
135 drizzled::message::Table *table_proto)138 drizzled::message::Table *table_proto)
136 {139 {
@@ -187,7 +190,7 @@
187 void enable() { enabled= true; }190 void enable() { enabled= true; }
188 void disable() { enabled= false; }191 void disable() { enabled= false; }
189192
190 std::string getName() const { return name; }193 const std::string &getName() const { return name; }
191194
192 /*195 /*
193 StorageEngine methods:196 StorageEngine methods:
@@ -325,6 +328,29 @@
325 (void)database;328 (void)database;
326 return NULL;329 return NULL;
327 }330 }
331
332
333 static bool addPlugin(plugin::StorageEngine *engine);
334 static void removePlugin(plugin::StorageEngine *engine);
335
336 static int getTableProto(const char* path, message::Table *table_proto);
337
338 static plugin::StorageEngine *findByName(Session *session,
339 std::string find_str);
340 static void closeConnection(Session* session);
341 static void dropDatabase(char* path);
342 static int commitOrRollbackByXID(XID *xid, bool commit);
343 static int releaseTemporaryLatches(Session *session);
344 static bool flushLogs(plugin::StorageEngine *db_type);
345 static int recover(HASH *commit_list);
346 static int startConsistentSnapshot(Session *session);
347 static int deleteTable(Session *session, const char *path, const char *db,
348 const char *alias, bool generate_warning);
349 static inline const std::string &resolveName(const StorageEngine *engine)
350 {
351 return engine == NULL ? UNKNOWN_STRING : engine->getName();
352 }
353
328};354};
329355
330class TableNameIteratorImplementation356class TableNameIteratorImplementation
@@ -343,9 +369,9 @@
343class TableNameIterator369class TableNameIterator
344{370{
345private:371private:
346 drizzled::Registry<StorageEngine *>::iterator engine_iter;372 ::drizzled::Registry<plugin::StorageEngine *>::iterator engine_iter;
347 TableNameIteratorImplementation *current_implementation;373 plugin::TableNameIteratorImplementation *current_implementation;
348 TableNameIteratorImplementation *default_implementation;374 plugin::TableNameIteratorImplementation *default_implementation;
349 std::string database;375 std::string database;
350public:376public:
351 TableNameIterator(const std::string &db);377 TableNameIterator(const std::string &db);
@@ -354,12 +380,71 @@
354 int next(std::string *name);380 int next(std::string *name);
355};381};
356382
383
384} /* namespace plugin */
385} /* namespace drizzled */
386
357/* lookups */387/* lookups */
358StorageEngine *ha_default_storage_engine(Session *session);388/**
359StorageEngine *ha_resolve_by_name(Session *session, std::string find_str);389 Return the default storage engine plugin::StorageEngine for thread
390
391 @param ha_default_storage_engine(session)
392 @param session current thread
393
394 @return
395 pointer to plugin::StorageEngine
396*/
397drizzled::plugin::StorageEngine *ha_default_storage_engine(Session *session);
360398
361handler *get_new_handler(TableShare *share, MEM_ROOT *alloc,399handler *get_new_handler(TableShare *share, MEM_ROOT *alloc,
362 StorageEngine *db_type);400 drizzled::plugin::StorageEngine *db_type);
363const std::string ha_resolve_storage_engine_name(const StorageEngine *db_type);401
402
403
404/** @TODO remove each of the following convenience naming methods */
405
406static inline void ha_close_connection(Session *session)
407{
408 drizzled::plugin::StorageEngine::closeConnection(session);
409}
410
411static inline void ha_drop_database(char* path)
412{
413 drizzled::plugin::StorageEngine::dropDatabase(path);
414}
415
416static inline int ha_commit_or_rollback_by_xid(XID *xid, bool commit)
417{
418 return drizzled::plugin::StorageEngine::commitOrRollbackByXID(xid, commit);
419}
420
421/* report to InnoDB that control passes to the client */
422static inline int ha_release_temporary_latches(Session *session)
423{
424 return drizzled::plugin::StorageEngine::releaseTemporaryLatches(session);
425}
426
427static inline bool ha_flush_logs(drizzled::plugin::StorageEngine *engine)
428{
429 return drizzled::plugin::StorageEngine::flushLogs(engine);
430}
431
432static inline int ha_recover(HASH *commit_list)
433{
434 return drizzled::plugin::StorageEngine::recover(commit_list);
435}
436
437static inline int ha_start_consistent_snapshot(Session *session)
438{
439 return drizzled::plugin::StorageEngine::startConsistentSnapshot(session);
440}
441
442static inline int ha_delete_table(Session *session, const char *path,
443 const char *db, const char *alias, bool generate_warning)
444{
445 return drizzled::plugin::StorageEngine::deleteTable(session, path, db,
446 alias, generate_warning);
447}
448
364449
365#endif /* DRIZZLED_PLUGIN_STORAGE_ENGINE_H */450#endif /* DRIZZLED_PLUGIN_STORAGE_ENGINE_H */
366451
=== removed file 'drizzled/qcache.h'
--- drizzled/qcache.h 2009-07-07 09:06:29 +0000
+++ drizzled/qcache.h 1970-01-01 00:00:00 +0000
@@ -1,40 +0,0 @@
1/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *
4 * Copyright (C) 2008 Sun Microsystems
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#ifndef DRIZZLED_QCACHE_H
21#define DRIZZLED_QCACHE_H
22
23#include <drizzled/plugin/qcache.h>
24
25void add_query_cache(QueryCache *handler);
26void remove_query_cache(QueryCache *handler);
27
28namespace drizzled {
29namespace query_cache {
30/* These are the functions called by the rest of the Drizzle server */
31bool try_fetch_and_send(Session *session, bool transactional);
32bool set(Session *session, bool transactional);
33bool invalidate_table(Session *session, bool transactional);
34bool invalidate_db(Session *session, const char *db_name,
35 bool transactional);
36bool flush(Session *session);
37}
38}
39
40#endif /* DRIZZLED_QCACHE_H */
410
=== modified file 'drizzled/registry.h'
--- drizzled/registry.h 2009-08-17 20:54:05 +0000
+++ drizzled/registry.h 2009-09-30 21:30:30 +0000
@@ -23,6 +23,7 @@
23#include <map>23#include <map>
24#include <set>24#include <set>
25#include <string>25#include <string>
26#include <vector>
26#include <algorithm>27#include <algorithm>
27#include <functional>28#include <functional>
2829
2930
=== modified file 'drizzled/replication_services.cc'
--- drizzled/replication_services.cc 2009-09-16 17:10:18 +0000
+++ drizzled/replication_services.cc 2009-09-30 21:30:30 +0000
@@ -49,35 +49,12 @@
49#include "drizzled/message/table.pb.h"49#include "drizzled/message/table.pb.h"
50#include "drizzled/gettext.h"50#include "drizzled/gettext.h"
51#include "drizzled/session.h"51#include "drizzled/session.h"
52#include "drizzled/plugin/registry.h"
5352
54#include <vector>53#include <vector>
5554
56using namespace std;55using namespace std;
57using namespace drizzled;56using namespace drizzled;
5857
59ReplicationServices replication_services;
60
61void add_replicator(plugin::CommandReplicator *replicator)
62{
63 replication_services.attachReplicator(replicator);
64}
65
66void remove_replicator(plugin::CommandReplicator *replicator)
67{
68 replication_services.detachReplicator(replicator);
69}
70
71void add_applier(plugin::CommandApplier *applier)
72{
73 replication_services.attachApplier(applier);
74}
75
76void remove_applier(plugin::CommandApplier *applier)
77{
78 replication_services.detachApplier(applier);
79}
80
81ReplicationServices::ReplicationServices()58ReplicationServices::ReplicationServices()
82{59{
83 is_active= false;60 is_active= false;
8461
=== modified file 'drizzled/replication_services.h'
--- drizzled/replication_services.h 2009-07-29 09:19:15 +0000
+++ drizzled/replication_services.h 2009-09-30 21:30:30 +0000
@@ -42,21 +42,13 @@
42 {42 {
43 class Command;43 class Command;
44 }44 }
45}45
46
47void add_replicator(drizzled::plugin::CommandReplicator *replicator);
48void remove_replicator(drizzled::plugin::CommandReplicator *replicator);
49
50void add_applier(drizzled::plugin::CommandApplier *applier);
51void remove_applier(drizzled::plugin::CommandApplier *applier);
5246
53/**47/**
54 * This is a class which manages transforming internal 48 * This is a class which manages transforming internal
55 * transactional events into GPB messages and sending those49 * transactional events into GPB messages and sending those
56 * events out through registered replicators and appliers.50 * events out through registered replicators and appliers.
57 */51 */
58namespace drizzled
59{
60class ReplicationServices52class ReplicationServices
61{53{
62public:54public:
@@ -103,6 +95,17 @@
103 * Constructor95 * Constructor
104 */96 */
105 ReplicationServices();97 ReplicationServices();
98
99 /**
100 * Singleton method
101 * Returns the singleton instance of ReplicationServices
102 */
103 static inline ReplicationServices &singleton()
104 {
105 static ReplicationServices replication_services;
106 return replication_services;
107 }
108
106 /**109 /**
107 * Returns whether the ReplicationServices object110 * Returns whether the ReplicationServices object
108 * is active. In other words, does it have both111 * is active. In other words, does it have both
109112
=== removed file 'drizzled/scheduling.h'
--- drizzled/scheduling.h 2009-08-04 22:16:30 +0000
+++ drizzled/scheduling.h 1970-01-01 00:00:00 +0000
@@ -1,32 +0,0 @@
1/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *
4 * Copyright (C) 2008 Sun Microsystems
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#ifndef DRIZZLED_SCHEDULING_H
21#define DRIZZLED_SCHEDULING_H
22
23#include <drizzled/plugin/scheduler.h>
24
25#include <string>
26
27drizzled::plugin::Scheduler *get_thread_scheduler();
28bool add_scheduler_factory(drizzled::plugin::SchedulerFactory *scheduler);
29bool remove_scheduler_factory(drizzled::plugin::SchedulerFactory *scheduler);
30bool set_scheduler_factory(const std::string& name);
31
32#endif /* DRIZZLED_SCHEDULING_H */
330
=== modified file 'drizzled/server_includes.h'
--- drizzled/server_includes.h 2009-09-22 07:35:28 +0000
+++ drizzled/server_includes.h 2009-09-30 21:30:30 +0000
@@ -37,8 +37,6 @@
37/* Custom C string functions */37/* Custom C string functions */
38#include <mystrings/m_string.h>38#include <mystrings/m_string.h>
3939
40/* The <strong>INTERNAL</strong> plugin API - not the external, or public, server plugin API */
41#include <drizzled/sql_plugin.h>
42/* Range optimization API/library */40/* Range optimization API/library */
43#include <drizzled/opt_range.h>41#include <drizzled/opt_range.h>
44/* Routines for dropping, repairing, checking schema tables */42/* Routines for dropping, repairing, checking schema tables */
@@ -150,8 +148,8 @@
150extern struct my_option my_long_options[];148extern struct my_option my_long_options[];
151extern std::bitset<5> sql_command_flags[];149extern std::bitset<5> sql_command_flags[];
152150
153extern StorageEngine *myisam_engine;151extern drizzled::plugin::StorageEngine *myisam_engine;
154extern StorageEngine *heap_engine;152extern drizzled::plugin::StorageEngine *heap_engine;
155153
156extern SHOW_COMP_OPTION have_symlink;154extern SHOW_COMP_OPTION have_symlink;
157155
158156
=== renamed directory 'drizzled/slot' => 'drizzled/service'
=== modified file 'drizzled/session.cc'
--- drizzled/session.cc 2009-09-26 02:16:50 +0000
+++ drizzled/session.cc 2009-09-30 21:30:30 +0000
@@ -36,8 +36,9 @@
36#include <drizzled/item/return_int.h>36#include <drizzled/item/return_int.h>
37#include <drizzled/item/empty_string.h>37#include <drizzled/item/empty_string.h>
38#include <drizzled/show.h>38#include <drizzled/show.h>
39#include <drizzled/scheduling.h>
40#include <drizzled/plugin/client.h>39#include <drizzled/plugin/client.h>
40#include "drizzled/plugin/scheduler.h"
41#include "drizzled/plugin/authentication.h"
41#include "drizzled/probes.h"42#include "drizzled/probes.h"
4243
43#include <algorithm>44#include <algorithm>
@@ -144,7 +145,7 @@
144}145}
145146
146extern "C"147extern "C"
147void **session_ha_data(const Session *session, const struct StorageEngine *engine)148void **session_ha_data(const Session *session, const plugin::StorageEngine *engine)
148{149{
149 return (void **) &session->ha_data[engine->slot].ha_ptr;150 return (void **) &session->ha_data[engine->slot].ha_ptr;
150}151}
@@ -608,7 +609,7 @@
608609
609bool Session::schedule()610bool Session::schedule()
610{611{
611 scheduler= get_thread_scheduler();612 scheduler= plugin::SchedulerFactory::getScheduler();
612613
613 ++connection_count;614 ++connection_count;
614615
@@ -670,7 +671,7 @@
670 return false;671 return false;
671 }672 }
672673
673 is_authenticated= authenticate_user(this, passwd);674 is_authenticated= plugin::Authentication::isAuthenticated(this, passwd);
674675
675 if (is_authenticated != true)676 if (is_authenticated != true)
676 {677 {
@@ -1925,7 +1926,7 @@
19251926
1926void Session::close_temporary(Table *table, bool free_share, bool delete_table)1927void Session::close_temporary(Table *table, bool free_share, bool delete_table)
1927{1928{
1928 StorageEngine *table_type= table->s->db_type();1929 plugin::StorageEngine *table_type= table->s->db_type();
19291930
1930 table->free_io_cache();1931 table->free_io_cache();
1931 table->closefrm(false);1932 table->closefrm(false);
@@ -2151,7 +2152,7 @@
2151 return false;2152 return false;
2152}2153}
21532154
2154bool Session::rm_temporary_table(StorageEngine *base, char *path)2155bool Session::rm_temporary_table(plugin::StorageEngine *base, char *path)
2155{2156{
2156 bool error=0;2157 bool error=0;
21572158
21582159
=== modified file 'drizzled/session.h'
--- drizzled/session.h 2009-09-26 02:16:50 +0000
+++ drizzled/session.h 2009-09-30 21:30:30 +0000
@@ -23,7 +23,7 @@
2323
24/* Classes in mysql */24/* Classes in mysql */
2525
26#include <drizzled/sql_plugin.h>26#include "drizzled/plugin.h"
27#include <drizzled/sql_locale.h>27#include <drizzled/sql_locale.h>
28#include <drizzled/ha_trx_info.h>28#include <drizzled/ha_trx_info.h>
29#include <mysys/my_alloc.h>29#include <mysys/my_alloc.h>
@@ -33,7 +33,6 @@
33#include <drizzled/sql_error.h>33#include <drizzled/sql_error.h>
34#include <drizzled/file_exchange.h>34#include <drizzled/file_exchange.h>
35#include <drizzled/select_result_interceptor.h>35#include <drizzled/select_result_interceptor.h>
36#include <drizzled/authentication.h>
37#include <drizzled/db.h>36#include <drizzled/db.h>
38#include <drizzled/xid.h>37#include <drizzled/xid.h>
3938
@@ -170,7 +169,7 @@
170 /* TODO: change this to my_thread_id - but have to fix set_var first */169 /* TODO: change this to my_thread_id - but have to fix set_var first */
171 uint64_t pseudo_thread_id;170 uint64_t pseudo_thread_id;
172171
173 StorageEngine *storage_engine;172 drizzled::plugin::StorageEngine *storage_engine;
174173
175 /* Only charset part of these variables is sensible */174 /* Only charset part of these variables is sensible */
176 const CHARSET_INFO *character_set_filesystem;175 const CHARSET_INFO *character_set_filesystem;
@@ -1410,7 +1409,7 @@
1410 void close_temporary_table(Table *table, bool free_share, bool delete_table);1409 void close_temporary_table(Table *table, bool free_share, bool delete_table);
1411 void close_temporary(Table *table, bool free_share, bool delete_table);1410 void close_temporary(Table *table, bool free_share, bool delete_table);
1412 int drop_temporary_table(TableList *table_list);1411 int drop_temporary_table(TableList *table_list);
1413 bool rm_temporary_table(StorageEngine *base, char *path);1412 bool rm_temporary_table(drizzled::plugin::StorageEngine *base, char *path);
1414 Table *open_temporary_table(const char *path, const char *db,1413 Table *open_temporary_table(const char *path, const char *db,
1415 const char *table_name, bool link_in_list,1414 const char *table_name, bool link_in_list,
1416 open_table_mode open_mode);1415 open_table_mode open_mode);
14171416
=== modified file 'drizzled/set_var.cc'
--- drizzled/set_var.cc 2009-09-15 02:21:15 +0000
+++ drizzled/set_var.cc 2009-09-30 21:30:30 +0000
@@ -57,13 +57,14 @@
57#include <drizzled/item/uint.h>57#include <drizzled/item/uint.h>
58#include <drizzled/item/null.h>58#include <drizzled/item/null.h>
59#include <drizzled/item/float.h>59#include <drizzled/item/float.h>
60#include <drizzled/sql_plugin.h>60#include <drizzled/plugin.h>
6161
62#include "drizzled/registry.h"62#include "drizzled/registry.h"
63#include <map>63#include <map>
64#include <algorithm>64#include <algorithm>
6565
66using namespace std;66using namespace std;
67using namespace drizzled;
6768
68extern const CHARSET_INFO *character_set_filesystem;69extern const CHARSET_INFO *character_set_filesystem;
69extern size_t my_thread_stack_size;70extern size_t my_thread_stack_size;
@@ -2056,8 +2057,8 @@
2056 else2057 else
2057 {2058 {
2058 const std::string engine_name(res->ptr());2059 const std::string engine_name(res->ptr());
2059 StorageEngine *engine;2060 plugin::StorageEngine *engine;
2060 var->save_result.storage_engine= ha_resolve_by_name(session, engine_name);2061 var->save_result.storage_engine= plugin::StorageEngine::findByName(session, engine_name);
2061 if (var->save_result.storage_engine == NULL)2062 if (var->save_result.storage_engine == NULL)
2062 {2063 {
2063 value= res->c_ptr();2064 value= res->c_ptr();
@@ -2081,7 +2082,7 @@
2081{2082{
2082 unsigned char* result;2083 unsigned char* result;
2083 string engine_name;2084 string engine_name;
2084 StorageEngine *engine= session->variables.*offset;2085 plugin::StorageEngine *engine= session->variables.*offset;
2085 if (type == OPT_GLOBAL)2086 if (type == OPT_GLOBAL)
2086 engine= global_system_variables.*offset;2087 engine= global_system_variables.*offset;
2087 engine_name= engine->getName();2088 engine_name= engine->getName();
@@ -2093,7 +2094,7 @@
20932094
2094void sys_var_session_storage_engine::set_default(Session *session, enum_var_type type)2095void sys_var_session_storage_engine::set_default(Session *session, enum_var_type type)
2095{2096{
2096 StorageEngine *old_value, *new_value, **value;2097 plugin::StorageEngine *old_value, *new_value, **value;
2097 if (type == OPT_GLOBAL)2098 if (type == OPT_GLOBAL)
2098 {2099 {
2099 value= &(global_system_variables.*offset);2100 value= &(global_system_variables.*offset);
@@ -2112,7 +2113,7 @@
21122113
2113bool sys_var_session_storage_engine::update(Session *session, set_var *var)2114bool sys_var_session_storage_engine::update(Session *session, set_var *var)
2114{2115{
2115 StorageEngine **value= &(global_system_variables.*offset), *old_value;2116 plugin::StorageEngine **value= &(global_system_variables.*offset), *old_value;
2116 if (var->type != OPT_GLOBAL)2117 if (var->type != OPT_GLOBAL)
2117 value= &(session->variables.*offset);2118 value= &(session->variables.*offset);
2118 old_value= *value;2119 old_value= *value;
21192120
=== modified file 'drizzled/set_var.h'
--- drizzled/set_var.h 2009-08-13 21:22:40 +0000
+++ drizzled/set_var.h 2009-09-30 21:30:30 +0000
@@ -656,10 +656,10 @@
656class sys_var_session_storage_engine :public sys_var_session656class sys_var_session_storage_engine :public sys_var_session
657{657{
658protected:658protected:
659 StorageEngine *SV::*offset;659 drizzled::plugin::StorageEngine *SV::*offset;
660public:660public:
661 sys_var_session_storage_engine(sys_var_chain *chain, const char *name_arg,661 sys_var_session_storage_engine(sys_var_chain *chain, const char *name_arg,
662 StorageEngine *SV::*offset_arg)662 drizzled::plugin::StorageEngine *SV::*offset_arg)
663 :sys_var_session(name_arg), offset(offset_arg)663 :sys_var_session(name_arg), offset(offset_arg)
664 { chain_sys_var(chain); }664 { chain_sys_var(chain); }
665 bool check(Session *session, set_var *var);665 bool check(Session *session, set_var *var);
@@ -983,7 +983,7 @@
983 uint32_t uint32_t_value;983 uint32_t uint32_t_value;
984 uint64_t uint64_t_value;984 uint64_t uint64_t_value;
985 size_t size_t_value;985 size_t size_t_value;
986 StorageEngine *storage_engine;986 drizzled::plugin::StorageEngine *storage_engine;
987 Time_zone *time_zone;987 Time_zone *time_zone;
988 MY_LOCALE *locale_value;988 MY_LOCALE *locale_value;
989 } save_result;989 } save_result;
990990
=== modified file 'drizzled/show.cc'
--- drizzled/show.cc 2009-08-31 23:50:37 +0000
+++ drizzled/show.cc 2009-09-30 21:30:30 +0000
@@ -40,7 +40,7 @@
40#include <drizzled/item/return_date_time.h>40#include <drizzled/item/return_date_time.h>
41#include <drizzled/item/empty_string.h>41#include <drizzled/item/empty_string.h>
42#include "drizzled/plugin/registry.h"42#include "drizzled/plugin/registry.h"
43#include <drizzled/info_schema.h>43#include <drizzled/plugin/info_schema_table.h>
44#include <drizzled/message/schema.pb.h>44#include <drizzled/message/schema.pb.h>
45#include <drizzled/plugin/client.h>45#include <drizzled/plugin/client.h>
46#include <mysys/cached_directory.h>46#include <mysys/cached_directory.h>
@@ -66,26 +66,6 @@
6666
67static void store_key_options(String *packet, Table *table, KEY *key_info);67static void store_key_options(String *packet, Table *table, KEY *key_info);
6868
69static vector<InfoSchemaTable *> all_schema_tables;
70
71void add_infoschema_table(InfoSchemaTable *schema_table)
72{
73 if (schema_table->getFirstColumnIndex() == 0)
74 schema_table->setFirstColumnIndex(-1);
75 if (schema_table->getSecondColumnIndex() == 0)
76 schema_table->setSecondColumnIndex(-1);
77
78 all_schema_tables.push_back(schema_table);
79}
80
81void remove_infoschema_table(InfoSchemaTable *table)
82{
83 all_schema_tables.erase(remove_if(all_schema_tables.begin(),
84 all_schema_tables.end(),
85 bind2nd(equal_to<InfoSchemaTable *>(),
86 table)),
87 all_schema_tables.end());
88}
8969
9070
91int wild_case_compare(const CHARSET_INFO * const cs, const char *str,const char *wildstr)71int wild_case_compare(const CHARSET_INFO * const cs, const char *str,const char *wildstr)
@@ -1102,7 +1082,7 @@
1102 TableList *table,1082 TableList *table,
1103 LOOKUP_FIELD_VALUES *lookup_field_vals)1083 LOOKUP_FIELD_VALUES *lookup_field_vals)
1104{1084{
1105 InfoSchemaTable *schema_table= table->schema_table;1085 plugin::InfoSchemaTable *schema_table= table->schema_table;
1106 const char *field_name1= schema_table->getFirstColumnIndex() >= 0 ?1086 const char *field_name1= schema_table->getFirstColumnIndex() >= 0 ?
1107 schema_table->getColumnName(schema_table->getFirstColumnIndex()).c_str() : "";1087 schema_table->getColumnName(schema_table->getFirstColumnIndex()).c_str() : "";
1108 const char *field_name2= schema_table->getSecondColumnIndex() >= 0 ?1088 const char *field_name2= schema_table->getSecondColumnIndex() >= 0 ?
@@ -1230,7 +1210,7 @@
1230 {1210 {
1231 Item_field *item_field= (Item_field*)item;1211 Item_field *item_field= (Item_field*)item;
1232 const CHARSET_INFO * const cs= system_charset_info;1212 const CHARSET_INFO * const cs= system_charset_info;
1233 InfoSchemaTable *schema_table= table->schema_table;1213 plugin::InfoSchemaTable *schema_table= table->schema_table;
1234 const char *field_name1= schema_table->getFirstColumnIndex() >= 0 ?1214 const char *field_name1= schema_table->getFirstColumnIndex() >= 0 ?
1235 schema_table->getColumnName(schema_table->getFirstColumnIndex()).c_str() : "";1215 schema_table->getColumnName(schema_table->getFirstColumnIndex()).c_str() : "";
1236 const char *field_name2= schema_table->getSecondColumnIndex() >= 0 ?1216 const char *field_name2= schema_table->getSecondColumnIndex() >= 0 ?
@@ -1463,60 +1443,6 @@
1463}1443}
14641444
14651445
1466class AddSchemaTable : public unary_function<InfoSchemaTable *, bool>
1467{
1468 Session *session;
1469 const char *wild;
1470 vector<LEX_STRING*> &files;
1471
1472public:
1473 AddSchemaTable(Session *session_arg, vector<LEX_STRING*> &files_arg, const char *wild_arg)
1474 : session(session_arg), wild(wild_arg), files(files_arg)
1475 {}
1476
1477 result_type operator() (argument_type schema_table)
1478 {
1479 if (schema_table->isHidden())
1480 {
1481 return false;
1482 }
1483
1484 const string &schema_table_name= schema_table->getTableName();
1485
1486 if (wild && wild_case_compare(files_charset_info, schema_table_name.c_str(), wild))
1487 {
1488 return false;
1489 }
1490
1491 LEX_STRING *file_name= 0;
1492 file_name= session->make_lex_string(file_name, schema_table_name.c_str(),
1493 schema_table_name.length(), true);
1494 if (file_name == NULL)
1495 {
1496 return true;
1497 }
1498
1499 files.push_back(file_name);
1500 return false;
1501 }
1502};
1503
1504
1505static int schema_tables_add(Session *session, vector<LEX_STRING*> &files, const char *wild)
1506{
1507 vector<InfoSchemaTable *>::iterator iter= find_if(all_schema_tables.begin(),
1508 all_schema_tables.end(),
1509 AddSchemaTable(session, files, wild));
1510
1511 if (iter != all_schema_tables.end())
1512 {
1513 return 1;
1514 }
1515
1516 return 0;
1517}
1518
1519
1520/**1446/**
1521 @brief Create table names list1447 @brief Create table names list
15221448
@@ -1548,7 +1474,7 @@
1548 {1474 {
1549 if (with_i_schema)1475 if (with_i_schema)
1550 {1476 {
1551 if (find_schema_table(lookup_field_vals->table_value.str))1477 if (plugin::InfoSchemaTable::getTable(lookup_field_vals->table_value.str))
1552 {1478 {
1553 table_names.push_back(&lookup_field_vals->table_value);1479 table_names.push_back(&lookup_field_vals->table_value);
1554 }1480 }
@@ -1565,12 +1491,12 @@
1565 to the list1491 to the list
1566 */1492 */
1567 if (with_i_schema)1493 if (with_i_schema)
1568 return (schema_tables_add(session, table_names,1494 return plugin::InfoSchemaTable::addTableToList(session, table_names,
1569 lookup_field_vals->table_value.str));1495 lookup_field_vals->table_value.str);
15701496
1571 string db(db_name->str);1497 string db(db_name->str);
15721498
1573 TableNameIterator tniter(db);1499 plugin::TableNameIterator tniter(db);
1574 int err= 0;1500 int err= 0;
1575 string table_name;1501 string table_name;
15761502
@@ -1622,7 +1548,7 @@
16221548
1623static int1549static int
1624fill_schema_show_cols_or_idxs(Session *session, TableList *tables,1550fill_schema_show_cols_or_idxs(Session *session, TableList *tables,
1625 InfoSchemaTable *schema_table,1551 plugin::InfoSchemaTable *schema_table,
1626 Open_tables_state *open_tables_state_backup)1552 Open_tables_state *open_tables_state_backup)
1627{1553{
1628 LEX *lex= session->lex;1554 LEX *lex= session->lex;
@@ -1739,7 +1665,7 @@
1739*/1665*/
17401666
1741static uint32_t get_table_open_method(TableList *tables,1667static uint32_t get_table_open_method(TableList *tables,
1742 InfoSchemaTable *schema_table)1668 plugin::InfoSchemaTable *schema_table)
1743{1669{
1744 /*1670 /*
1745 determine which method will be used for table opening1671 determine which method will be used for table opening
@@ -1778,7 +1704,7 @@
1778*/1704*/
17791705
1780static int fill_schema_table_from_frm(Session *session,TableList *tables,1706static int fill_schema_table_from_frm(Session *session,TableList *tables,
1781 InfoSchemaTable *schema_table,1707 plugin::InfoSchemaTable *schema_table,
1782 LEX_STRING *db_name,1708 LEX_STRING *db_name,
1783 LEX_STRING *table_name)1709 LEX_STRING *table_name)
1784{1710{
@@ -1832,7 +1758,7 @@
1832 temporary tables that are filled at query execution time.1758 temporary tables that are filled at query execution time.
1833 Those I_S tables whose data are retrieved1759 Those I_S tables whose data are retrieved
1834 from frm files and storage engine are filled by the function1760 from frm files and storage engine are filled by the function
1835 InfoSchemaMethods::fillTable().1761 plugin::InfoSchemaMethods::fillTable().
18361762
1837 @param[in] session thread handler1763 @param[in] session thread handler
1838 @param[in] tables I_S table1764 @param[in] tables I_S table
@@ -1842,14 +1768,14 @@
1842 @retval 0 success1768 @retval 0 success
1843 @retval 1 error1769 @retval 1 error
1844*/1770*/
1845int InfoSchemaMethods::fillTable(Session *session, TableList *tables, COND *cond)1771int plugin::InfoSchemaMethods::fillTable(Session *session, TableList *tables, COND *cond)
1846{1772{
1847 LEX *lex= session->lex;1773 LEX *lex= session->lex;
1848 Table *table= tables->table;1774 Table *table= tables->table;
1849 Select_Lex *old_all_select_lex= lex->all_selects_list;1775 Select_Lex *old_all_select_lex= lex->all_selects_list;
1850 enum_sql_command save_sql_command= lex->sql_command;1776 enum_sql_command save_sql_command= lex->sql_command;
1851 Select_Lex *lsel= tables->schema_select_lex;1777 Select_Lex *lsel= tables->schema_select_lex;
1852 InfoSchemaTable *schema_table= tables->schema_table;1778 plugin::InfoSchemaTable *schema_table= tables->schema_table;
1853 Select_Lex sel;1779 Select_Lex sel;
1854 LOOKUP_FIELD_VALUES lookup_field_vals;1780 LOOKUP_FIELD_VALUES lookup_field_vals;
1855 bool with_i_schema;1781 bool with_i_schema;
@@ -2168,7 +2094,7 @@
2168}2094}
21692095
21702096
2171int InfoSchemaMethods::processTable(Session *session, TableList *tables,2097int plugin::InfoSchemaMethods::processTable(Session *session, TableList *tables,
2172 Table *table, bool res,2098 Table *table, bool res,
2173 LEX_STRING *db_name,2099 LEX_STRING *db_name,
2174 LEX_STRING *table_name) const2100 LEX_STRING *table_name) const
@@ -2289,48 +2215,7 @@
2289}2215}
22902216
22912217
2292class FindSchemaTableByName : public unary_function<InfoSchemaTable *, bool>2218Table *plugin::InfoSchemaMethods::createSchemaTable(Session *session, TableList *table_list)
2293{
2294 const char *table_name;
2295public:
2296 FindSchemaTableByName(const char *table_name_arg)
2297 : table_name(table_name_arg) {}
2298 result_type operator() (argument_type schema_table)
2299 {
2300 return ! my_strcasecmp(system_charset_info,
2301 schema_table->getTableName().c_str(),
2302 table_name);
2303 }
2304};
2305
2306
2307/*
2308 Find schema_tables elment by name
2309
2310 SYNOPSIS
2311 find_schema_table()
2312 table_name table name
2313
2314 RETURN
2315 0 table not found
2316 # pointer to 'schema_tables' element
2317*/
2318
2319InfoSchemaTable *find_schema_table(const char* table_name)
2320{
2321 vector<InfoSchemaTable *>::iterator iter=
2322 find_if(all_schema_tables.begin(), all_schema_tables.end(),
2323 FindSchemaTableByName(table_name));
2324 if (iter != all_schema_tables.end())
2325 {
2326 return *iter;
2327 }
2328
2329 return NULL;
2330}
2331
2332
2333Table *InfoSchemaMethods::createSchemaTable(Session *session, TableList *table_list)
2334 const2219 const
2335{2220{
2336 int field_count= 0;2221 int field_count= 0;
@@ -2338,12 +2223,12 @@
2338 Table *table;2223 Table *table;
2339 List<Item> field_list;2224 List<Item> field_list;
2340 const CHARSET_INFO * const cs= system_charset_info;2225 const CHARSET_INFO * const cs= system_charset_info;
2341 const InfoSchemaTable::Columns &columns= table_list->schema_table->getColumns();2226 const plugin::InfoSchemaTable::Columns &columns= table_list->schema_table->getColumns();
2342 InfoSchemaTable::Columns::const_iterator iter= columns.begin();2227 plugin::InfoSchemaTable::Columns::const_iterator iter= columns.begin();
23432228
2344 while (iter != columns.end())2229 while (iter != columns.end())
2345 {2230 {
2346 const ColumnInfo *column= *iter;2231 const plugin::ColumnInfo *column= *iter;
2347 switch (column->getType()) {2232 switch (column->getType()) {
2348 case DRIZZLE_TYPE_LONG:2233 case DRIZZLE_TYPE_LONG:
2349 case DRIZZLE_TYPE_LONGLONG:2234 case DRIZZLE_TYPE_LONGLONG:
@@ -2435,7 +2320,7 @@
2435 Make list of fields for SHOW2320 Make list of fields for SHOW
24362321
2437 SYNOPSIS2322 SYNOPSIS
2438 InfoSchemaMethods::oldFormat()2323 plugin::InfoSchemaMethods::oldFormat()
2439 session thread handler2324 session thread handler
2440 schema_table pointer to 'schema_tables' element2325 schema_table pointer to 'schema_tables' element
24412326
@@ -2444,16 +2329,16 @@
2444 0 success2329 0 success
2445*/2330*/
24462331
2447int InfoSchemaMethods::oldFormat(Session *session, InfoSchemaTable *schema_table)2332int plugin::InfoSchemaMethods::oldFormat(Session *session, plugin::InfoSchemaTable *schema_table)
2448 const2333 const
2449{2334{
2450 Name_resolution_context *context= &session->lex->select_lex.context;2335 Name_resolution_context *context= &session->lex->select_lex.context;
2451 const InfoSchemaTable::Columns columns= schema_table->getColumns();2336 const plugin::InfoSchemaTable::Columns columns= schema_table->getColumns();
2452 InfoSchemaTable::Columns::const_iterator iter= columns.begin();2337 plugin::InfoSchemaTable::Columns::const_iterator iter= columns.begin();
24532338
2454 while (iter != columns.end())2339 while (iter != columns.end())
2455 {2340 {
2456 const ColumnInfo *column= *iter;2341 const plugin::ColumnInfo *column= *iter;
2457 if (column->getOldName().length() != 0)2342 if (column->getOldName().length() != 0)
2458 {2343 {
2459 Item_field *field= new Item_field(context,2344 Item_field *field= new Item_field(context,
@@ -2531,7 +2416,7 @@
2531bool make_schema_select(Session *session, Select_Lex *sel,2416bool make_schema_select(Session *session, Select_Lex *sel,
2532 const string& schema_table_name)2417 const string& schema_table_name)
2533{2418{
2534 InfoSchemaTable *schema_table= find_schema_table(schema_table_name.c_str());2419 plugin::InfoSchemaTable *schema_table= plugin::InfoSchemaTable::getTable(schema_table_name.c_str());
2535 LEX_STRING db, table;2420 LEX_STRING db, table;
2536 /*2421 /*
2537 We have to make non const db_name & table_name2422 We have to make non const db_name & table_name
25382423
=== modified file 'drizzled/show.h'
--- drizzled/show.h 2009-08-04 14:13:13 +0000
+++ drizzled/show.h 2009-09-30 21:30:30 +0000
@@ -40,7 +40,14 @@
40struct st_ha_create_information;40struct st_ha_create_information;
41typedef st_ha_create_information HA_CREATE_INFO;41typedef st_ha_create_information HA_CREATE_INFO;
42struct TableList;42struct TableList;
43class InfoSchemaTable;43namespace drizzled
44{
45namespace plugin
46{
47 class InfoSchemaTable;
48}
49}
50
4451
45typedef struct system_status_var STATUS_VAR;52typedef struct system_status_var STATUS_VAR;
4653
@@ -66,7 +73,6 @@
66int wild_case_compare(const CHARSET_INFO * const cs, 73int wild_case_compare(const CHARSET_INFO * const cs,
67 const char *str,const char *wildstr);74 const char *str,const char *wildstr);
6875
69InfoSchemaTable *find_schema_table(const char* table_name);
70bool make_schema_select(Session *session, Select_Lex *sel,76bool make_schema_select(Session *session, Select_Lex *sel,
71 const std::string& schema_table_name);77 const std::string& schema_table_name);
72bool mysql_schema_table(Session *session, LEX *lex, TableList *table_list);78bool mysql_schema_table(Session *session, LEX *lex, TableList *table_list);
@@ -91,7 +97,5 @@
91void init_status_vars();97void init_status_vars();
92void free_status_vars();98void free_status_vars();
93void reset_status_vars();99void reset_status_vars();
94void add_infoschema_table(InfoSchemaTable *schema_table);
95void remove_infoschema_table(InfoSchemaTable *table);
96100
97#endif /* DRIZZLE_SERVER_SHOW_H */101#endif /* DRIZZLE_SERVER_SHOW_H */
98102
=== removed file 'drizzled/slot/function.h'
--- drizzled/slot/function.h 2009-08-17 21:30:20 +0000
+++ drizzled/slot/function.h 1970-01-01 00:00:00 +0000
@@ -1,66 +0,0 @@
1/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *
4 * Copyright (C) 2008 Sun Microsystems
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#ifndef DRIZZLED_SLOT_FUNCTION_H
21#define DRIZZLED_SLOT_FUNCTION_H
22
23/* This file defines structures needed by udf functions */
24
25#include "drizzled/function/func.h"
26#include "drizzled/plugin/function.h"
27#include "drizzled/registry.h"
28
29namespace drizzled
30{
31namespace slot
32{
33
34/**
35 * Class to handle all Function plugin objects.
36 */
37class Function
38{
39 Registry<const plugin::Function *> udf_registry;
40
41public:
42 Function() : udf_registry() {}
43 ~Function() {}
44
45 /**
46 * Add a new Function factory to the list of factories we manage.
47 */
48 void add(const plugin::Function *function_obj);
49
50 /**
51 * Remove a Function factory from the list of factory we manage.
52 */
53 void remove(const plugin::Function *function_obj);
54
55 /**
56 * Accept a new connection (Protocol object) on one of the configured
57 * listener interfaces.
58 */
59 const plugin::Function *get(const char *name, size_t len=0) const;
60
61};
62
63} /* end namespace slot */
64} /* end namespace drizzled */
65
66#endif /* DRIZZLED_SLOT_FUNCTION_H */
670
=== removed file 'drizzled/slot/listen.h'
--- drizzled/slot/listen.h 2009-08-28 00:07:54 +0000
+++ drizzled/slot/listen.h 1970-01-01 00:00:00 +0000
@@ -1,91 +0,0 @@
1/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *
4 * Copyright (C) 2008 Sun Microsystems
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#ifndef DRIZZLED_SLOT_LISTEN_H
21#define DRIZZLED_SLOT_LISTEN_H
22
23#include <vector>
24
25struct pollfd;
26
27namespace drizzled
28{
29
30namespace plugin
31{
32class Client;
33class Listen;
34}
35
36namespace slot
37{
38
39/**
40 * Class to handle all Listen plugin objects.
41 */
42class Listen
43{
44private:
45 std::vector<plugin::Listen *> listen_list;
46 std::vector<plugin::Listen *> listen_fd_list;
47 struct pollfd *fd_list;
48 uint32_t fd_count;
49 int wakeup_pipe[2];
50
51public:
52 Listen();
53 ~Listen();
54
55 /**
56 * Add a new Listen object to the list of listeners we manage.
57 */
58 void add(plugin::Listen &listen_obj);
59
60 /**
61 * Remove a Listen object from the list of listeners we manage.
62 */
63 void remove(plugin::Listen &listen_obj);
64
65 /**
66 * Setup all configured listen plugins.
67 */
68 bool setup(void);
69
70 /**
71 * Accept a new connection (Client object) on one of the configured
72 * listener interfaces.
73 */
74 plugin::Client *getClient(void) const;
75
76 /**
77 * Some internal functions drizzled require a temporary Client object to
78 * create a valid session object, this just returns a dummy client object.
79 */
80 plugin::Client *getNullClient(void) const;
81
82 /**
83 * Shutdown and cleanup listen loop for server shutdown.
84 */
85 void shutdown(void);
86};
87
88} /* end namespace slot */
89} /* end namespace drizzled */
90
91#endif /* DRIZZLED_SLOT_LISTEN_H */
920
=== renamed file 'drizzled/thr_malloc.cc' => 'drizzled/sql_alloc.cc'
=== modified file 'drizzled/sql_base.cc'
--- drizzled/sql_base.cc 2009-08-31 23:50:37 +0000
+++ drizzled/sql_base.cc 2009-09-30 21:30:30 +0000
@@ -44,15 +44,13 @@
44#include <drizzled/replication_services.h>44#include <drizzled/replication_services.h>
45#include <drizzled/check_stack_overrun.h>45#include <drizzled/check_stack_overrun.h>
46#include <drizzled/lock.h>46#include <drizzled/lock.h>
47#include <drizzled/slot/listen.h>47#include <drizzled/plugin/listen.h>
48#include <mysys/cached_directory.h>48#include <mysys/cached_directory.h>
4949
50using namespace std;50using namespace std;
51using namespace drizzled;51using namespace drizzled;
5252
53extern drizzled::ReplicationServices replication_services;53bool drizzle_rm_tmp_tables();
54
55bool drizzle_rm_tmp_tables(slot::Listen &listen_handler);
5654
57/**55/**
58 @defgroup Data_Dictionary Data Dictionary56 @defgroup Data_Dictionary Data Dictionary
@@ -816,7 +814,7 @@
816 close_temporary_table(table, true, true);814 close_temporary_table(table, true, true);
817 else815 else
818 {816 {
819 StorageEngine *table_type= table->s->db_type();817 plugin::StorageEngine *table_type= table->s->db_type();
820 pthread_mutex_lock(&LOCK_open); /* Close and drop a table (AUX routine) */818 pthread_mutex_lock(&LOCK_open); /* Close and drop a table (AUX routine) */
821 /*819 /*
822 unlink_open_table() also tells threads waiting for refresh or close820 unlink_open_table() also tells threads waiting for refresh or close
@@ -1325,7 +1323,7 @@
1325 table_list->db, table_list->table_name,1323 table_list->db, table_list->table_name,
1326 false);1324 false);
13271325
1328 if (StorageEngine::getTableProto(path, NULL) != EEXIST)1326 if (plugin::StorageEngine::getTableProto(path, NULL) != EEXIST)
1329 {1327 {
1330 /*1328 /*
1331 Table to be created, so we need to create placeholder in table-cache.1329 Table to be created, so we need to create placeholder in table-cache.
@@ -2045,6 +2043,7 @@
2045 */2043 */
2046 if (unlikely(entry->file->implicit_emptied))2044 if (unlikely(entry->file->implicit_emptied))
2047 {2045 {
2046 ReplicationServices &replication_services= ReplicationServices::singleton();
2048 entry->file->implicit_emptied= 0;2047 entry->file->implicit_emptied= 0;
2049 {2048 {
2050 char *query, *end;2049 char *query, *end;
@@ -4533,14 +4532,14 @@
4533}4532}
45344533
45354534
4536bool drizzle_rm_tmp_tables(slot::Listen &listen_handler)4535bool drizzle_rm_tmp_tables()
4537{4536{
4538 char filePath[FN_REFLEN], filePathCopy[FN_REFLEN];4537 char filePath[FN_REFLEN], filePathCopy[FN_REFLEN];
4539 Session *session;4538 Session *session;
45404539
4541 assert(drizzle_tmpdir);4540 assert(drizzle_tmpdir);
45424541
4543 if (!(session= new Session(listen_handler.getNullClient())))4542 if (!(session= new Session(plugin::Listen::getNullClient())))
4544 return true;4543 return true;
4545 session->thread_stack= (char*) &session;4544 session->thread_stack= (char*) &session;
4546 session->storeGlobals();4545 session->storeGlobals();
45474546
=== modified file 'drizzled/sql_delete.cc'
--- drizzled/sql_delete.cc 2009-09-17 00:08:20 +0000
+++ drizzled/sql_delete.cc 2009-09-30 21:30:30 +0000
@@ -27,6 +27,8 @@
27#include <drizzled/lock.h>27#include <drizzled/lock.h>
28#include "drizzled/probes.h"28#include "drizzled/probes.h"
2929
30using namespace drizzled;
31
30/**32/**
31 Implement DELETE SQL word.33 Implement DELETE SQL word.
3234
@@ -411,7 +413,7 @@
411 /* If it is a temporary table, close and regenerate it */413 /* If it is a temporary table, close and regenerate it */
412 if (!dont_send_ok && (table= session->find_temporary_table(table_list)))414 if (!dont_send_ok && (table= session->find_temporary_table(table_list)))
413 {415 {
414 StorageEngine *table_type= table->s->db_type();416 plugin::StorageEngine *table_type= table->s->db_type();
415 TableShare *share= table->s;417 TableShare *share= table->s;
416418
417 if (!table_type->check_flag(HTON_BIT_CAN_RECREATE))419 if (!table_type->check_flag(HTON_BIT_CAN_RECREATE))
418420
=== modified file 'drizzled/sql_lex.h'
--- drizzled/sql_lex.h 2009-09-24 06:11:54 +0000
+++ drizzled/sql_lex.h 2009-09-30 21:30:30 +0000
@@ -25,7 +25,7 @@
25*/25*/
26#include <drizzled/message/table.pb.h>26#include <drizzled/message/table.pb.h>
2727
28#include "drizzled/slot/function.h"28#include "drizzled/plugin/function.h"
29#include "drizzled/name_resolution_context.h"29#include "drizzled/name_resolution_context.h"
30#include "drizzled/item/subselect.h"30#include "drizzled/item/subselect.h"
31#include "drizzled/item/param.h"31#include "drizzled/item/param.h"
3232
=== modified file 'drizzled/sql_parse.cc'
--- drizzled/sql_parse.cc 2009-09-24 06:23:51 +0000
+++ drizzled/sql_parse.cc 2009-09-30 21:30:30 +0000
@@ -16,7 +16,6 @@
The diff has been truncated for viewing.