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