Merge lp:~mordred/drizzle/plugin-slot-reorg into lp:~drizzle-trunk/drizzle/development
- plugin-slot-reorg
- Merge into development
Status: | Superseded |
---|---|
Proposed branch: | lp:~mordred/drizzle/plugin-slot-reorg |
Merge into: | lp:~drizzle-trunk/drizzle/development |
Diff against target: |
9227 lines 112 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 (+29/-22) drizzled/plugin/authentication.h (+12/-6) drizzled/plugin/command_applier.cc (+39/-0) drizzled/plugin/command_applier.h (+10/-13) drizzled/plugin/command_replicator.cc (+42/-0) drizzled/plugin/command_replicator.h (+10/-13) drizzled/plugin/error_message.cc (+27/-22) drizzled/plugin/error_message.h (+23/-11) drizzled/plugin/function.cc (+15/-10) drizzled/plugin/function.h (+19/-0) drizzled/plugin/info_schema_table.cc (+144/-0) drizzled/plugin/info_schema_table.h (+17/-3) drizzled/plugin/listen.cc (+21/-27) drizzled/plugin/listen.h (+34/-2) drizzled/plugin/listen_tcp.cc (+5/-1) drizzled/plugin/loader.cc (+0/-5) drizzled/plugin/logging.cc (+46/-40) drizzled/plugin/logging.h (+20/-9) drizzled/plugin/query_cache.cc (+49/-61) drizzled/plugin/query_cache.h (+24/-5) drizzled/plugin/registry.cc (+4/-99) drizzled/plugin/registry.h (+14/-36) drizzled/plugin/scheduler.cc (+13/-12) drizzled/plugin/scheduler.h (+6/-0) drizzled/plugin/storage_engine.cc (+276/-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 (+4/-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_write.cc (+1/-1) drizzled/table_share.h (+2/-2) 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 |
---|---|---|---|
Brian Aker | Pending | ||
Jay Pipes | Pending | ||
Review via email: mp+12626@code.launchpad.net |
This proposal supersedes a proposal from 2009-09-27.
This proposal has been superseded by a proposal from 2009-09-30.
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 : | # |
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.
- 1145. By Monty Taylor
-
Merged trunk.
- 1146. By Monty Taylor
-
Fixed naming issue.
- 1147. By Monty Taylor
-
Fixed query_cache naming.
- 1148. By Monty Taylor
-
Changed ::add() and ::remove() to ::addPlugin() and ::removePlugin() so that
we don't co-opt useful names "add" and "remove". - 1149. By Monty Taylor
-
Added error reporting to plugin registration.
Unmerged revisions
Preview Diff
1 | === modified file '.bzrignore' |
2 | --- .bzrignore 2009-08-03 14:23:22 +0000 |
3 | +++ .bzrignore 2009-09-30 20:58:09 +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 20:58:10 +0000 |
13 | @@ -38,53 +38,10 @@ |
14 | atomic/pthread_traits.h \ |
15 | atomic/sun_studio.h \ |
16 | atomics.h \ |
17 | - authentication.h \ |
18 | base.h \ |
19 | cached_item.h \ |
20 | calendar.h \ |
21 | check_stack_overrun.h \ |
22 | - statement.h \ |
23 | - statement/alter_schema.h \ |
24 | - statement/alter_table.h \ |
25 | - statement/analyze.h \ |
26 | - statement/change_schema.h \ |
27 | - statement/check.h \ |
28 | - statement/checksum.h \ |
29 | - statement/commit.h \ |
30 | - statement/create_index.h \ |
31 | - statement/create_schema.h \ |
32 | - statement/create_table.h \ |
33 | - statement/delete.h \ |
34 | - statement/drop_index.h \ |
35 | - statement/drop_schema.h \ |
36 | - statement/drop_table.h \ |
37 | - statement/empty_query.h \ |
38 | - statement/flush.h \ |
39 | - statement/insert.h \ |
40 | - statement/insert_select.h \ |
41 | - statement/kill.h \ |
42 | - statement/load.h \ |
43 | - statement/optimize.h \ |
44 | - statement/release_savepoint.h \ |
45 | - statement/rename_table.h \ |
46 | - statement/replace.h \ |
47 | - statement/replace_select.h \ |
48 | - statement/rollback.h \ |
49 | - statement/rollback_to_savepoint.h \ |
50 | - statement/savepoint.h \ |
51 | - statement/select.h \ |
52 | - statement/set_option.h \ |
53 | - statement/show_create.h \ |
54 | - statement/show_create_schema.h \ |
55 | - statement/show_engine_status.h \ |
56 | - statement/show_errors.h \ |
57 | - statement/show_processlist.h \ |
58 | - statement/show_status.h \ |
59 | - statement/show_warnings.h \ |
60 | - statement/start_transaction.h \ |
61 | - statement/truncate.h \ |
62 | - statement/unlock_tables.h \ |
63 | - statement/update.h \ |
64 | common.h \ |
65 | comp_creator.h \ |
66 | cost_vect.h \ |
67 | @@ -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 20:58:10 +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 20:58:10 +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 20:58:10 +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 20:58:10 +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 20:58:10 +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 20:58:10 +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 20:58:10 +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 20:58:10 +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 20:58:10 +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 20:58:10 +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 20:58:10 +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 20:58:10 +0000 |
1295 | @@ -19,38 +19,43 @@ |
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 | +void plugin::Authentication::addPlugin(plugin::Authentication *auth) |
1335 | +{ |
1336 | + if (auth != NULL) |
1337 | + all_authentication.push_back(auth); |
1338 | +} |
1339 | + |
1340 | +void plugin::Authentication::removePlugin(plugin::Authentication *auth) |
1341 | +{ |
1342 | + if (auth != NULL) |
1343 | + all_authentication.erase(find(all_authentication.begin(), |
1344 | + all_authentication.end(), |
1345 | + auth)); |
1346 | +} |
1347 | + |
1348 | +class AuthenticateBy : public unary_function<plugin::Authentication *, bool> |
1349 | { |
1350 | Session *session; |
1351 | const char *password; |
1352 | public: |
1353 | AuthenticateBy(Session *session_arg, const char *password_arg) : |
1354 | - unary_function<Authentication *, bool>(), |
1355 | + unary_function<plugin::Authentication *, bool>(), |
1356 | session(session_arg), password(password_arg) {} |
1357 | |
1358 | inline result_type operator()(argument_type auth) |
1359 | @@ -59,14 +64,15 @@ |
1360 | } |
1361 | }; |
1362 | |
1363 | -bool authenticate_user(Session *session, const char *password) |
1364 | +bool plugin::Authentication::isAuthenticated(Session *session, |
1365 | + const char *password) |
1366 | { |
1367 | /* If we never loaded any auth plugins, just return true */ |
1368 | if (are_plugins_loaded != true) |
1369 | return true; |
1370 | |
1371 | /* Use find_if instead of foreach so that we can collect return codes */ |
1372 | - vector<Authentication *>::iterator iter= |
1373 | + vector<plugin::Authentication *>::iterator iter= |
1374 | find_if(all_authentication.begin(), all_authentication.end(), |
1375 | AuthenticateBy(session, password)); |
1376 | /* If iter is == end() here, that means that all of the plugins returned |
1377 | @@ -76,3 +82,4 @@ |
1378 | return iter != all_authentication.end(); |
1379 | } |
1380 | |
1381 | +} /* namespace drizzled */ |
1382 | |
1383 | === modified file 'drizzled/plugin/authentication.h' |
1384 | --- drizzled/plugin/authentication.h 2009-05-11 17:50:22 +0000 |
1385 | +++ drizzled/plugin/authentication.h 2009-09-30 20:58:10 +0000 |
1386 | @@ -1,8 +1,7 @@ |
1387 | /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
1388 | * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
1389 | - |
1390 | + * |
1391 | * Definitions required for Authentication plugin |
1392 | - |
1393 | * |
1394 | * Copyright (C) 2008 Sun Microsystems |
1395 | * |
1396 | @@ -20,13 +19,14 @@ |
1397 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
1398 | */ |
1399 | |
1400 | -/* |
1401 | - Definitions required for Authentication plugin |
1402 | -*/ |
1403 | - |
1404 | #ifndef DRIZZLED_PLUGIN_AUTHENTICATION_H |
1405 | #define DRIZZLED_PLUGIN_AUTHENTICATION_H |
1406 | |
1407 | +namespace drizzled |
1408 | +{ |
1409 | +namespace plugin |
1410 | +{ |
1411 | + |
1412 | class Authentication |
1413 | { |
1414 | public: |
1415 | @@ -35,6 +35,12 @@ |
1416 | |
1417 | virtual bool authenticate(Session *, const char *)= 0; |
1418 | |
1419 | + static void addPlugin(plugin::Authentication *auth); |
1420 | + static void removePlugin(plugin::Authentication *auth); |
1421 | + static bool isAuthenticated(Session *session, const char *password); |
1422 | }; |
1423 | |
1424 | +} /* namespace plugin */ |
1425 | +} /* namespace drizzled */ |
1426 | + |
1427 | #endif /* DRIZZLED_PLUGIN_AUTHENTICATION_H */ |
1428 | |
1429 | === added file 'drizzled/plugin/command_applier.cc' |
1430 | --- drizzled/plugin/command_applier.cc 1970-01-01 00:00:00 +0000 |
1431 | +++ drizzled/plugin/command_applier.cc 2009-09-30 20:58:10 +0000 |
1432 | @@ -0,0 +1,39 @@ |
1433 | +/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
1434 | + * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
1435 | + * |
1436 | + * Copyright (C) 2009 Sun Microsystems |
1437 | + * |
1438 | + * This program is free software; you can redistribute it and/or modify |
1439 | + * it under the terms of the GNU General Public License as published by |
1440 | + * the Free Software Foundation; version 2 of the License. |
1441 | + * |
1442 | + * This program is distributed in the hope that it will be useful, |
1443 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1444 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1445 | + * GNU General Public License for more details. |
1446 | + * |
1447 | + * You should have received a copy of the GNU General Public License |
1448 | + * along with this program; if not, write to the Free Software |
1449 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
1450 | + */ |
1451 | + |
1452 | +#include "drizzled/global.h" |
1453 | + |
1454 | +#include "drizzled/replication_services.h" |
1455 | +#include "drizzled/plugin/command_applier.h" |
1456 | + |
1457 | +using namespace std; |
1458 | +using namespace drizzled; |
1459 | + |
1460 | +void plugin::CommandApplier::addPlugin(plugin::CommandApplier *applier) |
1461 | +{ |
1462 | + ReplicationServices &replication_services= ReplicationServices::singleton(); |
1463 | + replication_services.attachApplier(applier); |
1464 | +} |
1465 | + |
1466 | +void plugin::CommandApplier::removePlugin(plugin::CommandApplier *applier) |
1467 | +{ |
1468 | + ReplicationServices &replication_services= ReplicationServices::singleton(); |
1469 | + replication_services.detachApplier(applier); |
1470 | +} |
1471 | + |
1472 | |
1473 | === modified file 'drizzled/plugin/command_applier.h' |
1474 | --- drizzled/plugin/command_applier.h 2009-08-10 19:07:57 +0000 |
1475 | +++ drizzled/plugin/command_applier.h 2009-09-30 20:58:10 +0000 |
1476 | @@ -32,17 +32,11 @@ |
1477 | * call. |
1478 | */ |
1479 | |
1480 | -/* some forward declarations needed */ |
1481 | -namespace drizzled |
1482 | -{ |
1483 | - namespace message |
1484 | - { |
1485 | - class Command; |
1486 | - } |
1487 | -} |
1488 | - |
1489 | -namespace drizzled |
1490 | -{ |
1491 | +namespace drizzled |
1492 | +{ |
1493 | + |
1494 | +namespace message { class Command; } |
1495 | + |
1496 | namespace plugin |
1497 | { |
1498 | |
1499 | @@ -75,9 +69,12 @@ |
1500 | * internal method for determining if it is active or not. |
1501 | */ |
1502 | virtual bool isActive() {return false;} |
1503 | + |
1504 | + static void addPlugin(CommandApplier *applier); |
1505 | + static void removePlugin(CommandApplier *applier); |
1506 | }; |
1507 | |
1508 | -} /* end namespace drizzled::plugin */ |
1509 | -} /* end namespace drizzled */ |
1510 | +} /* namespace plugin */ |
1511 | +} /* namespace drizzled */ |
1512 | |
1513 | #endif /* DRIZZLED_PLUGIN_APPLIER_H */ |
1514 | |
1515 | === added file 'drizzled/plugin/command_replicator.cc' |
1516 | --- drizzled/plugin/command_replicator.cc 1970-01-01 00:00:00 +0000 |
1517 | +++ drizzled/plugin/command_replicator.cc 2009-09-30 20:58:10 +0000 |
1518 | @@ -0,0 +1,42 @@ |
1519 | +/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
1520 | + * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
1521 | + * |
1522 | + * Copyright (C) 2009 Sun Microsystems |
1523 | + * |
1524 | + * This program is free software; you can redistribute it and/or modify |
1525 | + * it under the terms of the GNU General Public License as published by |
1526 | + * the Free Software Foundation; version 2 of the License. |
1527 | + * |
1528 | + * This program is distributed in the hope that it will be useful, |
1529 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1530 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1531 | + * GNU General Public License for more details. |
1532 | + * |
1533 | + * You should have received a copy of the GNU General Public License |
1534 | + * along with this program; if not, write to the Free Software |
1535 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
1536 | + */ |
1537 | + |
1538 | +#include "drizzled/global.h" |
1539 | + |
1540 | +#include "drizzled/replication_services.h" |
1541 | +#include "drizzled/plugin/command_replicator.h" |
1542 | + |
1543 | +using namespace std; |
1544 | + |
1545 | +namespace drizzled |
1546 | +{ |
1547 | + |
1548 | +void plugin::CommandReplicator::addPlugin(plugin::CommandReplicator *replicator) |
1549 | +{ |
1550 | + ReplicationServices &replication_services= ReplicationServices::singleton(); |
1551 | + replication_services.attachReplicator(replicator); |
1552 | +} |
1553 | + |
1554 | +void plugin::CommandReplicator::removePlugin(plugin::CommandReplicator *replicator) |
1555 | +{ |
1556 | + ReplicationServices &replication_services= ReplicationServices::singleton(); |
1557 | + replication_services.detachReplicator(replicator); |
1558 | +} |
1559 | + |
1560 | +} |
1561 | |
1562 | === modified file 'drizzled/plugin/command_replicator.h' |
1563 | --- drizzled/plugin/command_replicator.h 2009-08-10 19:07:57 +0000 |
1564 | +++ drizzled/plugin/command_replicator.h 2009-09-30 20:58:10 +0000 |
1565 | @@ -33,17 +33,11 @@ |
1566 | * An applier is responsible for applying events, not a replicator... |
1567 | */ |
1568 | |
1569 | -/* some forward declarations needed */ |
1570 | -namespace drizzled |
1571 | -{ |
1572 | - namespace message |
1573 | - { |
1574 | - class Command; |
1575 | - } |
1576 | -} |
1577 | - |
1578 | -namespace drizzled |
1579 | -{ |
1580 | + |
1581 | +namespace drizzled |
1582 | +{ |
1583 | +namespace message { class Command; } |
1584 | + |
1585 | namespace plugin |
1586 | { |
1587 | |
1588 | @@ -80,9 +74,12 @@ |
1589 | * internal method for determining if it is active or not. |
1590 | */ |
1591 | virtual bool isActive() {return false;} |
1592 | + |
1593 | + static void addPlugin(CommandReplicator *replicator); |
1594 | + static void removePlugin(CommandReplicator *replicator); |
1595 | }; |
1596 | |
1597 | -} /* end namespace drizzled::plugin */ |
1598 | -} /* end namespace drizzled */ |
1599 | +} /* namespace plugin */ |
1600 | +} /* namespace drizzled */ |
1601 | |
1602 | #endif /* DRIZZLED_PLUGIN_COMMAND_REPLICATOR_H */ |
1603 | |
1604 | === renamed file 'drizzled/errmsg.cc' => 'drizzled/plugin/error_message.cc' |
1605 | --- drizzled/errmsg.cc 2009-08-05 09:29:04 +0000 |
1606 | +++ drizzled/plugin/error_message.cc 2009-09-30 20:58:10 +0000 |
1607 | @@ -17,48 +17,52 @@ |
1608 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
1609 | */ |
1610 | |
1611 | -#include <drizzled/server_includes.h> |
1612 | -#include <drizzled/errmsg.h> |
1613 | -#include <drizzled/gettext.h> |
1614 | +#include "drizzled/server_includes.h" |
1615 | +#include "drizzled/plugin/error_message.h" |
1616 | #include "drizzled/plugin/registry.h" |
1617 | |
1618 | +#include "drizzled/gettext.h" |
1619 | + |
1620 | #include <vector> |
1621 | |
1622 | using namespace std; |
1623 | |
1624 | -static vector<Error_message_handler *> all_errmsg_handler; |
1625 | - |
1626 | -static bool errmsg_has= false; |
1627 | - |
1628 | -void add_errmsg_handler(Error_message_handler *handler) |
1629 | +namespace drizzled |
1630 | +{ |
1631 | + |
1632 | +vector<plugin::ErrorMessage *> all_errmsg_handler; |
1633 | +bool errmsg_has= false; |
1634 | + |
1635 | + |
1636 | +void plugin::ErrorMessage::addPlugin(plugin::ErrorMessage *handler) |
1637 | { |
1638 | all_errmsg_handler.push_back(handler); |
1639 | errmsg_has= true; |
1640 | } |
1641 | |
1642 | -void remove_errmsg_handler(Error_message_handler *handler) |
1643 | +void plugin::ErrorMessage::removePlugin(plugin::ErrorMessage *handler) |
1644 | { |
1645 | all_errmsg_handler.erase(find(all_errmsg_handler.begin(), |
1646 | all_errmsg_handler.end(), handler)); |
1647 | } |
1648 | |
1649 | |
1650 | -class ErrorMessagePrint : public unary_function<Error_message_handler *, bool> |
1651 | +class Print : public unary_function<plugin::ErrorMessage *, bool> |
1652 | { |
1653 | Session *session; |
1654 | int priority; |
1655 | const char *format; |
1656 | va_list ap; |
1657 | public: |
1658 | - ErrorMessagePrint(Session *session_arg, int priority_arg, |
1659 | - const char *format_arg, va_list ap_arg) : |
1660 | - unary_function<Error_message_handler *, bool>(), session(session_arg), |
1661 | - priority(priority_arg), format(format_arg) |
1662 | + Print(Session *session_arg, int priority_arg, |
1663 | + const char *format_arg, va_list ap_arg) |
1664 | + : unary_function<plugin::ErrorMessage *, bool>(), session(session_arg), |
1665 | + priority(priority_arg), format(format_arg) |
1666 | { |
1667 | va_copy(ap, ap_arg); |
1668 | } |
1669 | |
1670 | - ~ErrorMessagePrint() { va_end(ap); } |
1671 | + ~Print() { va_end(ap); } |
1672 | |
1673 | inline result_type operator()(argument_type handler) |
1674 | { |
1675 | @@ -76,10 +80,11 @@ |
1676 | } |
1677 | return false; |
1678 | } |
1679 | -}; |
1680 | - |
1681 | -bool errmsg_vprintf (Session *session, int priority, |
1682 | - char const *format, va_list ap) |
1683 | +}; |
1684 | + |
1685 | + |
1686 | +bool plugin::ErrorMessage::vprintf(Session *session, int priority, |
1687 | + char const *format, va_list ap) |
1688 | { |
1689 | |
1690 | /* check to see if any errmsg plugin has been loaded |
1691 | @@ -95,9 +100,9 @@ |
1692 | } |
1693 | |
1694 | /* Use find_if instead of foreach so that we can collect return codes */ |
1695 | - vector<Error_message_handler *>::iterator iter= |
1696 | + vector<plugin::ErrorMessage *>::iterator iter= |
1697 | find_if(all_errmsg_handler.begin(), all_errmsg_handler.end(), |
1698 | - ErrorMessagePrint(session, priority, format, ap)); |
1699 | + Print(session, priority, format, ap)); |
1700 | /* If iter is == end() here, that means that all of the plugins returned |
1701 | * false, which in this case means they all succeeded. Since we want to |
1702 | * return false on success, we return the value of the two being != |
1703 | @@ -105,4 +110,4 @@ |
1704 | return iter != all_errmsg_handler.end(); |
1705 | } |
1706 | |
1707 | - |
1708 | +} /* namespace drizzled */ |
1709 | |
1710 | === renamed file 'drizzled/plugin/error_message_handler.h' => 'drizzled/plugin/error_message.h' |
1711 | --- drizzled/plugin/error_message_handler.h 2009-05-11 17:50:22 +0000 |
1712 | +++ drizzled/plugin/error_message.h 2009-09-30 20:58:10 +0000 |
1713 | @@ -1,9 +1,8 @@ |
1714 | -/* |
1715 | - -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
1716 | +/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
1717 | * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
1718 | - |
1719 | + * |
1720 | * Definitions required for Error Message plugin |
1721 | - |
1722 | + * |
1723 | * Copyright (C) 2008 Sun Microsystems |
1724 | * |
1725 | * This program is free software; you can redistribute it and/or modify |
1726 | @@ -20,24 +19,37 @@ |
1727 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
1728 | */ |
1729 | |
1730 | -#ifndef DRIZZLED_PLUGIN_ERRMSG_H |
1731 | -#define DRIZZLED_PLUGIN_ERRMSG_H |
1732 | +#ifndef DRIZZLED_PLUGIN_ERROR_MESSAGE_H |
1733 | +#define DRIZZLED_PLUGIN_ERROR_MESSAGE_H |
1734 | |
1735 | #include <stdarg.h> |
1736 | #include <string> |
1737 | |
1738 | -class Error_message_handler |
1739 | +namespace drizzled |
1740 | +{ |
1741 | +namespace plugin |
1742 | +{ |
1743 | + |
1744 | +class ErrorMessage |
1745 | { |
1746 | std::string name; |
1747 | public: |
1748 | - Error_message_handler(std::string name_arg): name(name_arg) {} |
1749 | - Error_message_handler(const char *name_arg): name(name_arg) {} |
1750 | - virtual ~Error_message_handler() {} |
1751 | + ErrorMessage(std::string name_arg): name(name_arg) {} |
1752 | + virtual ~ErrorMessage() {} |
1753 | |
1754 | std::string getName() { return name; } |
1755 | |
1756 | virtual bool errmsg(Session *session, int priority, |
1757 | const char *format, va_list ap)=0; |
1758 | + |
1759 | + static void addPlugin(plugin::ErrorMessage *handler); |
1760 | + static void removePlugin(plugin::ErrorMessage *handler); |
1761 | + |
1762 | + static bool vprintf(Session *session, int priority, char const *format, |
1763 | + va_list ap); |
1764 | }; |
1765 | |
1766 | -#endif /* DRIZZLED_PLUGIN_ERRMSG_H */ |
1767 | +} /* namespace plugin */ |
1768 | +} /* namespace drizzled */ |
1769 | + |
1770 | +#endif /* DRIZZLED_PLUGIN_ERROR_MESSAGE_H */ |
1771 | |
1772 | === renamed file 'drizzled/slot/function.cc' => 'drizzled/plugin/function.cc' |
1773 | --- drizzled/slot/function.cc 2009-08-17 20:54:05 +0000 |
1774 | +++ drizzled/plugin/function.cc 2009-09-30 20:58:10 +0000 |
1775 | @@ -17,25 +17,30 @@ |
1776 | #include <drizzled/server_includes.h> |
1777 | #include <drizzled/gettext.h> |
1778 | #include <drizzled/registry.h> |
1779 | -#include "drizzled/slot/function.h" |
1780 | +#include "drizzled/plugin/function.h" |
1781 | |
1782 | using namespace std; |
1783 | -using namespace drizzled; |
1784 | - |
1785 | - |
1786 | -const plugin::Function *slot::Function::get(const char *name, size_t length) const |
1787 | + |
1788 | +namespace drizzled |
1789 | { |
1790 | - return udf_registry.find(name, length); |
1791 | -} |
1792 | - |
1793 | -void slot::Function::add(const plugin::Function *udf) |
1794 | + |
1795 | +Registry<const plugin::Function *> udf_registry; |
1796 | + |
1797 | +void plugin::Function::addPlugin(const plugin::Function *udf) |
1798 | { |
1799 | udf_registry.add(udf); |
1800 | } |
1801 | |
1802 | -void slot::Function::remove(const plugin::Function *udf) |
1803 | + |
1804 | +void plugin::Function::removePlugin(const plugin::Function *udf) |
1805 | { |
1806 | udf_registry.remove(udf); |
1807 | } |
1808 | |
1809 | |
1810 | +const plugin::Function *plugin::Function::get(const char *name, size_t length) |
1811 | +{ |
1812 | + return udf_registry.find(name, length); |
1813 | +} |
1814 | + |
1815 | +} /* namespace drizzled */ |
1816 | |
1817 | === modified file 'drizzled/plugin/function.h' |
1818 | --- drizzled/plugin/function.h 2009-08-17 20:54:05 +0000 |
1819 | +++ drizzled/plugin/function.h 2009-09-30 20:58:10 +0000 |
1820 | @@ -24,6 +24,8 @@ |
1821 | #include <drizzled/item.h> |
1822 | #include <drizzled/sql_list.h> |
1823 | #include <drizzled/item/bin_string.h> |
1824 | +#include "drizzled/function/func.h" |
1825 | + |
1826 | |
1827 | #include <string> |
1828 | #include <vector> |
1829 | @@ -62,6 +64,23 @@ |
1830 | { |
1831 | aliases.push_back(alias); |
1832 | } |
1833 | + |
1834 | + /** |
1835 | + * Add a new Function factory to the list of factories we manage. |
1836 | + */ |
1837 | + static void addPlugin(const plugin::Function *function_obj); |
1838 | + |
1839 | + /** |
1840 | + * Remove a Function factory from the list of factory we manage. |
1841 | + */ |
1842 | + static void removePlugin(const plugin::Function *function_obj); |
1843 | + |
1844 | + /** |
1845 | + * Accept a new connection (Protocol object) on one of the configured |
1846 | + * listener interfaces. |
1847 | + */ |
1848 | + static const plugin::Function *get(const char *name, size_t len=0); |
1849 | + |
1850 | }; |
1851 | |
1852 | template<class T> |
1853 | |
1854 | === added file 'drizzled/plugin/info_schema_table.cc' |
1855 | --- drizzled/plugin/info_schema_table.cc 1970-01-01 00:00:00 +0000 |
1856 | +++ drizzled/plugin/info_schema_table.cc 2009-09-30 20:58:10 +0000 |
1857 | @@ -0,0 +1,144 @@ |
1858 | +/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
1859 | + * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
1860 | + * |
1861 | + * Copyright (C) 2008 Sun Microsystems |
1862 | + * |
1863 | + * This program is free software; you can redistribute it and/or modify |
1864 | + * it under the terms of the GNU General Public License as published by |
1865 | + * the Free Software Foundation; either version 2 of the License, or |
1866 | + * (at your option) any later version. |
1867 | + * |
1868 | + * This program is distributed in the hope that it will be useful, |
1869 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1870 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1871 | + * GNU General Public License for more details. |
1872 | + * |
1873 | + * You should have received a copy of the GNU General Public License |
1874 | + * along with this program; if not, write to the Free Software |
1875 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
1876 | + */ |
1877 | + |
1878 | +#include "drizzled/server_includes.h" |
1879 | +#include "drizzled/plugin/info_schema_table.h" |
1880 | +#include "drizzled/gettext.h" |
1881 | +#include "drizzled/session.h" |
1882 | +#include "drizzled/lex_string.h" |
1883 | + |
1884 | +#include <vector> |
1885 | + |
1886 | +using namespace std; |
1887 | + |
1888 | +namespace drizzled |
1889 | +{ |
1890 | + |
1891 | +vector<plugin::InfoSchemaTable *> all_schema_tables; |
1892 | + |
1893 | + |
1894 | +void plugin::InfoSchemaTable::addPlugin(plugin::InfoSchemaTable *schema_table) |
1895 | +{ |
1896 | + if (schema_table->getFirstColumnIndex() == 0) |
1897 | + schema_table->setFirstColumnIndex(-1); |
1898 | + if (schema_table->getSecondColumnIndex() == 0) |
1899 | + schema_table->setSecondColumnIndex(-1); |
1900 | + |
1901 | + all_schema_tables.push_back(schema_table); |
1902 | +} |
1903 | + |
1904 | +void plugin::InfoSchemaTable::removePlugin(plugin::InfoSchemaTable *table) |
1905 | +{ |
1906 | + all_schema_tables.erase(remove_if(all_schema_tables.begin(), |
1907 | + all_schema_tables.end(), |
1908 | + bind2nd(equal_to<plugin::InfoSchemaTable *>(), |
1909 | + table)), |
1910 | + all_schema_tables.end()); |
1911 | +} |
1912 | + |
1913 | + |
1914 | +class AddSchemaTable : public unary_function<plugin::InfoSchemaTable *, bool> |
1915 | +{ |
1916 | + Session *session; |
1917 | + const char *wild; |
1918 | + vector<LEX_STRING*> &files; |
1919 | + |
1920 | +public: |
1921 | + AddSchemaTable(Session *session_arg, vector<LEX_STRING*> &files_arg, const char *wild_arg) |
1922 | + : session(session_arg), wild(wild_arg), files(files_arg) |
1923 | + {} |
1924 | + |
1925 | + result_type operator() (argument_type schema_table) |
1926 | + { |
1927 | + if (schema_table->isHidden()) |
1928 | + { |
1929 | + return false; |
1930 | + } |
1931 | + |
1932 | + const string &schema_table_name= schema_table->getTableName(); |
1933 | + |
1934 | + if (wild && wild_case_compare(files_charset_info, schema_table_name.c_str(), wild)) |
1935 | + { |
1936 | + return false; |
1937 | + } |
1938 | + |
1939 | + LEX_STRING *file_name= 0; |
1940 | + file_name= session->make_lex_string(file_name, schema_table_name.c_str(), |
1941 | + schema_table_name.length(), true); |
1942 | + if (file_name == NULL) |
1943 | + { |
1944 | + return true; |
1945 | + } |
1946 | + |
1947 | + files.push_back(file_name); |
1948 | + return false; |
1949 | + } |
1950 | +}; |
1951 | + |
1952 | +class FindSchemaTableByName : public unary_function<plugin::InfoSchemaTable *, bool> |
1953 | +{ |
1954 | + const char *table_name; |
1955 | +public: |
1956 | + FindSchemaTableByName(const char *table_name_arg) |
1957 | + : table_name(table_name_arg) {} |
1958 | + result_type operator() (argument_type schema_table) |
1959 | + { |
1960 | + return ! my_strcasecmp(system_charset_info, |
1961 | + schema_table->getTableName().c_str(), |
1962 | + table_name); |
1963 | + } |
1964 | +}; |
1965 | + |
1966 | +plugin::InfoSchemaTable *plugin::InfoSchemaTable::getTable(const char *table_name) |
1967 | +{ |
1968 | + vector<plugin::InfoSchemaTable *>::iterator iter= |
1969 | + find_if(all_schema_tables.begin(), |
1970 | + all_schema_tables.end(), |
1971 | + FindSchemaTableByName(table_name)); |
1972 | + |
1973 | + if (iter != all_schema_tables.end()) |
1974 | + { |
1975 | + return *iter; |
1976 | + } |
1977 | + |
1978 | + return NULL; |
1979 | + |
1980 | +} |
1981 | + |
1982 | + |
1983 | +int plugin::InfoSchemaTable::addTableToList(Session *session, |
1984 | + vector<LEX_STRING*> &files, |
1985 | + const char *wild) |
1986 | +{ |
1987 | + |
1988 | + vector<plugin::InfoSchemaTable *>::iterator iter= |
1989 | + find_if(all_schema_tables.begin(), |
1990 | + all_schema_tables.end(), |
1991 | + AddSchemaTable(session, files, wild)); |
1992 | + |
1993 | + if (iter != all_schema_tables.end()) |
1994 | + { |
1995 | + return 1; |
1996 | + } |
1997 | + |
1998 | + return 0; |
1999 | +} |
2000 | + |
2001 | +} /* namespace drizzled */ |
2002 | |
2003 | === renamed file 'drizzled/info_schema.h' => 'drizzled/plugin/info_schema_table.h' |
2004 | --- drizzled/info_schema.h 2009-07-07 04:47:22 +0000 |
2005 | +++ drizzled/plugin/info_schema_table.h 2009-09-30 20:58:10 +0000 |
2006 | @@ -18,11 +18,16 @@ |
2007 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
2008 | */ |
2009 | |
2010 | -#ifndef DRIZZLED_INFO_SCHEMA_H |
2011 | -#define DRIZZLED_INFO_SCHEMA_H |
2012 | +#ifndef DRIZZLE_PLUGIN_INFO_SCHEMA_TABLE_H |
2013 | +#define DRIZZLE_PLUGIN_INFO_SCHEMA_TABLE_H |
2014 | |
2015 | #include <string> |
2016 | |
2017 | +namespace drizzled |
2018 | +{ |
2019 | +namespace plugin |
2020 | +{ |
2021 | + |
2022 | /** |
2023 | * @file |
2024 | * info_schema.h |
2025 | @@ -471,6 +476,15 @@ |
2026 | */ |
2027 | InfoSchemaMethods *i_s_methods; |
2028 | |
2029 | +public: |
2030 | + static void addPlugin(plugin::InfoSchemaTable *schema_table); |
2031 | + static void removePlugin(plugin::InfoSchemaTable *table); |
2032 | + |
2033 | + static plugin::InfoSchemaTable *getTable(const char *table_name); |
2034 | + static int addTableToList(Session *session, std::vector<LEX_STRING*> &files, |
2035 | + const char *wild); |
2036 | }; |
2037 | |
2038 | -#endif /* DRIZZLED_INFO_SCHEMA_H */ |
2039 | +} /* namespace plugin */ |
2040 | +} /* namespace drizzled */ |
2041 | +#endif /* DRIZZLE_PLUGIN_INFO_SCHEMA_TABLE_H */ |
2042 | |
2043 | === renamed file 'drizzled/slot/listen.cc' => 'drizzled/plugin/listen.cc' |
2044 | --- drizzled/slot/listen.cc 2009-08-28 00:07:54 +0000 |
2045 | +++ drizzled/plugin/listen.cc 2009-09-30 20:58:10 +0000 |
2046 | @@ -20,7 +20,7 @@ |
2047 | #include <drizzled/server_includes.h> |
2048 | #include <drizzled/gettext.h> |
2049 | #include <drizzled/error.h> |
2050 | -#include <drizzled/slot/listen.h> |
2051 | +#include <drizzled/plugin/listen.h> |
2052 | #include <drizzled/plugin/listen.h> |
2053 | #include <drizzled/plugin/null_client.h> |
2054 | |
2055 | @@ -29,32 +29,26 @@ |
2056 | using namespace std; |
2057 | using namespace drizzled; |
2058 | |
2059 | -slot::Listen::Listen(): |
2060 | - fd_list(NULL), |
2061 | - fd_count(0) |
2062 | -{ |
2063 | -} |
2064 | - |
2065 | -slot::Listen::~Listen() |
2066 | -{ |
2067 | - if (fd_list != NULL) |
2068 | - free(fd_list); |
2069 | -} |
2070 | - |
2071 | -void slot::Listen::add(plugin::Listen &listen_obj) |
2072 | -{ |
2073 | - listen_list.push_back(&listen_obj); |
2074 | -} |
2075 | - |
2076 | -void slot::Listen::remove(plugin::Listen &listen_obj) |
2077 | -{ |
2078 | - listen_list.erase(::std::remove(listen_list.begin(), |
2079 | - listen_list.end(), |
2080 | - &listen_obj), |
2081 | +std::vector<plugin::Listen *> listen_list; |
2082 | +std::vector<plugin::Listen *> listen_fd_list; |
2083 | +struct pollfd *fd_list= NULL; |
2084 | +uint32_t fd_count= 0; |
2085 | +int wakeup_pipe[2]; |
2086 | + |
2087 | +void plugin::Listen::addPlugin(plugin::Listen *listen_obj) |
2088 | +{ |
2089 | + listen_list.push_back(listen_obj); |
2090 | +} |
2091 | + |
2092 | +void plugin::Listen::removePlugin(plugin::Listen *listen_obj) |
2093 | +{ |
2094 | + listen_list.erase(remove(listen_list.begin(), |
2095 | + listen_list.end(), |
2096 | + listen_obj), |
2097 | listen_list.end()); |
2098 | } |
2099 | |
2100 | -bool slot::Listen::setup(void) |
2101 | +bool plugin::Listen::setup(void) |
2102 | { |
2103 | vector<plugin::Listen *>::iterator it; |
2104 | struct pollfd *tmp_fd_list; |
2105 | @@ -121,7 +115,7 @@ |
2106 | return false; |
2107 | } |
2108 | |
2109 | -plugin::Client *slot::Listen::getClient(void) const |
2110 | +plugin::Client *plugin::Listen::getClient(void) |
2111 | { |
2112 | int ready; |
2113 | uint32_t x; |
2114 | @@ -173,12 +167,12 @@ |
2115 | } |
2116 | } |
2117 | |
2118 | -plugin::Client *slot::Listen::getNullClient(void) const |
2119 | +plugin::Client *plugin::Listen::getNullClient(void) |
2120 | { |
2121 | return new plugin::NullClient(); |
2122 | } |
2123 | |
2124 | -void slot::Listen::shutdown(void) |
2125 | +void plugin::Listen::shutdown(void) |
2126 | { |
2127 | ssize_t ret= write(wakeup_pipe[1], "\0", 1); |
2128 | assert(ret == 1); |
2129 | |
2130 | === modified file 'drizzled/plugin/listen.h' |
2131 | --- drizzled/plugin/listen.h 2009-08-27 07:26:22 +0000 |
2132 | +++ drizzled/plugin/listen.h 2009-09-30 20:58:10 +0000 |
2133 | @@ -53,9 +53,41 @@ |
2134 | * @param[in] fd File descriptor that had activity. |
2135 | */ |
2136 | virtual drizzled::plugin::Client *getClient(int fd)= 0; |
2137 | + |
2138 | + /** |
2139 | + * Add a new Listen object to the list of listeners we manage. |
2140 | + */ |
2141 | + static void addPlugin(Listen *listen_obj); |
2142 | + |
2143 | + /** |
2144 | + * Remove a Listen object from the list of listeners we manage. |
2145 | + */ |
2146 | + static void removePlugin(Listen *listen_obj); |
2147 | + |
2148 | + /** |
2149 | + * Setup all configured listen plugins. |
2150 | + */ |
2151 | + static bool setup(void); |
2152 | + |
2153 | + /** |
2154 | + * Accept a new connection (Client object) on one of the configured |
2155 | + * listener interfaces. |
2156 | + */ |
2157 | + static plugin::Client *getClient(void); |
2158 | + |
2159 | + /** |
2160 | + * Some internal functions drizzled require a temporary Client object to |
2161 | + * create a valid session object, this just returns a dummy client object. |
2162 | + */ |
2163 | + static plugin::Client *getNullClient(void); |
2164 | + |
2165 | + /** |
2166 | + * Shutdown and cleanup listen loop for server shutdown. |
2167 | + */ |
2168 | + static void shutdown(void); |
2169 | }; |
2170 | |
2171 | -} /* end namespace drizzled::plugin */ |
2172 | -} /* end namespace drizzled */ |
2173 | +} /* namespace plugin */ |
2174 | +} /* namespace drizzled */ |
2175 | |
2176 | #endif /* DRIZZLED_PLUGIN_LISTEN_H */ |
2177 | |
2178 | === modified file 'drizzled/plugin/listen_tcp.cc' |
2179 | --- drizzled/plugin/listen_tcp.cc 2009-08-27 18:06:03 +0000 |
2180 | +++ drizzled/plugin/listen_tcp.cc 2009-09-30 20:58:10 +0000 |
2181 | @@ -26,7 +26,9 @@ |
2182 | #include <netinet/tcp.h> |
2183 | |
2184 | using namespace std; |
2185 | -using namespace drizzled; |
2186 | + |
2187 | +namespace drizzled |
2188 | +{ |
2189 | |
2190 | int plugin::ListenTcp::acceptTcp(int fd) |
2191 | { |
2192 | @@ -211,3 +213,5 @@ |
2193 | |
2194 | return false; |
2195 | } |
2196 | + |
2197 | +} /* namespace drizzled */ |
2198 | |
2199 | === renamed file 'drizzled/sql_plugin.cc' => 'drizzled/plugin/loader.cc' |
2200 | --- drizzled/sql_plugin.cc 2009-09-14 18:25:40 +0000 |
2201 | +++ drizzled/plugin/loader.cc 2009-09-30 20:58:10 +0000 |
2202 | @@ -17,12 +17,7 @@ |
2203 | #include <mysys/my_getopt.h> |
2204 | #include <mysys/hash.h> |
2205 | |
2206 | -#include <drizzled/authentication.h> |
2207 | -#include <drizzled/logging.h> |
2208 | -#include <drizzled/errmsg.h> |
2209 | -#include <drizzled/qcache.h> |
2210 | #include <drizzled/sql_parse.h> |
2211 | -#include <drizzled/scheduling.h> |
2212 | #include <drizzled/replication_services.h> |
2213 | #include <drizzled/show.h> |
2214 | #include <drizzled/handler.h> |
2215 | |
2216 | === renamed file 'drizzled/logging.cc' => 'drizzled/plugin/logging.cc' |
2217 | --- drizzled/logging.cc 2009-08-05 09:29:04 +0000 |
2218 | +++ drizzled/plugin/logging.cc 2009-09-30 20:58:10 +0000 |
2219 | @@ -18,7 +18,7 @@ |
2220 | */ |
2221 | |
2222 | #include <drizzled/server_includes.h> |
2223 | -#include <drizzled/logging.h> |
2224 | +#include <drizzled/plugin/logging.h> |
2225 | #include <drizzled/gettext.h> |
2226 | #include "drizzled/plugin/registry.h" |
2227 | |
2228 | @@ -26,27 +26,31 @@ |
2229 | |
2230 | using namespace std; |
2231 | |
2232 | -static vector<Logging_handler *> all_loggers; |
2233 | - |
2234 | -void add_logger(Logging_handler *handler) |
2235 | +namespace drizzled |
2236 | +{ |
2237 | + |
2238 | +vector<plugin::Logging *> all_loggers; |
2239 | + |
2240 | + |
2241 | +void plugin::Logging::addPlugin(plugin::Logging *handler) |
2242 | { |
2243 | if (handler != NULL) |
2244 | all_loggers.push_back(handler); |
2245 | } |
2246 | |
2247 | -void remove_logger(Logging_handler *handler) |
2248 | +void plugin::Logging::removePlugin(plugin::Logging *handler) |
2249 | { |
2250 | if (handler != NULL) |
2251 | all_loggers.erase(find(all_loggers.begin(), all_loggers.end(), handler)); |
2252 | } |
2253 | |
2254 | |
2255 | -class LoggingPreIterate : public unary_function<Logging_handler *, bool> |
2256 | +class PreIterate : public unary_function<plugin::Logging *, bool> |
2257 | { |
2258 | Session *session; |
2259 | public: |
2260 | - LoggingPreIterate(Session *session_arg) : |
2261 | - unary_function<Logging_handler *, bool>(), |
2262 | + PreIterate(Session *session_arg) : |
2263 | + unary_function<plugin::Logging *, bool>(), |
2264 | session(session_arg) {} |
2265 | |
2266 | inline result_type operator()(argument_type handler) |
2267 | @@ -65,12 +69,12 @@ |
2268 | }; |
2269 | |
2270 | |
2271 | -class LoggingPostIterate : public unary_function<Logging_handler *, bool> |
2272 | +class PostIterate : public unary_function<plugin::Logging *, bool> |
2273 | { |
2274 | Session *session; |
2275 | public: |
2276 | - LoggingPostIterate(Session *session_arg) : |
2277 | - unary_function<Logging_handler *, bool>(), |
2278 | + PostIterate(Session *session_arg) : |
2279 | + unary_function<plugin::Logging *, bool>(), |
2280 | session(session_arg) {} |
2281 | |
2282 | /* This gets called once for each loaded logging plugin */ |
2283 | @@ -90,32 +94,34 @@ |
2284 | }; |
2285 | |
2286 | |
2287 | -/* This is the logging_pre_do entry point. |
2288 | - This gets called by the rest of the Drizzle server code */ |
2289 | -bool logging_pre_do (Session *session) |
2290 | -{ |
2291 | - /* Use find_if instead of foreach so that we can collect return codes */ |
2292 | - vector<Logging_handler *>::iterator iter= |
2293 | - find_if(all_loggers.begin(), all_loggers.end(), |
2294 | - LoggingPreIterate(session)); |
2295 | - /* If iter is == end() here, that means that all of the plugins returned |
2296 | - * false, which in this case means they all succeeded. Since we want to |
2297 | - * return false on success, we return the value of the two being != |
2298 | - */ |
2299 | - return iter != all_loggers.end(); |
2300 | -} |
2301 | - |
2302 | -/* This is the logging_post_do entry point. |
2303 | - This gets called by the rest of the Drizzle server code */ |
2304 | -bool logging_post_do (Session *session) |
2305 | -{ |
2306 | - /* Use find_if instead of foreach so that we can collect return codes */ |
2307 | - vector<Logging_handler *>::iterator iter= |
2308 | - find_if(all_loggers.begin(), all_loggers.end(), |
2309 | - LoggingPostIterate(session)); |
2310 | - /* If iter is == end() here, that means that all of the plugins returned |
2311 | - * false, which in this case means they all succeeded. Since we want to |
2312 | - * return false on success, we return the value of the two being != |
2313 | - */ |
2314 | - return iter != all_loggers.end(); |
2315 | -} |
2316 | +/* This is the Logging::preDo entry point. |
2317 | + This gets called by the rest of the Drizzle server code */ |
2318 | +bool plugin::Logging::preDo(Session *session) |
2319 | +{ |
2320 | + /* Use find_if instead of foreach so that we can collect return codes */ |
2321 | + vector<plugin::Logging *>::iterator iter= |
2322 | + find_if(all_loggers.begin(), all_loggers.end(), |
2323 | + PreIterate(session)); |
2324 | + /* If iter is == end() here, that means that all of the plugins returned |
2325 | + * false, which in this case means they all succeeded. Since we want to |
2326 | + * return false on success, we return the value of the two being != |
2327 | + */ |
2328 | + return iter != all_loggers.end(); |
2329 | +} |
2330 | + |
2331 | +/* This is the Logging::postDo entry point. |
2332 | + This gets called by the rest of the Drizzle server code */ |
2333 | +bool plugin::Logging::postDo(Session *session) |
2334 | +{ |
2335 | + /* Use find_if instead of foreach so that we can collect return codes */ |
2336 | + vector<plugin::Logging *>::iterator iter= |
2337 | + find_if(all_loggers.begin(), all_loggers.end(), |
2338 | + PostIterate(session)); |
2339 | + /* If iter is == end() here, that means that all of the plugins returned |
2340 | + * false, which in this case means they all succeeded. Since we want to |
2341 | + * return false on success, we return the value of the two being != |
2342 | + */ |
2343 | + return iter != all_loggers.end(); |
2344 | +} |
2345 | + |
2346 | +} /* namespace drizzled */ |
2347 | |
2348 | === renamed file 'drizzled/plugin/logging_handler.h' => 'drizzled/plugin/logging.h' |
2349 | --- drizzled/plugin/logging_handler.h 2009-05-11 17:50:22 +0000 |
2350 | +++ drizzled/plugin/logging.h 2009-09-30 20:58:10 +0000 |
2351 | @@ -1,9 +1,8 @@ |
2352 | -/* |
2353 | - -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
2354 | +/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
2355 | * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
2356 | - |
2357 | + * |
2358 | * Definitions required for Query Logging plugin |
2359 | - |
2360 | + * |
2361 | * Copyright (C) 2008 Sun Microsystems |
2362 | * |
2363 | * This program is free software; you can redistribute it and/or modify |
2364 | @@ -25,21 +24,33 @@ |
2365 | |
2366 | #include <string> |
2367 | |
2368 | -class Logging_handler |
2369 | +namespace drizzled |
2370 | +{ |
2371 | +namespace plugin |
2372 | +{ |
2373 | + |
2374 | +class Logging |
2375 | { |
2376 | std::string name; |
2377 | public: |
2378 | - Logging_handler(std::string name_arg): name(name_arg) {} |
2379 | - Logging_handler(const char *name_arg): name(name_arg) {} |
2380 | - virtual ~Logging_handler() {} |
2381 | + Logging(std::string name_arg): name(name_arg) {} |
2382 | + virtual ~Logging() {} |
2383 | |
2384 | std::string getName() { return name; } |
2385 | /** |
2386 | * Make these no-op rather than pure-virtual so that it's easy for a plugin |
2387 | - * to only |
2388 | + * to only implement one. |
2389 | */ |
2390 | virtual bool pre(Session *) {return false;} |
2391 | virtual bool post(Session *) {return false;} |
2392 | + |
2393 | + static void addPlugin(Logging *handler); |
2394 | + static void removePlugin(Logging *handler); |
2395 | + static bool preDo(Session *session); |
2396 | + static bool postDo(Session *session); |
2397 | }; |
2398 | |
2399 | +} /* namespace plugin */ |
2400 | +} /* namespace drizzled */ |
2401 | + |
2402 | #endif /* DRIZZLED_PLUGIN_LOGGING_H */ |
2403 | |
2404 | === renamed file 'drizzled/qcache.cc' => 'drizzled/plugin/query_cache.cc' |
2405 | --- drizzled/qcache.cc 2009-08-05 09:29:04 +0000 |
2406 | +++ drizzled/plugin/query_cache.cc 2009-09-30 20:58:10 +0000 |
2407 | @@ -17,47 +17,36 @@ |
2408 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
2409 | */ |
2410 | |
2411 | -#include <drizzled/server_includes.h> |
2412 | -#include <drizzled/qcache.h> |
2413 | -#include <drizzled/gettext.h> |
2414 | +#include "drizzled/server_includes.h" |
2415 | +#include "drizzled/plugin/query_cache.h" |
2416 | #include "drizzled/plugin/registry.h" |
2417 | + |
2418 | +#include "drizzled/gettext.h" |
2419 | + |
2420 | #include <vector> |
2421 | |
2422 | using namespace std; |
2423 | |
2424 | -static vector<QueryCache *> all_query_cache; |
2425 | - |
2426 | -void add_query_cache(QueryCache *handler) |
2427 | -{ |
2428 | - all_query_cache.push_back(handler); |
2429 | -} |
2430 | - |
2431 | -void remove_query_cache(QueryCache *handler) |
2432 | -{ |
2433 | - all_query_cache.erase(find(all_query_cache.begin(), all_query_cache.end(), |
2434 | - handler)); |
2435 | -} |
2436 | - |
2437 | - |
2438 | +namespace drizzled |
2439 | +{ |
2440 | + |
2441 | +vector<plugin::QueryCache *> all_query_cache; |
2442 | |
2443 | /* Namespaces are here to prevent global symbol clashes with these classes */ |
2444 | |
2445 | -namespace drizzled { |
2446 | -namespace query_cache { |
2447 | - |
2448 | class TryFetchAndSendIterate |
2449 | - : public unary_function<QueryCache *, bool> |
2450 | + : public unary_function<plugin::QueryCache *, bool> |
2451 | { |
2452 | Session *session; |
2453 | bool is_transactional; |
2454 | public: |
2455 | TryFetchAndSendIterate(Session *session_arg, bool is_transactional_arg) : |
2456 | - unary_function<QueryCache *, bool>(), |
2457 | + unary_function<plugin::QueryCache *, bool>(), |
2458 | session(session_arg), is_transactional(is_transactional_arg) { } |
2459 | |
2460 | inline result_type operator()(argument_type handler) |
2461 | { |
2462 | - if (handler->try_fetch_and_send(session, is_transactional)) |
2463 | + if (handler->tryFetchAndSend(session, is_transactional)) |
2464 | { |
2465 | errmsg_printf(ERRMSG_LVL_ERROR, |
2466 | _("qcache plugin '%s' try_fetch_and_send() failed"), |
2467 | @@ -69,13 +58,13 @@ |
2468 | }; |
2469 | |
2470 | class SetIterate |
2471 | - : public unary_function<QueryCache *, bool> |
2472 | + : public unary_function<plugin::QueryCache *, bool> |
2473 | { |
2474 | Session *session; |
2475 | bool is_transactional; |
2476 | public: |
2477 | SetIterate(Session *session_arg, bool is_transactional_arg) : |
2478 | - unary_function<QueryCache *, bool>(), |
2479 | + unary_function<plugin::QueryCache *, bool>(), |
2480 | session(session_arg), is_transactional(is_transactional_arg) { } |
2481 | |
2482 | inline result_type operator()(argument_type handler) |
2483 | @@ -92,22 +81,22 @@ |
2484 | }; |
2485 | |
2486 | class InvalidateTableIterate |
2487 | - : public unary_function<QueryCache *, bool> |
2488 | + : public unary_function<plugin::QueryCache *, bool> |
2489 | { |
2490 | Session *session; |
2491 | bool is_transactional; |
2492 | public: |
2493 | InvalidateTableIterate(Session *session_arg, bool is_transactional_arg) : |
2494 | - unary_function<QueryCache *, bool>(), |
2495 | + unary_function<plugin::QueryCache *, bool>(), |
2496 | session(session_arg), is_transactional(is_transactional_arg) { } |
2497 | |
2498 | inline result_type operator()(argument_type handler) |
2499 | { |
2500 | |
2501 | - if (handler->invalidate_table(session, is_transactional)) |
2502 | + if (handler->invalidateTable(session, is_transactional)) |
2503 | { |
2504 | errmsg_printf(ERRMSG_LVL_ERROR, |
2505 | - _("qcache plugin '%s' invalidate_table() failed"), |
2506 | + _("qcache plugin '%s' invalidateTable() failed"), |
2507 | handler->getName().c_str()); |
2508 | return true; |
2509 | } |
2510 | @@ -117,7 +106,7 @@ |
2511 | |
2512 | |
2513 | class InvalidateDbIterate |
2514 | - : public unary_function<QueryCache *, bool> |
2515 | + : public unary_function<plugin::QueryCache *, bool> |
2516 | { |
2517 | Session *session; |
2518 | const char *dbname; |
2519 | @@ -125,16 +114,16 @@ |
2520 | public: |
2521 | InvalidateDbIterate(Session *session_arg, const char *dbname_arg, |
2522 | bool is_transactional_arg) : |
2523 | - unary_function<QueryCache *, bool>(), |
2524 | + unary_function<plugin::QueryCache *, bool>(), |
2525 | session(session_arg), dbname(dbname_arg), |
2526 | is_transactional(is_transactional_arg) { } |
2527 | |
2528 | inline result_type operator()(argument_type handler) |
2529 | { |
2530 | - if (handler->invalidate_db(session, dbname, is_transactional)) |
2531 | + if (handler->invalidateDb(session, dbname, is_transactional)) |
2532 | { |
2533 | errmsg_printf(ERRMSG_LVL_ERROR, |
2534 | - _("qcache plugin '%s' invalidate_db() failed"), |
2535 | + _("qcache plugin '%s' invalidateDb() failed"), |
2536 | handler->getName().c_str()); |
2537 | return true; |
2538 | } |
2539 | @@ -143,12 +132,12 @@ |
2540 | }; |
2541 | |
2542 | class FlushIterate |
2543 | - : public unary_function<QueryCache *, bool> |
2544 | + : public unary_function<plugin::QueryCache *, bool> |
2545 | { |
2546 | Session *session; |
2547 | public: |
2548 | FlushIterate(Session *session_arg) : |
2549 | - unary_function<QueryCache *, bool>(), session(session_arg) { } |
2550 | + unary_function<plugin::QueryCache *, bool>(), session(session_arg) { } |
2551 | |
2552 | inline result_type operator()(argument_type handler) |
2553 | { |
2554 | @@ -162,23 +151,23 @@ |
2555 | } |
2556 | }; |
2557 | |
2558 | -/* |
2559 | - Following functions: |
2560 | - |
2561 | - try_fetch_and_send(); |
2562 | - set(); |
2563 | - invalidate_table(); |
2564 | - invalidate_db(); |
2565 | - flush(); |
2566 | - |
2567 | - are the entry points to the query cache plugin that is called by the |
2568 | - rest of the Drizzle server code. |
2569 | -*/ |
2570 | - |
2571 | -bool try_fetch_and_send(Session *session, bool transactional) |
2572 | +void plugin::QueryCache::addPlugin(plugin::QueryCache *handler) |
2573 | +{ |
2574 | + all_query_cache.push_back(handler); |
2575 | +} |
2576 | + |
2577 | +void plugin::QueryCache::removePlugin(plugin::QueryCache *handler) |
2578 | +{ |
2579 | + all_query_cache.erase(find(all_query_cache.begin(), all_query_cache.end(), |
2580 | + handler)); |
2581 | +} |
2582 | + |
2583 | + |
2584 | +bool plugin::QueryCache::tryFetchAndSendDo(Session *session, |
2585 | + bool transactional) |
2586 | { |
2587 | /* Use find_if instead of foreach so that we can collect return codes */ |
2588 | - vector<QueryCache *>::iterator iter= |
2589 | + vector<plugin::QueryCache *>::iterator iter= |
2590 | find_if(all_query_cache.begin(), all_query_cache.end(), |
2591 | TryFetchAndSendIterate(session, transactional)); |
2592 | /* If iter is == end() here, that means that all of the plugins returned |
2593 | @@ -188,10 +177,10 @@ |
2594 | return iter != all_query_cache.end(); |
2595 | } |
2596 | |
2597 | -bool set(Session *session, bool transactional) |
2598 | +bool plugin::QueryCache::setDo(Session *session, bool transactional) |
2599 | { |
2600 | /* Use find_if instead of foreach so that we can collect return codes */ |
2601 | - vector<QueryCache *>::iterator iter= |
2602 | + vector<plugin::QueryCache *>::iterator iter= |
2603 | find_if(all_query_cache.begin(), all_query_cache.end(), |
2604 | SetIterate(session, transactional)); |
2605 | /* If iter is == end() here, that means that all of the plugins returned |
2606 | @@ -201,10 +190,11 @@ |
2607 | return iter != all_query_cache.end(); |
2608 | } |
2609 | |
2610 | -bool invalidate_table(Session *session, bool transactional) |
2611 | +bool plugin::QueryCache::invalidateTableDo(Session *session, |
2612 | + bool transactional) |
2613 | { |
2614 | /* Use find_if instead of foreach so that we can collect return codes */ |
2615 | - vector<QueryCache *>::iterator iter= |
2616 | + vector<plugin::QueryCache *>::iterator iter= |
2617 | find_if(all_query_cache.begin(), all_query_cache.end(), |
2618 | InvalidateTableIterate(session, transactional)); |
2619 | /* If iter is == end() here, that means that all of the plugins returned |
2620 | @@ -214,11 +204,11 @@ |
2621 | return iter != all_query_cache.end(); |
2622 | } |
2623 | |
2624 | -bool invalidate_db(Session *session, const char *dbname, |
2625 | - bool transactional) |
2626 | +bool plugin::QueryCache::invalidateDbDo(Session *session, const char *dbname, |
2627 | + bool transactional) |
2628 | { |
2629 | /* Use find_if instead of foreach so that we can collect return codes */ |
2630 | - vector<QueryCache *>::iterator iter= |
2631 | + vector<plugin::QueryCache *>::iterator iter= |
2632 | find_if(all_query_cache.begin(), all_query_cache.end(), |
2633 | InvalidateDbIterate(session, dbname, transactional)); |
2634 | /* If iter is == end() here, that means that all of the plugins returned |
2635 | @@ -228,10 +218,10 @@ |
2636 | return iter != all_query_cache.end(); |
2637 | } |
2638 | |
2639 | -bool flush(Session *session) |
2640 | +bool plugin::QueryCache::flushDo(Session *session) |
2641 | { |
2642 | /* Use find_if instead of foreach so that we can collect return codes */ |
2643 | - vector<QueryCache *>::iterator iter= |
2644 | + vector<plugin::QueryCache *>::iterator iter= |
2645 | find_if(all_query_cache.begin(), all_query_cache.end(), |
2646 | FlushIterate(session)); |
2647 | /* If iter is == end() here, that means that all of the plugins returned |
2648 | @@ -241,6 +231,4 @@ |
2649 | return iter != all_query_cache.end(); |
2650 | } |
2651 | |
2652 | -} /* namespace query_cache */ |
2653 | } /* namespace drizzled */ |
2654 | - |
2655 | |
2656 | === renamed file 'drizzled/plugin/qcache.h' => 'drizzled/plugin/query_cache.h' |
2657 | --- drizzled/plugin/qcache.h 2009-05-11 17:50:22 +0000 |
2658 | +++ drizzled/plugin/query_cache.h 2009-09-30 20:58:10 +0000 |
2659 | @@ -23,6 +23,11 @@ |
2660 | #ifndef DRIZZLED_PLUGIN_QUERY_CACHE_H |
2661 | #define DRIZZLED_PLUGIN_QUERY_CACHE_H |
2662 | |
2663 | +namespace drizzled |
2664 | +{ |
2665 | +namespace plugin |
2666 | +{ |
2667 | + |
2668 | /* |
2669 | This is the API that a qcache plugin must implement. |
2670 | it should implement each of these function pointers. |
2671 | @@ -43,14 +48,28 @@ |
2672 | |
2673 | virtual ~QueryCache() {} |
2674 | /* Lookup the cache and transmit the data back to the client */ |
2675 | - virtual bool try_fetch_and_send(Session *session, |
2676 | - bool is_transactional)= 0; |
2677 | + virtual bool tryFetchAndSend(Session *session, |
2678 | + bool is_transactional)= 0; |
2679 | |
2680 | virtual bool set(Session *session, bool is_transactional)= 0; |
2681 | - virtual bool invalidate_table(Session *session, bool is_transactional)= 0; |
2682 | - virtual bool invalidate_db(Session *session, const char *db_name, |
2683 | - bool transactional)= 0; |
2684 | + virtual bool invalidateTable(Session *session, bool is_transactional)= 0; |
2685 | + virtual bool invalidateDb(Session *session, const char *db_name, |
2686 | + bool transactional)= 0; |
2687 | virtual bool flush(Session *session)= 0; |
2688 | + |
2689 | + static void addPlugin(QueryCache *handler); |
2690 | + static void removePlugin(QueryCache *handler); |
2691 | + |
2692 | + /* These are the functions called by the rest of the Drizzle server */ |
2693 | + static bool tryFetchAndSendDo(Session *session, bool transactional); |
2694 | + static bool setDo(Session *session, bool transactional); |
2695 | + static bool invalidateTableDo(Session *session, bool transactional); |
2696 | + static bool invalidateDbDo(Session *session, const char *db_name, |
2697 | + bool transactional); |
2698 | + static bool flushDo(Session *session); |
2699 | }; |
2700 | |
2701 | +} /* namespace plugin */ |
2702 | +} /* namespace drizzled */ |
2703 | + |
2704 | #endif /* DRIZZLED_PLUGIN_QUERY_CACHE_H */ |
2705 | |
2706 | === modified file 'drizzled/plugin/registry.cc' |
2707 | --- drizzled/plugin/registry.cc 2009-09-16 17:10:18 +0000 |
2708 | +++ drizzled/plugin/registry.cc 2009-09-30 20:58:10 +0000 |
2709 | @@ -23,20 +23,15 @@ |
2710 | #include "drizzled/plugin.h" |
2711 | #include "drizzled/show.h" |
2712 | #include "drizzled/handler.h" |
2713 | -#include "drizzled/errmsg.h" |
2714 | -#include "drizzled/authentication.h" |
2715 | -#include "drizzled/qcache.h" |
2716 | -#include "drizzled/scheduling.h" |
2717 | -#include "drizzled/logging.h" |
2718 | -#include "drizzled/replication_services.h" |
2719 | |
2720 | #include <string> |
2721 | #include <vector> |
2722 | #include <map> |
2723 | |
2724 | using namespace std; |
2725 | -using namespace drizzled; |
2726 | |
2727 | +namespace drizzled |
2728 | +{ |
2729 | |
2730 | plugin::Handle *plugin::Registry::find(const LEX_STRING *name) |
2731 | { |
2732 | @@ -60,7 +55,7 @@ |
2733 | } |
2734 | |
2735 | |
2736 | -vector<plugin::Handle *> plugin::Registry::get_list(bool active) |
2737 | +vector<plugin::Handle *> plugin::Registry::getList(bool active) |
2738 | { |
2739 | plugin::Handle *plugin= NULL; |
2740 | |
2741 | @@ -82,94 +77,4 @@ |
2742 | return plugins; |
2743 | } |
2744 | |
2745 | -void plugin::Registry::add(StorageEngine *engine) |
2746 | -{ |
2747 | - add_storage_engine(engine); |
2748 | -} |
2749 | - |
2750 | -void plugin::Registry::add(InfoSchemaTable *schema_table) |
2751 | -{ |
2752 | - add_infoschema_table(schema_table); |
2753 | -} |
2754 | - |
2755 | -void plugin::Registry::add(Logging_handler *handler) |
2756 | -{ |
2757 | - add_logger(handler); |
2758 | -} |
2759 | - |
2760 | -void plugin::Registry::add(Error_message_handler *handler) |
2761 | -{ |
2762 | - add_errmsg_handler(handler); |
2763 | -} |
2764 | - |
2765 | -void plugin::Registry::add(Authentication *auth) |
2766 | -{ |
2767 | - add_authentication(auth); |
2768 | -} |
2769 | - |
2770 | -void plugin::Registry::add(QueryCache *qcache) |
2771 | -{ |
2772 | - add_query_cache(qcache); |
2773 | -} |
2774 | - |
2775 | -void plugin::Registry::add(plugin::SchedulerFactory *factory) |
2776 | -{ |
2777 | - add_scheduler_factory(factory); |
2778 | -} |
2779 | - |
2780 | - |
2781 | -void plugin::Registry::add(drizzled::plugin::CommandReplicator *replicator) |
2782 | -{ |
2783 | - add_replicator(replicator); |
2784 | -} |
2785 | - |
2786 | -void plugin::Registry::add(drizzled::plugin::CommandApplier *applier) |
2787 | -{ |
2788 | - add_applier(applier); |
2789 | -} |
2790 | - |
2791 | -void plugin::Registry::remove(StorageEngine *engine) |
2792 | -{ |
2793 | - remove_storage_engine(engine); |
2794 | -} |
2795 | - |
2796 | -void plugin::Registry::remove(InfoSchemaTable *schema_table) |
2797 | -{ |
2798 | - remove_infoschema_table(schema_table); |
2799 | -} |
2800 | - |
2801 | -void plugin::Registry::remove(Logging_handler *handler) |
2802 | -{ |
2803 | - remove_logger(handler); |
2804 | -} |
2805 | - |
2806 | -void plugin::Registry::remove(Error_message_handler *handler) |
2807 | -{ |
2808 | - remove_errmsg_handler(handler); |
2809 | -} |
2810 | - |
2811 | -void plugin::Registry::remove(Authentication *auth) |
2812 | -{ |
2813 | - remove_authentication(auth); |
2814 | -} |
2815 | - |
2816 | -void plugin::Registry::remove(QueryCache *qcache) |
2817 | -{ |
2818 | - remove_query_cache(qcache); |
2819 | -} |
2820 | - |
2821 | -void plugin::Registry::remove(plugin::SchedulerFactory *factory) |
2822 | -{ |
2823 | - remove_scheduler_factory(factory); |
2824 | -} |
2825 | - |
2826 | - |
2827 | -void plugin::Registry::remove(drizzled::plugin::CommandReplicator *replicator) |
2828 | -{ |
2829 | - remove_replicator(replicator); |
2830 | -} |
2831 | - |
2832 | -void plugin::Registry::remove(drizzled::plugin::CommandApplier *applier) |
2833 | -{ |
2834 | - remove_applier(applier); |
2835 | -} |
2836 | +} /* namespace drizzled */ |
2837 | |
2838 | === modified file 'drizzled/plugin/registry.h' |
2839 | --- drizzled/plugin/registry.h 2009-09-16 20:04:11 +0000 |
2840 | +++ drizzled/plugin/registry.h 2009-09-30 20:58:10 +0000 |
2841 | @@ -20,28 +20,16 @@ |
2842 | #ifndef DRIZZLED_PLUGIN_REGISTRY_H |
2843 | #define DRIZZLED_PLUGIN_REGISTRY_H |
2844 | |
2845 | -#include "drizzled/slot/function.h" |
2846 | -#include "drizzled/slot/listen.h" |
2847 | - |
2848 | #include <string> |
2849 | #include <vector> |
2850 | #include <map> |
2851 | |
2852 | -class StorageEngine; |
2853 | -class InfoSchemaTable; |
2854 | -class Logging_handler; |
2855 | -class Error_message_handler; |
2856 | -class Authentication; |
2857 | -class QueryCache; |
2858 | |
2859 | namespace drizzled |
2860 | { |
2861 | namespace plugin |
2862 | { |
2863 | -class CommandReplicator; |
2864 | -class CommandApplier; |
2865 | class Handle; |
2866 | -class SchedulerFactory; |
2867 | |
2868 | class Registry |
2869 | { |
2870 | @@ -63,30 +51,20 @@ |
2871 | |
2872 | void add(Handle *plugin); |
2873 | |
2874 | - std::vector<Handle *> get_list(bool active); |
2875 | - |
2876 | - void add(StorageEngine *engine); |
2877 | - void add(InfoSchemaTable *schema_table); |
2878 | - void add(Logging_handler *handler); |
2879 | - void add(Error_message_handler *handler); |
2880 | - void add(Authentication *auth); |
2881 | - void add(QueryCache *qcache); |
2882 | - void add(SchedulerFactory *scheduler); |
2883 | - void add(drizzled::plugin::CommandReplicator *replicator); |
2884 | - void add(drizzled::plugin::CommandApplier *applier); |
2885 | - |
2886 | - void remove(StorageEngine *engine); |
2887 | - void remove(InfoSchemaTable *schema_table); |
2888 | - void remove(Logging_handler *handler); |
2889 | - void remove(Error_message_handler *handler); |
2890 | - void remove(Authentication *auth); |
2891 | - void remove(QueryCache *qcache); |
2892 | - void remove(SchedulerFactory *scheduler); |
2893 | - void remove(drizzled::plugin::CommandReplicator *replicator); |
2894 | - void remove(drizzled::plugin::CommandApplier *applier); |
2895 | - |
2896 | - ::drizzled::slot::Function function; |
2897 | - ::drizzled::slot::Listen listen; |
2898 | + std::vector<Handle *> getList(bool active); |
2899 | + |
2900 | + template<class T> |
2901 | + void add(T *plugin) |
2902 | + { |
2903 | + T::addPlugin(plugin); |
2904 | + } |
2905 | + |
2906 | + template<class T> |
2907 | + void remove(T *plugin) |
2908 | + { |
2909 | + T::removePlugin(plugin); |
2910 | + } |
2911 | + |
2912 | }; |
2913 | |
2914 | } /* end namespace plugin */ |
2915 | |
2916 | === renamed file 'drizzled/scheduling.cc' => 'drizzled/plugin/scheduler.cc' |
2917 | --- drizzled/scheduling.cc 2009-08-05 09:29:04 +0000 |
2918 | +++ drizzled/plugin/scheduler.cc 2009-09-30 20:58:10 +0000 |
2919 | @@ -17,19 +17,21 @@ |
2920 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
2921 | */ |
2922 | |
2923 | -#include <drizzled/server_includes.h> |
2924 | -#include <drizzled/scheduling.h> |
2925 | -#include <drizzled/gettext.h> |
2926 | +#include "drizzled/server_includes.h" |
2927 | +#include "drizzled/plugin/scheduler.h" |
2928 | #include "drizzled/plugin/registry.h" |
2929 | -#include "drizzled/registry.h" |
2930 | + |
2931 | +#include "drizzled/gettext.h" |
2932 | |
2933 | using namespace std; |
2934 | -using namespace drizzled; |
2935 | + |
2936 | +namespace drizzled |
2937 | +{ |
2938 | |
2939 | plugin::SchedulerFactory *scheduler_factory= NULL; |
2940 | Registry<plugin::SchedulerFactory *> all_schedulers; |
2941 | |
2942 | -bool add_scheduler_factory(plugin::SchedulerFactory *factory) |
2943 | +void plugin::SchedulerFactory::addPlugin(plugin::SchedulerFactory *factory) |
2944 | { |
2945 | if (all_schedulers.count(factory->getName()) != 0) |
2946 | { |
2947 | @@ -37,22 +39,20 @@ |
2948 | _("Attempted to register a scheduler %s, but a scheduler " |
2949 | "has already been registered with that name.\n"), |
2950 | factory->getName().c_str()); |
2951 | - return true; |
2952 | + return; |
2953 | } |
2954 | all_schedulers.add(factory); |
2955 | - return false; |
2956 | } |
2957 | |
2958 | |
2959 | -bool remove_scheduler_factory(plugin::SchedulerFactory *factory) |
2960 | +void plugin::SchedulerFactory::removePlugin(plugin::SchedulerFactory *factory) |
2961 | { |
2962 | scheduler_factory= NULL; |
2963 | all_schedulers.remove(factory); |
2964 | - return false; |
2965 | } |
2966 | |
2967 | |
2968 | -bool set_scheduler_factory(const string& name) |
2969 | +bool plugin::SchedulerFactory::setFactory(const string& name) |
2970 | { |
2971 | |
2972 | plugin::SchedulerFactory *factory= all_schedulers.find(name); |
2973 | @@ -68,7 +68,7 @@ |
2974 | return false; |
2975 | } |
2976 | |
2977 | -plugin::Scheduler *get_thread_scheduler() |
2978 | +plugin::Scheduler *plugin::SchedulerFactory::getScheduler() |
2979 | { |
2980 | assert(scheduler_factory != NULL); |
2981 | plugin::Scheduler *sched= (*scheduler_factory)(); |
2982 | @@ -80,3 +80,4 @@ |
2983 | return sched; |
2984 | } |
2985 | |
2986 | +} /* namespace drizzled */ |
2987 | |
2988 | === modified file 'drizzled/plugin/scheduler.h' |
2989 | --- drizzled/plugin/scheduler.h 2009-08-05 05:46:11 +0000 |
2990 | +++ drizzled/plugin/scheduler.h 2009-09-30 20:58:10 +0000 |
2991 | @@ -75,6 +75,12 @@ |
2992 | { |
2993 | aliases.push_back(alias); |
2994 | } |
2995 | + |
2996 | + static void addPlugin(plugin::SchedulerFactory *factory); |
2997 | + static void removePlugin(plugin::SchedulerFactory *factory); |
2998 | + static bool setFactory(const std::string& name); |
2999 | + static plugin::Scheduler *getScheduler(); |
3000 | + |
3001 | }; |
3002 | |
3003 | } /* end namespace drizzled::plugin */ |
3004 | |
3005 | === modified file 'drizzled/plugin/storage_engine.cc' |
3006 | --- drizzled/plugin/storage_engine.cc 2009-08-19 23:35:29 +0000 |
3007 | +++ drizzled/plugin/storage_engine.cc 2009-09-30 20:58:10 +0000 |
3008 | @@ -18,6 +18,19 @@ |
3009 | */ |
3010 | |
3011 | #include <drizzled/server_includes.h> |
3012 | + |
3013 | +#include CSTDINT_H |
3014 | +#include <string> |
3015 | +#include <vector> |
3016 | +#include <algorithm> |
3017 | +#include <functional> |
3018 | + |
3019 | +#include <google/protobuf/io/zero_copy_stream.h> |
3020 | +#include <google/protobuf/io/zero_copy_stream_impl.h> |
3021 | + |
3022 | +#include "mysys/my_dir.h" |
3023 | +#include "mysys/hash.h" |
3024 | + |
3025 | #include <drizzled/definitions.h> |
3026 | #include <drizzled/base.h> |
3027 | #include <drizzled/handler.h> |
3028 | @@ -28,37 +41,24 @@ |
3029 | #include <drizzled/registry.h> |
3030 | #include <drizzled/unireg.h> |
3031 | #include <drizzled/data_home.h> |
3032 | +#include "drizzled/errmsg_print.h" |
3033 | #include <drizzled/plugin/registry.h> |
3034 | -#include <string> |
3035 | +#include "drizzled/xid.h" |
3036 | |
3037 | #include <drizzled/table_proto.h> |
3038 | |
3039 | -#include <google/protobuf/io/zero_copy_stream.h> |
3040 | -#include <google/protobuf/io/zero_copy_stream_impl.h> |
3041 | - |
3042 | -#include <mysys/my_dir.h> |
3043 | - |
3044 | -#include CSTDINT_H |
3045 | - |
3046 | using namespace std; |
3047 | -using namespace drizzled; |
3048 | - |
3049 | -drizzled::Registry<StorageEngine *> all_engines; |
3050 | - |
3051 | -void add_storage_engine(StorageEngine *engine) |
3052 | -{ |
3053 | - all_engines.add(engine); |
3054 | -} |
3055 | - |
3056 | -void remove_storage_engine(StorageEngine *engine) |
3057 | -{ |
3058 | - all_engines.remove(engine); |
3059 | -} |
3060 | - |
3061 | -StorageEngine::StorageEngine(const std::string name_arg, |
3062 | - const std::bitset<HTON_BIT_SIZE> &flags_arg, |
3063 | - size_t savepoint_offset_arg, |
3064 | - bool support_2pc) |
3065 | + |
3066 | + |
3067 | +namespace drizzled |
3068 | +{ |
3069 | + |
3070 | +Registry<plugin::StorageEngine *> all_engines; |
3071 | + |
3072 | +plugin::StorageEngine::StorageEngine(const string name_arg, |
3073 | + const bitset<HTON_BIT_SIZE> &flags_arg, |
3074 | + size_t savepoint_offset_arg, |
3075 | + bool support_2pc) |
3076 | : name(name_arg), two_phase_commit(support_2pc), enabled(true), |
3077 | flags(flags_arg), |
3078 | savepoint_offset(savepoint_alloc_size), |
3079 | @@ -75,12 +75,12 @@ |
3080 | } |
3081 | |
3082 | |
3083 | -StorageEngine::~StorageEngine() |
3084 | +plugin::StorageEngine::~StorageEngine() |
3085 | { |
3086 | savepoint_alloc_size-= orig_savepoint_offset; |
3087 | } |
3088 | |
3089 | -void StorageEngine::setTransactionReadWrite(Session* session) |
3090 | +void plugin::StorageEngine::setTransactionReadWrite(Session* session) |
3091 | { |
3092 | Ha_trx_info *ha_info= &session->ha_data[getSlot()].ha_info[0]; |
3093 | /* |
3094 | @@ -102,41 +102,107 @@ |
3095 | } |
3096 | |
3097 | |
3098 | -/** |
3099 | - Return the default storage engine StorageEngine for thread |
3100 | - |
3101 | - @param ha_default_storage_engine(session) |
3102 | - @param session current thread |
3103 | - |
3104 | - @return |
3105 | - pointer to StorageEngine |
3106 | -*/ |
3107 | -StorageEngine *ha_default_storage_engine(Session *session) |
3108 | -{ |
3109 | - if (session->variables.storage_engine) |
3110 | - return session->variables.storage_engine; |
3111 | - return global_system_variables.storage_engine; |
3112 | -} |
3113 | - |
3114 | - |
3115 | -/** |
3116 | - Return the storage engine StorageEngine for the supplied name |
3117 | - |
3118 | - @param session current thread |
3119 | - @param name name of storage engine |
3120 | - |
3121 | - @return |
3122 | - pointer to storage engine plugin handle |
3123 | -*/ |
3124 | -StorageEngine *ha_resolve_by_name(Session *session, std::string find_str) |
3125 | -{ |
3126 | + |
3127 | +int plugin::StorageEngine::renameTableImplementation(Session *, |
3128 | + const char *from, |
3129 | + const char *to) |
3130 | +{ |
3131 | + int error= 0; |
3132 | + for (const char **ext= bas_ext(); *ext ; ext++) |
3133 | + { |
3134 | + if (rename_file_ext(from, to, *ext)) |
3135 | + { |
3136 | + if ((error=my_errno) != ENOENT) |
3137 | + break; |
3138 | + error= 0; |
3139 | + } |
3140 | + } |
3141 | + return error; |
3142 | +} |
3143 | + |
3144 | + |
3145 | +/** |
3146 | + Delete all files with extension from bas_ext(). |
3147 | + |
3148 | + @param name Base name of table |
3149 | + |
3150 | + @note |
3151 | + We assume that the handler may return more extensions than |
3152 | + was actually used for the file. |
3153 | + |
3154 | + @retval |
3155 | + 0 If we successfully deleted at least one file from base_ext and |
3156 | + didn't get any other errors than ENOENT |
3157 | + @retval |
3158 | + !0 Error |
3159 | +*/ |
3160 | +int plugin::StorageEngine::deleteTableImplementation(Session *, |
3161 | + const string table_path) |
3162 | +{ |
3163 | + int error= 0; |
3164 | + int enoent_or_zero= ENOENT; // Error if no file was deleted |
3165 | + char buff[FN_REFLEN]; |
3166 | + |
3167 | + for (const char **ext=bas_ext(); *ext ; ext++) |
3168 | + { |
3169 | + fn_format(buff, table_path.c_str(), "", *ext, |
3170 | + MY_UNPACK_FILENAME|MY_APPEND_EXT); |
3171 | + if (my_delete_with_symlink(buff, MYF(0))) |
3172 | + { |
3173 | + if ((error= my_errno) != ENOENT) |
3174 | + break; |
3175 | + } |
3176 | + else |
3177 | + enoent_or_zero= 0; // No error for ENOENT |
3178 | + error= enoent_or_zero; |
3179 | + } |
3180 | + return error; |
3181 | +} |
3182 | + |
3183 | +const char *plugin::StorageEngine::checkLowercaseNames(const char *path, |
3184 | + char *tmp_path) |
3185 | +{ |
3186 | + if (flags.test(HTON_BIT_FILE_BASED)) |
3187 | + return path; |
3188 | + |
3189 | + /* Ensure that table handler get path in lower case */ |
3190 | + if (tmp_path != path) |
3191 | + strcpy(tmp_path, path); |
3192 | + |
3193 | + /* |
3194 | + we only should turn into lowercase database/table part |
3195 | + so start the process after homedirectory |
3196 | + */ |
3197 | + if (strstr(tmp_path, drizzle_tmpdir) == tmp_path) |
3198 | + my_casedn_str(files_charset_info, tmp_path + strlen(drizzle_tmpdir)); |
3199 | + else |
3200 | + my_casedn_str(files_charset_info, tmp_path + drizzle_data_home_len); |
3201 | + |
3202 | + return tmp_path; |
3203 | +} |
3204 | + |
3205 | + |
3206 | +void plugin::StorageEngine::addPlugin(plugin::StorageEngine *engine) |
3207 | +{ |
3208 | + all_engines.add(engine); |
3209 | +} |
3210 | + |
3211 | +void plugin::StorageEngine::removePlugin(plugin::StorageEngine *engine) |
3212 | +{ |
3213 | + all_engines.remove(engine); |
3214 | +} |
3215 | + |
3216 | +plugin::StorageEngine *plugin::StorageEngine::findByName(Session *session, |
3217 | + string find_str) |
3218 | +{ |
3219 | + |
3220 | transform(find_str.begin(), find_str.end(), |
3221 | find_str.begin(), ::tolower); |
3222 | string default_str("default"); |
3223 | if (find_str == default_str) |
3224 | return ha_default_storage_engine(session); |
3225 | |
3226 | - StorageEngine *engine= all_engines.find(find_str); |
3227 | + plugin::StorageEngine *engine= all_engines.find(find_str); |
3228 | |
3229 | if (engine && engine->is_user_selectable()) |
3230 | return engine; |
3231 | @@ -144,28 +210,8 @@ |
3232 | return NULL; |
3233 | } |
3234 | |
3235 | - |
3236 | -handler *get_new_handler(TableShare *share, MEM_ROOT *alloc, |
3237 | - StorageEngine *engine) |
3238 | -{ |
3239 | - handler *file; |
3240 | - |
3241 | - if (engine && engine->is_enabled()) |
3242 | - { |
3243 | - if ((file= engine->create(share, alloc))) |
3244 | - file->init(); |
3245 | - return(file); |
3246 | - } |
3247 | - /* |
3248 | - Try the default table type |
3249 | - Here the call to current_session() is ok as we call this function a lot of |
3250 | - times but we enter this branch very seldom. |
3251 | - */ |
3252 | - return(get_new_handler(share, alloc, ha_default_storage_engine(current_session))); |
3253 | -} |
3254 | - |
3255 | class StorageEngineCloseConnection |
3256 | - : public unary_function<StorageEngine *, void> |
3257 | + : public unary_function<plugin::StorageEngine *, void> |
3258 | { |
3259 | Session *session; |
3260 | public: |
3261 | @@ -186,28 +232,28 @@ |
3262 | @note |
3263 | don't bother to rollback here, it's done already |
3264 | */ |
3265 | -void ha_close_connection(Session* session) |
3266 | +void plugin::StorageEngine::closeConnection(Session* session) |
3267 | { |
3268 | for_each(all_engines.begin(), all_engines.end(), |
3269 | StorageEngineCloseConnection(session)); |
3270 | } |
3271 | |
3272 | -void ha_drop_database(char* path) |
3273 | +void plugin::StorageEngine::dropDatabase(char* path) |
3274 | { |
3275 | for_each(all_engines.begin(), all_engines.end(), |
3276 | - bind2nd(mem_fun(&StorageEngine::drop_database),path)); |
3277 | + bind2nd(mem_fun(&plugin::StorageEngine::drop_database),path)); |
3278 | } |
3279 | |
3280 | -int ha_commit_or_rollback_by_xid(XID *xid, bool commit) |
3281 | +int plugin::StorageEngine::commitOrRollbackByXID(XID *xid, bool commit) |
3282 | { |
3283 | vector<int> results; |
3284 | |
3285 | if (commit) |
3286 | transform(all_engines.begin(), all_engines.end(), results.begin(), |
3287 | - bind2nd(mem_fun(&StorageEngine::commit_by_xid),xid)); |
3288 | + bind2nd(mem_fun(&plugin::StorageEngine::commit_by_xid),xid)); |
3289 | else |
3290 | transform(all_engines.begin(), all_engines.end(), results.begin(), |
3291 | - bind2nd(mem_fun(&StorageEngine::rollback_by_xid),xid)); |
3292 | + bind2nd(mem_fun(&plugin::StorageEngine::rollback_by_xid),xid)); |
3293 | |
3294 | if (find_if(results.begin(), results.end(), bind2nd(equal_to<int>(),0)) |
3295 | == results.end()) |
3296 | @@ -215,7 +261,6 @@ |
3297 | return 0; |
3298 | } |
3299 | |
3300 | - |
3301 | /** |
3302 | @details |
3303 | This function should be called when MySQL sends rows of a SELECT result set |
3304 | @@ -234,20 +279,19 @@ |
3305 | @return |
3306 | always 0 |
3307 | */ |
3308 | -int ha_release_temporary_latches(Session *session) |
3309 | +int plugin::StorageEngine::releaseTemporaryLatches(Session *session) |
3310 | { |
3311 | for_each(all_engines.begin(), all_engines.end(), |
3312 | - bind2nd(mem_fun(&StorageEngine::release_temporary_latches),session)); |
3313 | + bind2nd(mem_fun(&plugin::StorageEngine::release_temporary_latches),session)); |
3314 | return 0; |
3315 | } |
3316 | |
3317 | - |
3318 | -bool ha_flush_logs(StorageEngine *engine) |
3319 | +bool plugin::StorageEngine::flushLogs(plugin::StorageEngine *engine) |
3320 | { |
3321 | if (engine == NULL) |
3322 | { |
3323 | if (find_if(all_engines.begin(), all_engines.end(), |
3324 | - mem_fun(&StorageEngine::flush_logs)) |
3325 | + mem_fun(&plugin::StorageEngine::flush_logs)) |
3326 | != all_engines.begin()) |
3327 | return true; |
3328 | } |
3329 | @@ -276,7 +320,7 @@ |
3330 | in this case commit_list==0, tc_heuristic_recover == 0 |
3331 | there should be no prepared transactions in this case. |
3332 | */ |
3333 | -class XARecover : unary_function<StorageEngine *, void> |
3334 | +class XARecover : unary_function<plugin::StorageEngine *, void> |
3335 | { |
3336 | int trans_len, found_foreign_xids, found_my_xids; |
3337 | bool result; |
3338 | @@ -345,10 +389,9 @@ |
3339 | } |
3340 | } |
3341 | } |
3342 | - |
3343 | }; |
3344 | |
3345 | -int ha_recover(HASH *commit_list) |
3346 | +int plugin::StorageEngine::recover(HASH *commit_list) |
3347 | { |
3348 | XID *trans_list= NULL; |
3349 | int trans_len= 0; |
3350 | @@ -414,13 +457,36 @@ |
3351 | return(0); |
3352 | } |
3353 | |
3354 | -int ha_start_consistent_snapshot(Session *session) |
3355 | +int plugin::StorageEngine::startConsistentSnapshot(Session *session) |
3356 | { |
3357 | for_each(all_engines.begin(), all_engines.end(), |
3358 | - bind2nd(mem_fun(&StorageEngine::start_consistent_snapshot),session)); |
3359 | + bind2nd(mem_fun(&plugin::StorageEngine::start_consistent_snapshot), |
3360 | + session)); |
3361 | return 0; |
3362 | } |
3363 | |
3364 | +class StorageEngineGetTableProto: public unary_function<plugin::StorageEngine *,bool> |
3365 | +{ |
3366 | + const char* path; |
3367 | + message::Table *table_proto; |
3368 | + int *err; |
3369 | +public: |
3370 | + StorageEngineGetTableProto(const char* path_arg, |
3371 | + message::Table *table_proto_arg, |
3372 | + int *err_arg) |
3373 | + :path(path_arg), table_proto(table_proto_arg), err(err_arg) {} |
3374 | + |
3375 | + result_type operator() (argument_type engine) |
3376 | + { |
3377 | + int ret= engine->getTableProtoImplementation(path, table_proto); |
3378 | + |
3379 | + if (ret != ENOENT) |
3380 | + *err= ret; |
3381 | + |
3382 | + return *err == EEXIST; |
3383 | + } |
3384 | +}; |
3385 | + |
3386 | static int drizzle_read_table_proto(const char* path, message::Table* table) |
3387 | { |
3388 | int fd= open(path, O_RDONLY); |
3389 | @@ -443,39 +509,17 @@ |
3390 | return 0; |
3391 | } |
3392 | |
3393 | -class StorageEngineGetTableProto: public unary_function<StorageEngine *,bool> |
3394 | -{ |
3395 | - const char* path; |
3396 | - message::Table *table_proto; |
3397 | - int *err; |
3398 | -public: |
3399 | - StorageEngineGetTableProto(const char* path_arg, |
3400 | - message::Table *table_proto_arg, |
3401 | - int *err_arg) |
3402 | - :path(path_arg), table_proto(table_proto_arg), err(err_arg) {} |
3403 | - |
3404 | - result_type operator() (argument_type engine) |
3405 | - { |
3406 | - int ret= engine->getTableProtoImplementation(path, table_proto); |
3407 | - |
3408 | - if (ret != ENOENT) |
3409 | - *err= ret; |
3410 | - |
3411 | - return *err == EEXIST; |
3412 | - } |
3413 | -}; |
3414 | - |
3415 | /** |
3416 | Call this function in order to give the handler the possiblity |
3417 | to ask engine if there are any new tables that should be written to disk |
3418 | or any dropped tables that need to be removed from disk |
3419 | */ |
3420 | -int StorageEngine::getTableProto(const char* path, |
3421 | - message::Table *table_proto) |
3422 | +int plugin::StorageEngine::getTableProto(const char* path, |
3423 | + message::Table *table_proto) |
3424 | { |
3425 | int err= ENOENT; |
3426 | |
3427 | - drizzled::Registry<StorageEngine *>::iterator iter= |
3428 | + ::drizzled::Registry<plugin::StorageEngine *>::iterator iter= |
3429 | find_if(all_engines.begin(), all_engines.end(), |
3430 | StorageEngineGetTableProto(path, table_proto, &err)); |
3431 | if (iter == all_engines.end()) |
3432 | @@ -504,60 +548,6 @@ |
3433 | return err; |
3434 | } |
3435 | |
3436 | - |
3437 | -int StorageEngine::renameTableImplementation(Session *, const char *from, const char *to) |
3438 | -{ |
3439 | - int error= 0; |
3440 | - for (const char **ext= bas_ext(); *ext ; ext++) |
3441 | - { |
3442 | - if (rename_file_ext(from, to, *ext)) |
3443 | - { |
3444 | - if ((error=my_errno) != ENOENT) |
3445 | - break; |
3446 | - error= 0; |
3447 | - } |
3448 | - } |
3449 | - return error; |
3450 | -} |
3451 | - |
3452 | - |
3453 | -/** |
3454 | - Delete all files with extension from bas_ext(). |
3455 | - |
3456 | - @param name Base name of table |
3457 | - |
3458 | - @note |
3459 | - We assume that the handler may return more extensions than |
3460 | - was actually used for the file. |
3461 | - |
3462 | - @retval |
3463 | - 0 If we successfully deleted at least one file from base_ext and |
3464 | - didn't get any other errors than ENOENT |
3465 | - @retval |
3466 | - !0 Error |
3467 | -*/ |
3468 | -int StorageEngine::deleteTableImplementation(Session *, const std::string table_path) |
3469 | -{ |
3470 | - int error= 0; |
3471 | - int enoent_or_zero= ENOENT; // Error if no file was deleted |
3472 | - char buff[FN_REFLEN]; |
3473 | - |
3474 | - for (const char **ext=bas_ext(); *ext ; ext++) |
3475 | - { |
3476 | - fn_format(buff, table_path.c_str(), "", *ext, |
3477 | - MY_UNPACK_FILENAME|MY_APPEND_EXT); |
3478 | - if (my_delete_with_symlink(buff, MYF(0))) |
3479 | - { |
3480 | - if ((error= my_errno) != ENOENT) |
3481 | - break; |
3482 | - } |
3483 | - else |
3484 | - enoent_or_zero= 0; // No error for ENOENT |
3485 | - error= enoent_or_zero; |
3486 | - } |
3487 | - return error; |
3488 | -} |
3489 | - |
3490 | /** |
3491 | An interceptor to hijack the text of the error message without |
3492 | setting an error in the thread. We need the text to present it |
3493 | @@ -590,7 +580,7 @@ |
3494 | |
3495 | |
3496 | class DeleteTableStorageEngine |
3497 | - : public unary_function<StorageEngine *, void> |
3498 | + : public unary_function<plugin::StorageEngine *, void> |
3499 | { |
3500 | Session *session; |
3501 | const char *path; |
3502 | @@ -621,7 +611,7 @@ |
3503 | return; |
3504 | |
3505 | path= engine->checkLowercaseNames(path, tmp_path); |
3506 | - const std::string table_path(path); |
3507 | + const string table_path(path); |
3508 | int tmp_error= engine->deleteTable(session, table_path); |
3509 | |
3510 | if (tmp_error != ENOENT) |
3511 | @@ -647,12 +637,14 @@ |
3512 | } |
3513 | }; |
3514 | |
3515 | + |
3516 | /** |
3517 | This should return ENOENT if the file doesn't exists. |
3518 | The .frm file will be deleted only if we return 0 or ENOENT |
3519 | */ |
3520 | -int ha_delete_table(Session *session, const char *path, |
3521 | - const char *db, const char *alias, bool generate_warning) |
3522 | +int plugin::StorageEngine::deleteTable(Session *session, const char *path, |
3523 | + const char *db, const char *alias, |
3524 | + bool generate_warning) |
3525 | { |
3526 | TableShare dummy_share; |
3527 | Table dummy_table; |
3528 | @@ -689,7 +681,6 @@ |
3529 | dummy_share.table_name.length= strlen(alias); |
3530 | dummy_table.alias= alias; |
3531 | |
3532 | - |
3533 | if(file != NULL) |
3534 | { |
3535 | file->change_table_ptr(&dummy_table, &dummy_share); |
3536 | @@ -716,101 +707,22 @@ |
3537 | return error; |
3538 | } |
3539 | |
3540 | -/** |
3541 | - Initiates table-file and calls appropriate database-creator. |
3542 | - |
3543 | - @retval |
3544 | - 0 ok |
3545 | - @retval |
3546 | - 1 error |
3547 | -*/ |
3548 | -int ha_create_table(Session *session, const char *path, |
3549 | - const char *db, const char *table_name, |
3550 | - HA_CREATE_INFO *create_info, |
3551 | - bool update_create_info, |
3552 | - message::Table *table_proto) |
3553 | -{ |
3554 | - int error= 1; |
3555 | - Table table; |
3556 | - TableShare share(db, 0, table_name, path); |
3557 | - message::Table tmp_proto; |
3558 | - |
3559 | - if (table_proto) |
3560 | - { |
3561 | - if (parse_table_proto(session, *table_proto, &share)) |
3562 | - goto err; |
3563 | - } |
3564 | - else |
3565 | - { |
3566 | - table_proto= &tmp_proto; |
3567 | - if (open_table_def(session, &share)) |
3568 | - goto err; |
3569 | - } |
3570 | - |
3571 | - if (open_table_from_share(session, &share, "", 0, (uint32_t) READ_ALL, 0, |
3572 | - &table, OTM_CREATE)) |
3573 | - goto err; |
3574 | - |
3575 | - if (update_create_info) |
3576 | - table.updateCreateInfo(create_info, table_proto); |
3577 | - |
3578 | - error= share.storage_engine->createTable(session, path, &table, |
3579 | - create_info, table_proto); |
3580 | - table.closefrm(false); |
3581 | - if (error) |
3582 | - { |
3583 | - char name_buff[FN_REFLEN]; |
3584 | - sprintf(name_buff,"%s.%s",db,table_name); |
3585 | - my_error(ER_CANT_CREATE_TABLE, MYF(ME_BELL+ME_WAITTANG), name_buff, error); |
3586 | - } |
3587 | -err: |
3588 | - share.free_table_share(); |
3589 | - return(error != 0); |
3590 | -} |
3591 | - |
3592 | - |
3593 | -const string ha_resolve_storage_engine_name(const StorageEngine *engine) |
3594 | -{ |
3595 | - return engine == NULL ? string("UNKNOWN") : engine->getName(); |
3596 | -} |
3597 | - |
3598 | -const char *StorageEngine::checkLowercaseNames(const char *path, char *tmp_path) |
3599 | -{ |
3600 | - if (flags.test(HTON_BIT_FILE_BASED)) |
3601 | - return path; |
3602 | - |
3603 | - /* Ensure that table handler get path in lower case */ |
3604 | - if (tmp_path != path) |
3605 | - strcpy(tmp_path, path); |
3606 | - |
3607 | - /* |
3608 | - we only should turn into lowercase database/table part |
3609 | - so start the process after homedirectory |
3610 | - */ |
3611 | - if (strstr(tmp_path, drizzle_tmpdir) == tmp_path) |
3612 | - my_casedn_str(files_charset_info, tmp_path + strlen(drizzle_tmpdir)); |
3613 | - else |
3614 | - my_casedn_str(files_charset_info, tmp_path + drizzle_data_home_len); |
3615 | - |
3616 | - return tmp_path; |
3617 | -} |
3618 | - |
3619 | -class DFETableNameIterator: public TableNameIteratorImplementation |
3620 | +class DFETableNameIterator: public plugin::TableNameIteratorImplementation |
3621 | { |
3622 | private: |
3623 | MY_DIR *dirp; |
3624 | uint32_t current_entry; |
3625 | |
3626 | public: |
3627 | - DFETableNameIterator(const std::string &database) |
3628 | - : TableNameIteratorImplementation(database), |
3629 | + DFETableNameIterator(const string &database) |
3630 | + : plugin::TableNameIteratorImplementation(database), |
3631 | dirp(NULL), |
3632 | current_entry(-1) |
3633 | {}; |
3634 | |
3635 | ~DFETableNameIterator(); |
3636 | |
3637 | - int next(std::string *name); |
3638 | + int next(string *name); |
3639 | |
3640 | }; |
3641 | |
3642 | @@ -880,33 +792,36 @@ |
3643 | } |
3644 | } |
3645 | |
3646 | -TableNameIterator::TableNameIterator(const std::string &db) |
3647 | + |
3648 | +plugin::TableNameIterator::TableNameIterator(const string &db) |
3649 | : current_implementation(NULL), database(db) |
3650 | { |
3651 | engine_iter= all_engines.begin(); |
3652 | default_implementation= new DFETableNameIterator(database); |
3653 | } |
3654 | |
3655 | -TableNameIterator::~TableNameIterator() |
3656 | +plugin::TableNameIterator::~TableNameIterator() |
3657 | { |
3658 | delete current_implementation; |
3659 | } |
3660 | |
3661 | -int TableNameIterator::next(std::string *name) |
3662 | +int plugin::TableNameIterator::next(string *name) |
3663 | { |
3664 | int err= 0; |
3665 | |
3666 | next: |
3667 | if (current_implementation == NULL) |
3668 | { |
3669 | - while(current_implementation == NULL && engine_iter != all_engines.end()) |
3670 | + while(current_implementation == NULL && |
3671 | + (engine_iter != all_engines.end())) |
3672 | { |
3673 | - StorageEngine *engine= *engine_iter; |
3674 | + plugin::StorageEngine *engine= *engine_iter; |
3675 | current_implementation= engine->tableNameIterator(database); |
3676 | engine_iter++; |
3677 | } |
3678 | |
3679 | - if (current_implementation == NULL && engine_iter == all_engines.end()) |
3680 | + if (current_implementation == NULL && |
3681 | + (engine_iter == all_engines.end())) |
3682 | { |
3683 | current_implementation= default_implementation; |
3684 | } |
3685 | @@ -927,3 +842,96 @@ |
3686 | return err; |
3687 | } |
3688 | |
3689 | + |
3690 | +} /* namespace drizzled */ |
3691 | + |
3692 | + |
3693 | + |
3694 | +handler *get_new_handler(TableShare *share, MEM_ROOT *alloc, |
3695 | + drizzled::plugin::StorageEngine *engine) |
3696 | +{ |
3697 | + handler *file; |
3698 | + |
3699 | + if (engine && engine->is_enabled()) |
3700 | + { |
3701 | + if ((file= engine->create(share, alloc))) |
3702 | + file->init(); |
3703 | + return(file); |
3704 | + } |
3705 | + /* |
3706 | + Try the default table type |
3707 | + Here the call to current_session() is ok as we call this function a lot of |
3708 | + times but we enter this branch very seldom. |
3709 | + */ |
3710 | + return(get_new_handler(share, alloc, ha_default_storage_engine(current_session))); |
3711 | +} |
3712 | + |
3713 | + |
3714 | +/** |
3715 | + Return the default storage engine plugin::StorageEngine for thread |
3716 | + |
3717 | + @param ha_default_storage_engine(session) |
3718 | + @param session current thread |
3719 | + |
3720 | + @return |
3721 | + pointer to plugin::StorageEngine |
3722 | +*/ |
3723 | +drizzled::plugin::StorageEngine *ha_default_storage_engine(Session *session) |
3724 | +{ |
3725 | + if (session->variables.storage_engine) |
3726 | + return session->variables.storage_engine; |
3727 | + return global_system_variables.storage_engine; |
3728 | +} |
3729 | + |
3730 | +/** |
3731 | + Initiates table-file and calls appropriate database-creator. |
3732 | + |
3733 | + @retval |
3734 | + 0 ok |
3735 | + @retval |
3736 | + 1 error |
3737 | +*/ |
3738 | +int ha_create_table(Session *session, const char *path, |
3739 | + const char *db, const char *table_name, |
3740 | + HA_CREATE_INFO *create_info, |
3741 | + bool update_create_info, |
3742 | + drizzled::message::Table *table_proto) |
3743 | +{ |
3744 | + int error= 1; |
3745 | + Table table; |
3746 | + TableShare share(db, 0, table_name, path); |
3747 | + drizzled::message::Table tmp_proto; |
3748 | + |
3749 | + if (table_proto) |
3750 | + { |
3751 | + if (parse_table_proto(session, *table_proto, &share)) |
3752 | + goto err; |
3753 | + } |
3754 | + else |
3755 | + { |
3756 | + table_proto= &tmp_proto; |
3757 | + if (open_table_def(session, &share)) |
3758 | + goto err; |
3759 | + } |
3760 | + |
3761 | + if (open_table_from_share(session, &share, "", 0, (uint32_t) READ_ALL, 0, |
3762 | + &table, OTM_CREATE)) |
3763 | + goto err; |
3764 | + |
3765 | + if (update_create_info) |
3766 | + table.updateCreateInfo(create_info, table_proto); |
3767 | + |
3768 | + error= share.storage_engine->createTable(session, path, &table, |
3769 | + create_info, table_proto); |
3770 | + table.closefrm(false); |
3771 | + if (error) |
3772 | + { |
3773 | + char name_buff[FN_REFLEN]; |
3774 | + sprintf(name_buff,"%s.%s",db,table_name); |
3775 | + my_error(ER_CANT_CREATE_TABLE, MYF(ME_BELL+ME_WAITTANG), name_buff, error); |
3776 | + } |
3777 | +err: |
3778 | + share.free_table_share(); |
3779 | + return(error != 0); |
3780 | +} |
3781 | + |
3782 | |
3783 | === modified file 'drizzled/plugin/storage_engine.h' |
3784 | --- drizzled/plugin/storage_engine.h 2009-08-22 02:06:02 +0000 |
3785 | +++ drizzled/plugin/storage_engine.h 2009-09-30 20:58:10 +0000 |
3786 | @@ -22,7 +22,7 @@ |
3787 | |
3788 | |
3789 | #include <drizzled/definitions.h> |
3790 | -#include <drizzled/sql_plugin.h> |
3791 | +#include <drizzled/plugin.h> |
3792 | #include <drizzled/handler_structs.h> |
3793 | #include <drizzled/message/table.pb.h> |
3794 | #include <drizzled/registry.h> |
3795 | @@ -41,7 +41,6 @@ |
3796 | typedef bool (stat_print_fn)(Session *session, const char *type, uint32_t type_len, |
3797 | const char *file, uint32_t file_len, |
3798 | const char *status, uint32_t status_len); |
3799 | -enum ha_stat_type { HA_ENGINE_STATUS, HA_ENGINE_LOGS, HA_ENGINE_MUTEX }; |
3800 | |
3801 | /* Possible flags of a StorageEngine (there can be 32 of them) */ |
3802 | enum engine_flag_bits { |
3803 | @@ -69,8 +68,15 @@ |
3804 | static const std::bitset<HTON_BIT_SIZE> HTON_HAS_DATA_DICTIONARY(1 << HTON_BIT_HAS_DATA_DICTIONARY); |
3805 | |
3806 | class Table; |
3807 | + |
3808 | +namespace drizzled |
3809 | +{ |
3810 | +namespace plugin |
3811 | +{ |
3812 | + |
3813 | +const std::string UNKNOWN_STRING("UNKNOWN"); |
3814 | + |
3815 | class TableNameIteratorImplementation; |
3816 | - |
3817 | /* |
3818 | StorageEngine is a singleton structure - one instance per storage engine - |
3819 | to provide access to storage engine functionality that works on the |
3820 | @@ -128,9 +134,6 @@ |
3821 | |
3822 | virtual ~StorageEngine(); |
3823 | |
3824 | - static int getTableProto(const char* path, |
3825 | - drizzled::message::Table *table_proto); |
3826 | - |
3827 | virtual int getTableProtoImplementation(const char* path, |
3828 | drizzled::message::Table *table_proto) |
3829 | { |
3830 | @@ -187,7 +190,7 @@ |
3831 | void enable() { enabled= true; } |
3832 | void disable() { enabled= false; } |
3833 | |
3834 | - std::string getName() const { return name; } |
3835 | + const std::string &getName() const { return name; } |
3836 | |
3837 | /* |
3838 | StorageEngine methods: |
3839 | @@ -325,6 +328,29 @@ |
3840 | (void)database; |
3841 | return NULL; |
3842 | } |
3843 | + |
3844 | + |
3845 | + static void addPlugin(plugin::StorageEngine *engine); |
3846 | + static void removePlugin(plugin::StorageEngine *engine); |
3847 | + |
3848 | + static int getTableProto(const char* path, message::Table *table_proto); |
3849 | + |
3850 | + static plugin::StorageEngine *findByName(Session *session, |
3851 | + std::string find_str); |
3852 | + static void closeConnection(Session* session); |
3853 | + static void dropDatabase(char* path); |
3854 | + static int commitOrRollbackByXID(XID *xid, bool commit); |
3855 | + static int releaseTemporaryLatches(Session *session); |
3856 | + static bool flushLogs(plugin::StorageEngine *db_type); |
3857 | + static int recover(HASH *commit_list); |
3858 | + static int startConsistentSnapshot(Session *session); |
3859 | + static int deleteTable(Session *session, const char *path, const char *db, |
3860 | + const char *alias, bool generate_warning); |
3861 | + static inline const std::string &resolveName(const StorageEngine *engine) |
3862 | + { |
3863 | + return engine == NULL ? UNKNOWN_STRING : engine->getName(); |
3864 | + } |
3865 | + |
3866 | }; |
3867 | |
3868 | class TableNameIteratorImplementation |
3869 | @@ -343,9 +369,9 @@ |
3870 | class TableNameIterator |
3871 | { |
3872 | private: |
3873 | - drizzled::Registry<StorageEngine *>::iterator engine_iter; |
3874 | - TableNameIteratorImplementation *current_implementation; |
3875 | - TableNameIteratorImplementation *default_implementation; |
3876 | + ::drizzled::Registry<plugin::StorageEngine *>::iterator engine_iter; |
3877 | + plugin::TableNameIteratorImplementation *current_implementation; |
3878 | + plugin::TableNameIteratorImplementation *default_implementation; |
3879 | std::string database; |
3880 | public: |
3881 | TableNameIterator(const std::string &db); |
3882 | @@ -354,12 +380,71 @@ |
3883 | int next(std::string *name); |
3884 | }; |
3885 | |
3886 | + |
3887 | +} /* namespace plugin */ |
3888 | +} /* namespace drizzled */ |
3889 | + |
3890 | /* lookups */ |
3891 | -StorageEngine *ha_default_storage_engine(Session *session); |
3892 | -StorageEngine *ha_resolve_by_name(Session *session, std::string find_str); |
3893 | +/** |
3894 | + Return the default storage engine plugin::StorageEngine for thread |
3895 | + |
3896 | + @param ha_default_storage_engine(session) |
3897 | + @param session current thread |
3898 | + |
3899 | + @return |
3900 | + pointer to plugin::StorageEngine |
3901 | +*/ |
3902 | +drizzled::plugin::StorageEngine *ha_default_storage_engine(Session *session); |
3903 | |
3904 | handler *get_new_handler(TableShare *share, MEM_ROOT *alloc, |
3905 | - StorageEngine *db_type); |
3906 | -const std::string ha_resolve_storage_engine_name(const StorageEngine *db_type); |
3907 | + drizzled::plugin::StorageEngine *db_type); |
3908 | + |
3909 | + |
3910 | + |
3911 | +/** @TODO remove each of the following convenience naming methods */ |
3912 | + |
3913 | +static inline void ha_close_connection(Session *session) |
3914 | +{ |
3915 | + drizzled::plugin::StorageEngine::closeConnection(session); |
3916 | +} |
3917 | + |
3918 | +static inline void ha_drop_database(char* path) |
3919 | +{ |
3920 | + drizzled::plugin::StorageEngine::dropDatabase(path); |
3921 | +} |
3922 | + |
3923 | +static inline int ha_commit_or_rollback_by_xid(XID *xid, bool commit) |
3924 | +{ |
3925 | + return drizzled::plugin::StorageEngine::commitOrRollbackByXID(xid, commit); |
3926 | +} |
3927 | + |
3928 | +/* report to InnoDB that control passes to the client */ |
3929 | +static inline int ha_release_temporary_latches(Session *session) |
3930 | +{ |
3931 | + return drizzled::plugin::StorageEngine::releaseTemporaryLatches(session); |
3932 | +} |
3933 | + |
3934 | +static inline bool ha_flush_logs(drizzled::plugin::StorageEngine *engine) |
3935 | +{ |
3936 | + return drizzled::plugin::StorageEngine::flushLogs(engine); |
3937 | +} |
3938 | + |
3939 | +static inline int ha_recover(HASH *commit_list) |
3940 | +{ |
3941 | + return drizzled::plugin::StorageEngine::recover(commit_list); |
3942 | +} |
3943 | + |
3944 | +static inline int ha_start_consistent_snapshot(Session *session) |
3945 | +{ |
3946 | + return drizzled::plugin::StorageEngine::startConsistentSnapshot(session); |
3947 | +} |
3948 | + |
3949 | +static inline int ha_delete_table(Session *session, const char *path, |
3950 | + const char *db, const char *alias, bool generate_warning) |
3951 | +{ |
3952 | + return drizzled::plugin::StorageEngine::deleteTable(session, path, db, |
3953 | + alias, generate_warning); |
3954 | +} |
3955 | + |
3956 | |
3957 | #endif /* DRIZZLED_PLUGIN_STORAGE_ENGINE_H */ |
3958 | |
3959 | === removed file 'drizzled/qcache.h' |
3960 | --- drizzled/qcache.h 2009-07-07 09:06:29 +0000 |
3961 | +++ drizzled/qcache.h 1970-01-01 00:00:00 +0000 |
3962 | @@ -1,40 +0,0 @@ |
3963 | -/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
3964 | - * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
3965 | - * |
3966 | - * Copyright (C) 2008 Sun Microsystems |
3967 | - * |
3968 | - * This program is free software; you can redistribute it and/or modify |
3969 | - * it under the terms of the GNU General Public License as published by |
3970 | - * the Free Software Foundation; version 2 of the License. |
3971 | - * |
3972 | - * This program is distributed in the hope that it will be useful, |
3973 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3974 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3975 | - * GNU General Public License for more details. |
3976 | - * |
3977 | - * You should have received a copy of the GNU General Public License |
3978 | - * along with this program; if not, write to the Free Software |
3979 | - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
3980 | - */ |
3981 | - |
3982 | -#ifndef DRIZZLED_QCACHE_H |
3983 | -#define DRIZZLED_QCACHE_H |
3984 | - |
3985 | -#include <drizzled/plugin/qcache.h> |
3986 | - |
3987 | -void add_query_cache(QueryCache *handler); |
3988 | -void remove_query_cache(QueryCache *handler); |
3989 | - |
3990 | -namespace drizzled { |
3991 | -namespace query_cache { |
3992 | -/* These are the functions called by the rest of the Drizzle server */ |
3993 | -bool try_fetch_and_send(Session *session, bool transactional); |
3994 | -bool set(Session *session, bool transactional); |
3995 | -bool invalidate_table(Session *session, bool transactional); |
3996 | -bool invalidate_db(Session *session, const char *db_name, |
3997 | - bool transactional); |
3998 | -bool flush(Session *session); |
3999 | -} |
4000 | -} |
4001 | - |
4002 | -#endif /* DRIZZLED_QCACHE_H */ |
4003 | |
4004 | === modified file 'drizzled/registry.h' |
4005 | --- drizzled/registry.h 2009-08-17 20:54:05 +0000 |
4006 | +++ drizzled/registry.h 2009-09-30 20:58:10 +0000 |
4007 | @@ -23,6 +23,7 @@ |
4008 | #include <map> |
4009 | #include <set> |
4010 | #include <string> |
4011 | +#include <vector> |
4012 | #include <algorithm> |
4013 | #include <functional> |
4014 | |
4015 | |
4016 | === modified file 'drizzled/replication_services.cc' |
4017 | --- drizzled/replication_services.cc 2009-09-16 17:10:18 +0000 |
4018 | +++ drizzled/replication_services.cc 2009-09-30 20:58:10 +0000 |
4019 | @@ -49,35 +49,12 @@ |
4020 | #include "drizzled/message/table.pb.h" |
4021 | #include "drizzled/gettext.h" |
4022 | #include "drizzled/session.h" |
4023 | -#include "drizzled/plugin/registry.h" |
4024 | |
4025 | #include <vector> |
4026 | |
4027 | using namespace std; |
4028 | using namespace drizzled; |
4029 | |
4030 | -ReplicationServices replication_services; |
4031 | - |
4032 | -void add_replicator(plugin::CommandReplicator *replicator) |
4033 | -{ |
4034 | - replication_services.attachReplicator(replicator); |
4035 | -} |
4036 | - |
4037 | -void remove_replicator(plugin::CommandReplicator *replicator) |
4038 | -{ |
4039 | - replication_services.detachReplicator(replicator); |
4040 | -} |
4041 | - |
4042 | -void add_applier(plugin::CommandApplier *applier) |
4043 | -{ |
4044 | - replication_services.attachApplier(applier); |
4045 | -} |
4046 | - |
4047 | -void remove_applier(plugin::CommandApplier *applier) |
4048 | -{ |
4049 | - replication_services.detachApplier(applier); |
4050 | -} |
4051 | - |
4052 | ReplicationServices::ReplicationServices() |
4053 | { |
4054 | is_active= false; |
4055 | |
4056 | === modified file 'drizzled/replication_services.h' |
4057 | --- drizzled/replication_services.h 2009-07-29 09:19:15 +0000 |
4058 | +++ drizzled/replication_services.h 2009-09-30 20:58:10 +0000 |
4059 | @@ -42,21 +42,13 @@ |
4060 | { |
4061 | class Command; |
4062 | } |
4063 | -} |
4064 | - |
4065 | -void add_replicator(drizzled::plugin::CommandReplicator *replicator); |
4066 | -void remove_replicator(drizzled::plugin::CommandReplicator *replicator); |
4067 | - |
4068 | -void add_applier(drizzled::plugin::CommandApplier *applier); |
4069 | -void remove_applier(drizzled::plugin::CommandApplier *applier); |
4070 | + |
4071 | |
4072 | /** |
4073 | * This is a class which manages transforming internal |
4074 | * transactional events into GPB messages and sending those |
4075 | * events out through registered replicators and appliers. |
4076 | */ |
4077 | -namespace drizzled |
4078 | -{ |
4079 | class ReplicationServices |
4080 | { |
4081 | public: |
4082 | @@ -103,6 +95,17 @@ |
4083 | * Constructor |
4084 | */ |
4085 | ReplicationServices(); |
4086 | + |
4087 | + /** |
4088 | + * Singleton method |
4089 | + * Returns the singleton instance of ReplicationServices |
4090 | + */ |
4091 | + static inline ReplicationServices &singleton() |
4092 | + { |
4093 | + static ReplicationServices replication_services; |
4094 | + return replication_services; |
4095 | + } |
4096 | + |
4097 | /** |
4098 | * Returns whether the ReplicationServices object |
4099 | * is active. In other words, does it have both |
4100 | |
4101 | === removed file 'drizzled/scheduling.h' |
4102 | --- drizzled/scheduling.h 2009-08-04 22:16:30 +0000 |
4103 | +++ drizzled/scheduling.h 1970-01-01 00:00:00 +0000 |
4104 | @@ -1,32 +0,0 @@ |
4105 | -/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
4106 | - * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
4107 | - * |
4108 | - * Copyright (C) 2008 Sun Microsystems |
4109 | - * |
4110 | - * This program is free software; you can redistribute it and/or modify |
4111 | - * it under the terms of the GNU General Public License as published by |
4112 | - * the Free Software Foundation; version 2 of the License. |
4113 | - * |
4114 | - * This program is distributed in the hope that it will be useful, |
4115 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4116 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4117 | - * GNU General Public License for more details. |
4118 | - * |
4119 | - * You should have received a copy of the GNU General Public License |
4120 | - * along with this program; if not, write to the Free Software |
4121 | - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
4122 | - */ |
4123 | - |
4124 | -#ifndef DRIZZLED_SCHEDULING_H |
4125 | -#define DRIZZLED_SCHEDULING_H |
4126 | - |
4127 | -#include <drizzled/plugin/scheduler.h> |
4128 | - |
4129 | -#include <string> |
4130 | - |
4131 | -drizzled::plugin::Scheduler *get_thread_scheduler(); |
4132 | -bool add_scheduler_factory(drizzled::plugin::SchedulerFactory *scheduler); |
4133 | -bool remove_scheduler_factory(drizzled::plugin::SchedulerFactory *scheduler); |
4134 | -bool set_scheduler_factory(const std::string& name); |
4135 | - |
4136 | -#endif /* DRIZZLED_SCHEDULING_H */ |
4137 | |
4138 | === modified file 'drizzled/server_includes.h' |
4139 | --- drizzled/server_includes.h 2009-09-22 07:35:28 +0000 |
4140 | +++ drizzled/server_includes.h 2009-09-30 20:58:10 +0000 |
4141 | @@ -37,8 +37,8 @@ |
4142 | /* Custom C string functions */ |
4143 | #include <mystrings/m_string.h> |
4144 | |
4145 | -/* The <strong>INTERNAL</strong> plugin API - not the external, or public, server plugin API */ |
4146 | -#include <drizzled/sql_plugin.h> |
4147 | +/* The plugin API */ |
4148 | +#include <drizzled/plugin.h> |
4149 | /* Range optimization API/library */ |
4150 | #include <drizzled/opt_range.h> |
4151 | /* Routines for dropping, repairing, checking schema tables */ |
4152 | @@ -150,8 +150,8 @@ |
4153 | extern struct my_option my_long_options[]; |
4154 | extern std::bitset<5> sql_command_flags[]; |
4155 | |
4156 | -extern StorageEngine *myisam_engine; |
4157 | -extern StorageEngine *heap_engine; |
4158 | +extern drizzled::plugin::StorageEngine *myisam_engine; |
4159 | +extern drizzled::plugin::StorageEngine *heap_engine; |
4160 | |
4161 | extern SHOW_COMP_OPTION have_symlink; |
4162 | |
4163 | |
4164 | === renamed directory 'drizzled/slot' => 'drizzled/service' |
4165 | === modified file 'drizzled/session.cc' |
4166 | --- drizzled/session.cc 2009-09-26 02:16:50 +0000 |
4167 | +++ drizzled/session.cc 2009-09-30 20:58:10 +0000 |
4168 | @@ -36,8 +36,9 @@ |
4169 | #include <drizzled/item/return_int.h> |
4170 | #include <drizzled/item/empty_string.h> |
4171 | #include <drizzled/show.h> |
4172 | -#include <drizzled/scheduling.h> |
4173 | #include <drizzled/plugin/client.h> |
4174 | +#include "drizzled/plugin/scheduler.h" |
4175 | +#include "drizzled/plugin/authentication.h" |
4176 | #include "drizzled/probes.h" |
4177 | |
4178 | #include <algorithm> |
4179 | @@ -144,7 +145,7 @@ |
4180 | } |
4181 | |
4182 | extern "C" |
4183 | -void **session_ha_data(const Session *session, const struct StorageEngine *engine) |
4184 | +void **session_ha_data(const Session *session, const plugin::StorageEngine *engine) |
4185 | { |
4186 | return (void **) &session->ha_data[engine->slot].ha_ptr; |
4187 | } |
4188 | @@ -608,7 +609,7 @@ |
4189 | |
4190 | bool Session::schedule() |
4191 | { |
4192 | - scheduler= get_thread_scheduler(); |
4193 | + scheduler= plugin::SchedulerFactory::getScheduler(); |
4194 | |
4195 | ++connection_count; |
4196 | |
4197 | @@ -670,7 +671,7 @@ |
4198 | return false; |
4199 | } |
4200 | |
4201 | - is_authenticated= authenticate_user(this, passwd); |
4202 | + is_authenticated= plugin::Authentication::isAuthenticated(this, passwd); |
4203 | |
4204 | if (is_authenticated != true) |
4205 | { |
4206 | @@ -1925,7 +1926,7 @@ |
4207 | |
4208 | void Session::close_temporary(Table *table, bool free_share, bool delete_table) |
4209 | { |
4210 | - StorageEngine *table_type= table->s->db_type(); |
4211 | + plugin::StorageEngine *table_type= table->s->db_type(); |
4212 | |
4213 | table->free_io_cache(); |
4214 | table->closefrm(false); |
4215 | @@ -2151,7 +2152,7 @@ |
4216 | return false; |
4217 | } |
4218 | |
4219 | -bool Session::rm_temporary_table(StorageEngine *base, char *path) |
4220 | +bool Session::rm_temporary_table(plugin::StorageEngine *base, char *path) |
4221 | { |
4222 | bool error=0; |
4223 | |
4224 | |
4225 | === modified file 'drizzled/session.h' |
4226 | --- drizzled/session.h 2009-09-26 02:16:50 +0000 |
4227 | +++ drizzled/session.h 2009-09-30 20:58:10 +0000 |
4228 | @@ -23,7 +23,7 @@ |
4229 | |
4230 | /* Classes in mysql */ |
4231 | |
4232 | -#include <drizzled/sql_plugin.h> |
4233 | +#include "drizzled/plugin.h" |
4234 | #include <drizzled/sql_locale.h> |
4235 | #include <drizzled/ha_trx_info.h> |
4236 | #include <mysys/my_alloc.h> |
4237 | @@ -33,7 +33,6 @@ |
4238 | #include <drizzled/sql_error.h> |
4239 | #include <drizzled/file_exchange.h> |
4240 | #include <drizzled/select_result_interceptor.h> |
4241 | -#include <drizzled/authentication.h> |
4242 | #include <drizzled/db.h> |
4243 | #include <drizzled/xid.h> |
4244 | |
4245 | @@ -170,7 +169,7 @@ |
4246 | /* TODO: change this to my_thread_id - but have to fix set_var first */ |
4247 | uint64_t pseudo_thread_id; |
4248 | |
4249 | - StorageEngine *storage_engine; |
4250 | + drizzled::plugin::StorageEngine *storage_engine; |
4251 | |
4252 | /* Only charset part of these variables is sensible */ |
4253 | const CHARSET_INFO *character_set_filesystem; |
4254 | @@ -1410,7 +1409,7 @@ |
4255 | void close_temporary_table(Table *table, bool free_share, bool delete_table); |
4256 | void close_temporary(Table *table, bool free_share, bool delete_table); |
4257 | int drop_temporary_table(TableList *table_list); |
4258 | - bool rm_temporary_table(StorageEngine *base, char *path); |
4259 | + bool rm_temporary_table(drizzled::plugin::StorageEngine *base, char *path); |
4260 | Table *open_temporary_table(const char *path, const char *db, |
4261 | const char *table_name, bool link_in_list, |
4262 | open_table_mode open_mode); |
4263 | |
4264 | === modified file 'drizzled/set_var.cc' |
4265 | --- drizzled/set_var.cc 2009-09-15 02:21:15 +0000 |
4266 | +++ drizzled/set_var.cc 2009-09-30 20:58:10 +0000 |
4267 | @@ -57,13 +57,14 @@ |
4268 | #include <drizzled/item/uint.h> |
4269 | #include <drizzled/item/null.h> |
4270 | #include <drizzled/item/float.h> |
4271 | -#include <drizzled/sql_plugin.h> |
4272 | +#include <drizzled/plugin.h> |
4273 | |
4274 | #include "drizzled/registry.h" |
4275 | #include <map> |
4276 | #include <algorithm> |
4277 | |
4278 | using namespace std; |
4279 | +using namespace drizzled; |
4280 | |
4281 | extern const CHARSET_INFO *character_set_filesystem; |
4282 | extern size_t my_thread_stack_size; |
4283 | @@ -2056,8 +2057,8 @@ |
4284 | else |
4285 | { |
4286 | const std::string engine_name(res->ptr()); |
4287 | - StorageEngine *engine; |
4288 | - var->save_result.storage_engine= ha_resolve_by_name(session, engine_name); |
4289 | + plugin::StorageEngine *engine; |
4290 | + var->save_result.storage_engine= plugin::StorageEngine::findByName(session, engine_name); |
4291 | if (var->save_result.storage_engine == NULL) |
4292 | { |
4293 | value= res->c_ptr(); |
4294 | @@ -2081,7 +2082,7 @@ |
4295 | { |
4296 | unsigned char* result; |
4297 | string engine_name; |
4298 | - StorageEngine *engine= session->variables.*offset; |
4299 | + plugin::StorageEngine *engine= session->variables.*offset; |
4300 | if (type == OPT_GLOBAL) |
4301 | engine= global_system_variables.*offset; |
4302 | engine_name= engine->getName(); |
4303 | @@ -2093,7 +2094,7 @@ |
4304 | |
4305 | void sys_var_session_storage_engine::set_default(Session *session, enum_var_type type) |
4306 | { |
4307 | - StorageEngine *old_value, *new_value, **value; |
4308 | + plugin::StorageEngine *old_value, *new_value, **value; |
4309 | if (type == OPT_GLOBAL) |
4310 | { |
4311 | value= &(global_system_variables.*offset); |
4312 | @@ -2112,7 +2113,7 @@ |
4313 | |
4314 | bool sys_var_session_storage_engine::update(Session *session, set_var *var) |
4315 | { |
4316 | - StorageEngine **value= &(global_system_variables.*offset), *old_value; |
4317 | + plugin::StorageEngine **value= &(global_system_variables.*offset), *old_value; |
4318 | if (var->type != OPT_GLOBAL) |
4319 | value= &(session->variables.*offset); |
4320 | old_value= *value; |
4321 | |
4322 | === modified file 'drizzled/set_var.h' |
4323 | --- drizzled/set_var.h 2009-08-13 21:22:40 +0000 |
4324 | +++ drizzled/set_var.h 2009-09-30 20:58:10 +0000 |
4325 | @@ -656,10 +656,10 @@ |
4326 | class sys_var_session_storage_engine :public sys_var_session |
4327 | { |
4328 | protected: |
4329 | - StorageEngine *SV::*offset; |
4330 | + drizzled::plugin::StorageEngine *SV::*offset; |
4331 | public: |
4332 | sys_var_session_storage_engine(sys_var_chain *chain, const char *name_arg, |
4333 | - StorageEngine *SV::*offset_arg) |
4334 | + drizzled::plugin::StorageEngine *SV::*offset_arg) |
4335 | :sys_var_session(name_arg), offset(offset_arg) |
4336 | { chain_sys_var(chain); } |
4337 | bool check(Session *session, set_var *var); |
4338 | @@ -983,7 +983,7 @@ |
4339 | uint32_t uint32_t_value; |
4340 | uint64_t uint64_t_value; |
4341 | size_t size_t_value; |
4342 | - StorageEngine *storage_engine; |
4343 | + drizzled::plugin::StorageEngine *storage_engine; |
4344 | Time_zone *time_zone; |
4345 | MY_LOCALE *locale_value; |
4346 | } save_result; |
4347 | |
4348 | === modified file 'drizzled/show.cc' |
4349 | --- drizzled/show.cc 2009-08-31 23:50:37 +0000 |
4350 | +++ drizzled/show.cc 2009-09-30 20:58:10 +0000 |
4351 | @@ -40,7 +40,7 @@ |
4352 | #include <drizzled/item/return_date_time.h> |
4353 | #include <drizzled/item/empty_string.h> |
4354 | #include "drizzled/plugin/registry.h" |
4355 | -#include <drizzled/info_schema.h> |
4356 | +#include <drizzled/plugin/info_schema_table.h> |
4357 | #include <drizzled/message/schema.pb.h> |
4358 | #include <drizzled/plugin/client.h> |
4359 | #include <mysys/cached_directory.h> |
4360 | @@ -66,26 +66,6 @@ |
4361 | |
4362 | static void store_key_options(String *packet, Table *table, KEY *key_info); |
4363 | |
4364 | -static vector<InfoSchemaTable *> all_schema_tables; |
4365 | - |
4366 | -void add_infoschema_table(InfoSchemaTable *schema_table) |
4367 | -{ |
4368 | - if (schema_table->getFirstColumnIndex() == 0) |
4369 | - schema_table->setFirstColumnIndex(-1); |
4370 | - if (schema_table->getSecondColumnIndex() == 0) |
4371 | - schema_table->setSecondColumnIndex(-1); |
4372 | - |
4373 | - all_schema_tables.push_back(schema_table); |
4374 | -} |
4375 | - |
4376 | -void remove_infoschema_table(InfoSchemaTable *table) |
4377 | -{ |
4378 | - all_schema_tables.erase(remove_if(all_schema_tables.begin(), |
4379 | - all_schema_tables.end(), |
4380 | - bind2nd(equal_to<InfoSchemaTable *>(), |
4381 | - table)), |
4382 | - all_schema_tables.end()); |
4383 | -} |
4384 | |
4385 | |
4386 | int wild_case_compare(const CHARSET_INFO * const cs, const char *str,const char *wildstr) |
4387 | @@ -1102,7 +1082,7 @@ |
4388 | TableList *table, |
4389 | LOOKUP_FIELD_VALUES *lookup_field_vals) |
4390 | { |
4391 | - InfoSchemaTable *schema_table= table->schema_table; |
4392 | + plugin::InfoSchemaTable *schema_table= table->schema_table; |
4393 | const char *field_name1= schema_table->getFirstColumnIndex() >= 0 ? |
4394 | schema_table->getColumnName(schema_table->getFirstColumnIndex()).c_str() : ""; |
4395 | const char *field_name2= schema_table->getSecondColumnIndex() >= 0 ? |
4396 | @@ -1230,7 +1210,7 @@ |
4397 | { |
4398 | Item_field *item_field= (Item_field*)item; |
4399 | const CHARSET_INFO * const cs= system_charset_info; |
4400 | - InfoSchemaTable *schema_table= table->schema_table; |
4401 | + plugin::InfoSchemaTable *schema_table= table->schema_table; |
4402 | const char *field_name1= schema_table->getFirstColumnIndex() >= 0 ? |
4403 | schema_table->getColumnName(schema_table->getFirstColumnIndex()).c_str() : ""; |
4404 | const char *field_name2= schema_table->getSecondColumnIndex() >= 0 ? |
4405 | @@ -1463,60 +1443,6 @@ |
4406 | } |
4407 | |
4408 | |
4409 | -class AddSchemaTable : public unary_function<InfoSchemaTable *, bool> |
4410 | -{ |
4411 | - Session *session; |
4412 | - const char *wild; |
4413 | - vector<LEX_STRING*> &files; |
4414 | - |
4415 | -public: |
4416 | - AddSchemaTable(Session *session_arg, vector<LEX_STRING*> &files_arg, const char *wild_arg) |
4417 | - : session(session_arg), wild(wild_arg), files(files_arg) |
4418 | - {} |
4419 | - |
4420 | - result_type operator() (argument_type schema_table) |
4421 | - { |
4422 | - if (schema_table->isHidden()) |
4423 | - { |
4424 | - return false; |
4425 | - } |
4426 | - |
4427 | - const string &schema_table_name= schema_table->getTableName(); |
4428 | - |
4429 | - if (wild && wild_case_compare(files_charset_info, schema_table_name.c_str(), wild)) |
4430 | - { |
4431 | - return false; |
4432 | - } |
4433 | - |
4434 | - LEX_STRING *file_name= 0; |
4435 | - file_name= session->make_lex_string(file_name, schema_table_name.c_str(), |
4436 | - schema_table_name.length(), true); |
4437 | - if (file_name == NULL) |
4438 | - { |
4439 | - return true; |
4440 | - } |
4441 | - |
4442 | - files.push_back(file_name); |
4443 | - return false; |
4444 | - } |
4445 | -}; |
4446 | - |
4447 | - |
4448 | -static int schema_tables_add(Session *session, vector<LEX_STRING*> &files, const char *wild) |
4449 | -{ |
4450 | - vector<InfoSchemaTable *>::iterator iter= find_if(all_schema_tables.begin(), |
4451 | - all_schema_tables.end(), |
4452 | - AddSchemaTable(session, files, wild)); |
4453 | - |
4454 | - if (iter != all_schema_tables.end()) |
4455 | - { |
4456 | - return 1; |
4457 | - } |
4458 | - |
4459 | - return 0; |
4460 | -} |
4461 | - |
4462 | - |
4463 | /** |
4464 | @brief Create table names list |
4465 | |
4466 | @@ -1548,7 +1474,7 @@ |
4467 | { |
4468 | if (with_i_schema) |
4469 | { |
4470 | - if (find_schema_table(lookup_field_vals->table_value.str)) |
4471 | + if (plugin::InfoSchemaTable::getTable(lookup_field_vals->table_value.str)) |
4472 | { |
4473 | table_names.push_back(&lookup_field_vals->table_value); |
4474 | } |
4475 | @@ -1565,12 +1491,12 @@ |
4476 | to the list |
4477 | */ |
4478 | if (with_i_schema) |
4479 | - return (schema_tables_add(session, table_names, |
4480 | - lookup_field_vals->table_value.str)); |
4481 | + return plugin::InfoSchemaTable::addTableToList(session, table_names, |
4482 | + lookup_field_vals->table_value.str); |
4483 | |
4484 | string db(db_name->str); |
4485 | |
4486 | - TableNameIterator tniter(db); |
4487 | + plugin::TableNameIterator tniter(db); |
4488 | int err= 0; |
4489 | string table_name; |
4490 | |
4491 | @@ -1622,7 +1548,7 @@ |
4492 | |
4493 | static int |
4494 | fill_schema_show_cols_or_idxs(Session *session, TableList *tables, |
4495 | - InfoSchemaTable *schema_table, |
4496 | + plugin::InfoSchemaTable *schema_table, |
4497 | Open_tables_state *open_tables_state_backup) |
4498 | { |
4499 | LEX *lex= session->lex; |
4500 | @@ -1739,7 +1665,7 @@ |
4501 | */ |
4502 | |
4503 | static uint32_t get_table_open_method(TableList *tables, |
4504 | - InfoSchemaTable *schema_table) |
4505 | + plugin::InfoSchemaTable *schema_table) |
4506 | { |
4507 | /* |
4508 | determine which method will be used for table opening |
4509 | @@ -1778,7 +1704,7 @@ |
4510 | */ |
4511 | |
4512 | static int fill_schema_table_from_frm(Session *session,TableList *tables, |
4513 | - InfoSchemaTable *schema_table, |
4514 | + plugin::InfoSchemaTable *schema_table, |
4515 | LEX_STRING *db_name, |
4516 | LEX_STRING *table_name) |
4517 | { |
4518 | @@ -1832,7 +1758,7 @@ |
4519 | temporary tables that are filled at query execution time. |
4520 | Those I_S tables whose data are retrieved |
4521 | from frm files and storage engine are filled by the function |
4522 | - InfoSchemaMethods::fillTable(). |
4523 | + plugin::InfoSchemaMethods::fillTable(). |
4524 | |
4525 | @param[in] session thread handler |
4526 | @param[in] tables I_S table |
4527 | @@ -1842,14 +1768,14 @@ |
4528 | @retval 0 success |
4529 | @retval 1 error |
4530 | */ |
4531 | -int InfoSchemaMethods::fillTable(Session *session, TableList *tables, COND *cond) |
4532 | +int plugin::InfoSchemaMethods::fillTable(Session *session, TableList *tables, COND *cond) |
4533 | { |
4534 | LEX *lex= session->lex; |
4535 | Table *table= tables->table; |
4536 | Select_Lex *old_all_select_lex= lex->all_selects_list; |
4537 | enum_sql_command save_sql_command= lex->sql_command; |
4538 | Select_Lex *lsel= tables->schema_select_lex; |
4539 | - InfoSchemaTable *schema_table= tables->schema_table; |
4540 | + plugin::InfoSchemaTable *schema_table= tables->schema_table; |
4541 | Select_Lex sel; |
4542 | LOOKUP_FIELD_VALUES lookup_field_vals; |
4543 | bool with_i_schema; |
4544 | @@ -2168,7 +2094,7 @@ |
4545 | } |
4546 | |
4547 | |
4548 | -int InfoSchemaMethods::processTable(Session *session, TableList *tables, |
4549 | +int plugin::InfoSchemaMethods::processTable(Session *session, TableList *tables, |
4550 | Table *table, bool res, |
4551 | LEX_STRING *db_name, |
4552 | LEX_STRING *table_name) const |
4553 | @@ -2289,48 +2215,7 @@ |
4554 | } |
4555 | |
4556 | |
4557 | -class FindSchemaTableByName : public unary_function<InfoSchemaTable *, bool> |
4558 | -{ |
4559 | - const char *table_name; |
4560 | -public: |
4561 | - FindSchemaTableByName(const char *table_name_arg) |
4562 | - : table_name(table_name_arg) {} |
4563 | - result_type operator() (argument_type schema_table) |
4564 | - { |
4565 | - return ! my_strcasecmp(system_charset_info, |
4566 | - schema_table->getTableName().c_str(), |
4567 | - table_name); |
4568 | - } |
4569 | -}; |
4570 | - |
4571 | - |
4572 | -/* |
4573 | - Find schema_tables elment by name |
4574 | - |
4575 | - SYNOPSIS |
4576 | - find_schema_table() |
4577 | - table_name table name |
4578 | - |
4579 | - RETURN |
4580 | - 0 table not found |
4581 | - # pointer to 'schema_tables' element |
4582 | -*/ |
4583 | - |
4584 | -InfoSchemaTable *find_schema_table(const char* table_name) |
4585 | -{ |
4586 | - vector<InfoSchemaTable *>::iterator iter= |
4587 | - find_if(all_schema_tables.begin(), all_schema_tables.end(), |
4588 | - FindSchemaTableByName(table_name)); |
4589 | - if (iter != all_schema_tables.end()) |
4590 | - { |
4591 | - return *iter; |
4592 | - } |
4593 | - |
4594 | - return NULL; |
4595 | -} |
4596 | - |
4597 | - |
4598 | -Table *InfoSchemaMethods::createSchemaTable(Session *session, TableList *table_list) |
4599 | +Table *plugin::InfoSchemaMethods::createSchemaTable(Session *session, TableList *table_list) |
4600 | const |
4601 | { |
4602 | int field_count= 0; |
4603 | @@ -2338,12 +2223,12 @@ |
4604 | Table *table; |
4605 | List<Item> field_list; |
4606 | const CHARSET_INFO * const cs= system_charset_info; |
4607 | - const InfoSchemaTable::Columns &columns= table_list->schema_table->getColumns(); |
4608 | - InfoSchemaTable::Columns::const_iterator iter= columns.begin(); |
4609 | + const plugin::InfoSchemaTable::Columns &columns= table_list->schema_table->getColumns(); |
4610 | + plugin::InfoSchemaTable::Columns::const_iterator iter= columns.begin(); |
4611 | |
4612 | while (iter != columns.end()) |
4613 | { |
4614 | - const ColumnInfo *column= *iter; |
4615 | + const plugin::ColumnInfo *column= *iter; |
4616 | switch (column->getType()) { |
4617 | case DRIZZLE_TYPE_LONG: |
4618 | case DRIZZLE_TYPE_LONGLONG: |
4619 | @@ -2435,7 +2320,7 @@ |
4620 | Make list of fields for SHOW |
4621 | |
4622 | SYNOPSIS |
4623 | - InfoSchemaMethods::oldFormat() |
4624 | + plugin::InfoSchemaMethods::oldFormat() |
4625 | session thread handler |
4626 | schema_table pointer to 'schema_tables' element |
4627 | |
4628 | @@ -2444,16 +2329,16 @@ |
4629 | 0 success |
4630 | */ |
4631 | |
4632 | -int InfoSchemaMethods::oldFormat(Session *session, InfoSchemaTable *schema_table) |
4633 | +int plugin::InfoSchemaMethods::oldFormat(Session *session, plugin::InfoSchemaTable *schema_table) |
4634 | const |
4635 | { |
4636 | Name_resolution_context *context= &session->lex->select_lex.context; |
4637 | - const InfoSchemaTable::Columns columns= schema_table->getColumns(); |
4638 | - InfoSchemaTable::Columns::const_iterator iter= columns.begin(); |
4639 | + const plugin::InfoSchemaTable::Columns columns= schema_table->getColumns(); |
4640 | + plugin::InfoSchemaTable::Columns::const_iterator iter= columns.begin(); |
4641 | |
4642 | while (iter != columns.end()) |
4643 | { |
4644 | - const ColumnInfo *column= *iter; |
4645 | + const plugin::ColumnInfo *column= *iter; |
4646 | if (column->getOldName().length() != 0) |
4647 | { |
4648 | Item_field *field= new Item_field(context, |
4649 | @@ -2531,7 +2416,7 @@ |
4650 | bool make_schema_select(Session *session, Select_Lex *sel, |
4651 | const string& schema_table_name) |
4652 | { |
4653 | - InfoSchemaTable *schema_table= find_schema_table(schema_table_name.c_str()); |
4654 | + plugin::InfoSchemaTable *schema_table= plugin::InfoSchemaTable::getTable(schema_table_name.c_str()); |
4655 | LEX_STRING db, table; |
4656 | /* |
4657 | We have to make non const db_name & table_name |
4658 | |
4659 | === modified file 'drizzled/show.h' |
4660 | --- drizzled/show.h 2009-08-04 14:13:13 +0000 |
4661 | +++ drizzled/show.h 2009-09-30 20:58:10 +0000 |
4662 | @@ -40,7 +40,14 @@ |
4663 | struct st_ha_create_information; |
4664 | typedef st_ha_create_information HA_CREATE_INFO; |
4665 | struct TableList; |
4666 | -class InfoSchemaTable; |
4667 | +namespace drizzled |
4668 | +{ |
4669 | +namespace plugin |
4670 | +{ |
4671 | + class InfoSchemaTable; |
4672 | +} |
4673 | +} |
4674 | + |
4675 | |
4676 | typedef struct system_status_var STATUS_VAR; |
4677 | |
4678 | @@ -66,7 +73,6 @@ |
4679 | int wild_case_compare(const CHARSET_INFO * const cs, |
4680 | const char *str,const char *wildstr); |
4681 | |
4682 | -InfoSchemaTable *find_schema_table(const char* table_name); |
4683 | bool make_schema_select(Session *session, Select_Lex *sel, |
4684 | const std::string& schema_table_name); |
4685 | bool mysql_schema_table(Session *session, LEX *lex, TableList *table_list); |
4686 | @@ -91,7 +97,5 @@ |
4687 | void init_status_vars(); |
4688 | void free_status_vars(); |
4689 | void reset_status_vars(); |
4690 | -void add_infoschema_table(InfoSchemaTable *schema_table); |
4691 | -void remove_infoschema_table(InfoSchemaTable *table); |
4692 | |
4693 | #endif /* DRIZZLE_SERVER_SHOW_H */ |
4694 | |
4695 | === removed file 'drizzled/slot/function.h' |
4696 | --- drizzled/slot/function.h 2009-08-17 21:30:20 +0000 |
4697 | +++ drizzled/slot/function.h 1970-01-01 00:00:00 +0000 |
4698 | @@ -1,66 +0,0 @@ |
4699 | -/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
4700 | - * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
4701 | - * |
4702 | - * Copyright (C) 2008 Sun Microsystems |
4703 | - * |
4704 | - * This program is free software; you can redistribute it and/or modify |
4705 | - * it under the terms of the GNU General Public License as published by |
4706 | - * the Free Software Foundation; version 2 of the License. |
4707 | - * |
4708 | - * This program is distributed in the hope that it will be useful, |
4709 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4710 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4711 | - * GNU General Public License for more details. |
4712 | - * |
4713 | - * You should have received a copy of the GNU General Public License |
4714 | - * along with this program; if not, write to the Free Software |
4715 | - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
4716 | - */ |
4717 | - |
4718 | -#ifndef DRIZZLED_SLOT_FUNCTION_H |
4719 | -#define DRIZZLED_SLOT_FUNCTION_H |
4720 | - |
4721 | -/* This file defines structures needed by udf functions */ |
4722 | - |
4723 | -#include "drizzled/function/func.h" |
4724 | -#include "drizzled/plugin/function.h" |
4725 | -#include "drizzled/registry.h" |
4726 | - |
4727 | -namespace drizzled |
4728 | -{ |
4729 | -namespace slot |
4730 | -{ |
4731 | - |
4732 | -/** |
4733 | - * Class to handle all Function plugin objects. |
4734 | - */ |
4735 | -class Function |
4736 | -{ |
4737 | - Registry<const plugin::Function *> udf_registry; |
4738 | - |
4739 | -public: |
4740 | - Function() : udf_registry() {} |
4741 | - ~Function() {} |
4742 | - |
4743 | - /** |
4744 | - * Add a new Function factory to the list of factories we manage. |
4745 | - */ |
4746 | - void add(const plugin::Function *function_obj); |
4747 | - |
4748 | - /** |
4749 | - * Remove a Function factory from the list of factory we manage. |
4750 | - */ |
4751 | - void remove(const plugin::Function *function_obj); |
4752 | - |
4753 | - /** |
4754 | - * Accept a new connection (Protocol object) on one of the configured |
4755 | - * listener interfaces. |
4756 | - */ |
4757 | - const plugin::Function *get(const char *name, size_t len=0) const; |
4758 | - |
4759 | -}; |
4760 | - |
4761 | -} /* end namespace slot */ |
4762 | -} /* end namespace drizzled */ |
4763 | - |
4764 | -#endif /* DRIZZLED_SLOT_FUNCTION_H */ |
4765 | |
4766 | === removed file 'drizzled/slot/listen.h' |
4767 | --- drizzled/slot/listen.h 2009-08-28 00:07:54 +0000 |
4768 | +++ drizzled/slot/listen.h 1970-01-01 00:00:00 +0000 |
4769 | @@ -1,91 +0,0 @@ |
4770 | -/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
4771 | - * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
4772 | - * |
4773 | - * Copyright (C) 2008 Sun Microsystems |
4774 | - * |
4775 | - * This program is free software; you can redistribute it and/or modify |
4776 | - * it under the terms of the GNU General Public License as published by |
4777 | - * the Free Software Foundation; version 2 of the License. |
4778 | - * |
4779 | - * This program is distributed in the hope that it will be useful, |
4780 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4781 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4782 | - * GNU General Public License for more details. |
4783 | - * |
4784 | - * You should have received a copy of the GNU General Public License |
4785 | - * along with this program; if not, write to the Free Software |
4786 | - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
4787 | - */ |
4788 | - |
4789 | -#ifndef DRIZZLED_SLOT_LISTEN_H |
4790 | -#define DRIZZLED_SLOT_LISTEN_H |
4791 | - |
4792 | -#include <vector> |
4793 | - |
4794 | -struct pollfd; |
4795 | - |
4796 | -namespace drizzled |
4797 | -{ |
4798 | - |
4799 | -namespace plugin |
4800 | -{ |
4801 | -class Client; |
4802 | -class Listen; |
4803 | -} |
4804 | - |
4805 | -namespace slot |
4806 | -{ |
4807 | - |
4808 | -/** |
4809 | - * Class to handle all Listen plugin objects. |
4810 | - */ |
4811 | -class Listen |
4812 | -{ |
4813 | -private: |
4814 | - std::vector<plugin::Listen *> listen_list; |
4815 | - std::vector<plugin::Listen *> listen_fd_list; |
4816 | - struct pollfd *fd_list; |
4817 | - uint32_t fd_count; |
4818 | - int wakeup_pipe[2]; |
4819 | - |
4820 | -public: |
4821 | - Listen(); |
4822 | - ~Listen(); |
4823 | - |
4824 | - /** |
4825 | - * Add a new Listen object to the list of listeners we manage. |
4826 | - */ |
4827 | - void add(plugin::Listen &listen_obj); |
4828 | - |
4829 | - /** |
4830 | - * Remove a Listen object from the list of listeners we manage. |
4831 | - */ |
4832 | - void remove(plugin::Listen &listen_obj); |
4833 | - |
4834 | - /** |
4835 | - * Setup all configured listen plugins. |
4836 | - */ |
4837 | - bool setup(void); |
4838 | - |
4839 | - /** |
4840 | - * Accept a new connection (Client object) on one of the configured |
4841 | - * listener interfaces. |
4842 | - */ |
4843 | - plugin::Client *getClient(void) const; |
4844 | - |
4845 | - /** |
4846 | - * Some internal functions drizzled require a temporary Client object to |
4847 | - * create a valid session object, this just returns a dummy client object. |
4848 | - */ |
4849 | - plugin::Client *getNullClient(void) const; |
4850 | - |
4851 | - /** |
4852 | - * Shutdown and cleanup listen loop for server shutdown. |
4853 | - */ |
4854 | - void shutdown(void); |
4855 | -}; |
4856 | - |
4857 | -} /* end namespace slot */ |
4858 | -} /* end namespace drizzled */ |
4859 | - |
4860 | -#endif /* DRIZZLED_SLOT_LISTEN_H */ |
4861 | |
4862 | === renamed file 'drizzled/thr_malloc.cc' => 'drizzled/sql_alloc.cc' |
4863 | === modified file 'drizzled/sql_base.cc' |
4864 | --- drizzled/sql_base.cc 2009-08-31 23:50:37 +0000 |
4865 | +++ drizzled/sql_base.cc 2009-09-30 20:58:10 +0000 |
4866 | @@ -44,15 +44,13 @@ |
4867 | #include <drizzled/replication_services.h> |
4868 | #include <drizzled/check_stack_overrun.h> |
4869 | #include <drizzled/lock.h> |
4870 | -#include <drizzled/slot/listen.h> |
4871 | +#include <drizzled/plugin/listen.h> |
4872 | #include <mysys/cached_directory.h> |
4873 | |
4874 | using namespace std; |
4875 | using namespace drizzled; |
4876 | |
4877 | -extern drizzled::ReplicationServices replication_services; |
4878 | - |
4879 | -bool drizzle_rm_tmp_tables(slot::Listen &listen_handler); |
4880 | +bool drizzle_rm_tmp_tables(); |
4881 | |
4882 | /** |
4883 | @defgroup Data_Dictionary Data Dictionary |
4884 | @@ -816,7 +814,7 @@ |
4885 | close_temporary_table(table, true, true); |
4886 | else |
4887 | { |
4888 | - StorageEngine *table_type= table->s->db_type(); |
4889 | + plugin::StorageEngine *table_type= table->s->db_type(); |
4890 | pthread_mutex_lock(&LOCK_open); /* Close and drop a table (AUX routine) */ |
4891 | /* |
4892 | unlink_open_table() also tells threads waiting for refresh or close |
4893 | @@ -1325,7 +1323,7 @@ |
4894 | table_list->db, table_list->table_name, |
4895 | false); |
4896 | |
4897 | - if (StorageEngine::getTableProto(path, NULL) != EEXIST) |
4898 | + if (plugin::StorageEngine::getTableProto(path, NULL) != EEXIST) |
4899 | { |
4900 | /* |
4901 | Table to be created, so we need to create placeholder in table-cache. |
4902 | @@ -2045,6 +2043,7 @@ |
4903 | */ |
4904 | if (unlikely(entry->file->implicit_emptied)) |
4905 | { |
4906 | + ReplicationServices &replication_services= ReplicationServices::singleton(); |
4907 | entry->file->implicit_emptied= 0; |
4908 | { |
4909 | char *query, *end; |
4910 | @@ -4533,14 +4532,14 @@ |
4911 | } |
4912 | |
4913 | |
4914 | -bool drizzle_rm_tmp_tables(slot::Listen &listen_handler) |
4915 | +bool drizzle_rm_tmp_tables() |
4916 | { |
4917 | char filePath[FN_REFLEN], filePathCopy[FN_REFLEN]; |
4918 | Session *session; |
4919 | |
4920 | assert(drizzle_tmpdir); |
4921 | |
4922 | - if (!(session= new Session(listen_handler.getNullClient()))) |
4923 | + if (!(session= new Session(plugin::Listen::getNullClient()))) |
4924 | return true; |
4925 | session->thread_stack= (char*) &session; |
4926 | session->storeGlobals(); |
4927 | |
4928 | === modified file 'drizzled/sql_delete.cc' |
4929 | --- drizzled/sql_delete.cc 2009-09-17 00:08:20 +0000 |
4930 | +++ drizzled/sql_delete.cc 2009-09-30 20:58:10 +0000 |
4931 | @@ -27,6 +27,8 @@ |
4932 | #include <drizzled/lock.h> |
4933 | #include "drizzled/probes.h" |
4934 | |
4935 | +using namespace drizzled; |
4936 | + |
4937 | /** |
4938 | Implement DELETE SQL word. |
4939 | |
4940 | @@ -411,7 +413,7 @@ |
4941 | /* If it is a temporary table, close and regenerate it */ |
4942 | if (!dont_send_ok && (table= session->find_temporary_table(table_list))) |
4943 | { |
4944 | - StorageEngine *table_type= table->s->db_type(); |
4945 | + plugin::StorageEngine *table_type= table->s->db_type(); |
4946 | TableShare *share= table->s; |
4947 | |
4948 | if (!table_type->check_flag(HTON_BIT_CAN_RECREATE)) |
4949 | |
4950 | === modified file 'drizzled/sql_lex.h' |
4951 | --- drizzled/sql_lex.h 2009-09-24 06:11:54 +0000 |
4952 | +++ drizzled/sql_lex.h 2009-09-30 20:58:10 +0000 |
4953 | @@ -25,7 +25,7 @@ |
4954 | */ |
4955 | #include <drizzled/message/table.pb.h> |
4956 | |
4957 | -#include "drizzled/slot/function.h" |
4958 | +#include "drizzled/plugin/function.h" |
4959 | #include "drizzled/name_resolution_context.h" |
4960 | #include "drizzled/item/subselect.h" |
4961 | #include "drizzled/item/param.h" |
4962 | |
4963 | === modified file 'drizzled/sql_parse.cc' |
4964 | --- drizzled/sql_parse.cc 2009-09-24 06:23:51 +0000 |
4965 | +++ drizzled/sql_parse.cc 2009-09-30 20:58:10 +0000 |
4966 | @@ -16,7 +16,6 @@ |
4967 | #define DRIZZLE_LEX 1 |
4968 | #include <drizzled/server_includes.h> |
4969 | #include <mysys/hash.h> |
4970 | -#include <drizzled/logging.h> |
4971 | #include <drizzled/db.h> |
4972 | #include <drizzled/error.h> |
4973 | #include <drizzled/nested_join.h> |
4974 | @@ -25,7 +24,7 @@ |
4975 | #include <drizzled/data_home.h> |
4976 | #include <drizzled/sql_base.h> |
4977 | #include <drizzled/show.h> |
4978 | -#include <drizzled/info_schema.h> |
4979 | +#include <drizzled/plugin/info_schema_table.h> |
4980 | #include <drizzled/function/time/unix_timestamp.h> |
4981 | #include <drizzled/function/get_system_var.h> |
4982 | #include <drizzled/item/cmpfunc.h> |
4983 | @@ -39,9 +38,13 @@ |
4984 | #include <drizzled/statement/alter_table.h> |
4985 | #include "drizzled/probes.h" |
4986 | |
4987 | +#include "drizzled/plugin/logging.h" |
4988 | +#include "drizzled/plugin/info_schema_table.h" |
4989 | + |
4990 | #include <bitset> |
4991 | #include <algorithm> |
4992 | |
4993 | +using namespace drizzled; |
4994 | using namespace std; |
4995 | |
4996 | /* Prototypes */ |
4997 | @@ -189,7 +192,7 @@ |
4998 | |
4999 | /* TODO: set session->lex->sql_command to SQLCOM_END here */ |
5000 |
zomg. slots slots and more slots. We're getting somewhere...