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

Proposed by Monty Taylor
Status: Superseded
Proposed branch: lp:~mordred/drizzle/plugin-slot-reorg
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: None lines
To merge this branch: bzr merge lp:~mordred/drizzle/plugin-slot-reorg
Reviewer Review Type Date Requested Status
Jay Pipes (community) Needs Fixing
Review via email: mp+10789@code.launchpad.net

This proposal has been superseded by a proposal from 2009-09-22.

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

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

1126. By Brian Aker <brian@gaz>

Merge Padraig

Revision history for this message
Jay Pipes (jaypipes) wrote :

Please merge with trunk :)

review: Needs Fixing
1127. By Brian Aker <brian@gaz>

Merge Jay

1128. By Brian Aker <brian@gaz>

Merge Jay Alter table + Brian dead code

1129. By Brian Aker <brian@gaz>

Merge Jay

1130. By Brian Aker <brian@gaz>

Merge Jay

1131. By Monty Taylor

Merged in plugin-slot-reorg patches.

1132. By Monty Taylor

Re-org'd the replication stuff into slots.

1133. By Monty Taylor

Merged up with trunk.

1134. By Monty Taylor

Moved StorageEngine into plugin namespace.

1135. By Monty Taylor

Split StorageEngine into slot. This completes the plugin-slot-reorg. Woot.
Next step - getting slot registration to inject a plugin reference into a
registry so that we can make I_S.PLUGINS stop being broken.

1136. By Monty Taylor

Merged trunk.

1137. By Monty Taylor

Renamed plugin::InfoSchema to plugin::InfoSchemaTable as per Jay.

1138. By Monty Taylor

Added polymorphic add/remove methods around slot add/remove methods.

1139. By Monty Taylor

Changed some plugins from including slots to include plugins. Oops.

1140. By Monty Taylor

Renamed namespace slot to namespace service.

1141. By Monty Taylor

Merged with trunk.

1142. By Monty Taylor

Moved service stuff into plugin/

1143. By Monty Taylor

Moved some simple methods back into header to they can be inlined. Removed a couple wrapper methods.

1144. By Monty Taylor

Merged in trunk.

1145. By Monty Taylor

Merged trunk.

1146. By Monty Taylor

Fixed naming issue.

1147. By Monty Taylor

Fixed query_cache naming.

1148. By Monty Taylor

Changed ::add() and ::remove() to ::addPlugin() and ::removePlugin() so that
we don't co-opt useful names "add" and "remove".

1149. By Monty Taylor

Added error reporting to plugin registration.

Unmerged revisions

Preview Diff

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