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