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