The world's most popular open source database
#include <commands.h>
Inheritance diagram for Abstract_option_cmd:


Public Member Functions | |
| ~Abstract_option_cmd () | |
| bool | add_option (const LEX_STRING *instance_name, Named_value *option) |
| bool | init (const char **text) |
| virtual int | execute (st_net *net, ulong connection_id) |
Protected Member Functions | |
| Abstract_option_cmd (Instance_map *instance_map_arg) | |
| int | correct_file (Instance *instance, Named_value *option, bool skip) |
| virtual bool | parse_args (const char **text)=0 |
| virtual int | process_option (Instance *instance, Named_value *option)=0 |
Private Member Functions | |
| Instance_options_list * | get_instance_options_list (const LEX_STRING *instance_name) |
| int | execute_impl (st_net *net, ulong connection_id) |
Private Attributes | |
| HASH | instance_options_map |
| bool | initialized |
Definition at line 288 of file commands.h.
| Abstract_option_cmd::~Abstract_option_cmd | ( | ) |
Definition at line 1224 of file commands.cc.
References hash_free(), initialized, and instance_options_map.
01225 { 01226 if (initialized) 01227 hash_free(&instance_options_map); 01228 }
Here is the call graph for this function:

| C_MODE_END Abstract_option_cmd::Abstract_option_cmd | ( | Instance_map * | instance_map_arg | ) | [protected] |
Definition at line 1217 of file commands.cc.
01218 :Command(instance_map_arg), 01219 initialized(FALSE) 01220 { 01221 }
| bool Abstract_option_cmd::add_option | ( | const LEX_STRING * | instance_name, | |
| Named_value * | option | |||
| ) |
Definition at line 1231 of file commands.cc.
References Named_value_arr::add_element(), FALSE, get_instance_options_list(), Instance_options_list::options, and TRUE.
Referenced by Unset_option::parse_args(), and Set_option::parse_args().
01233 { 01234 Instance_options_list *lst= get_instance_options_list(instance_name); 01235 01236 if (!lst) 01237 return TRUE; 01238 01239 lst->options.add_element(option); 01240 01241 return FALSE; 01242 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int Abstract_option_cmd::correct_file | ( | Instance * | instance, | |
| Named_value * | option, | |||
| bool | skip | |||
| ) | [protected] |
Definition at line 1277 of file commands.cc.
References Options::Main::config_file, DBUG_ASSERT, Instance::get_name(), Named_value::get_name(), Named_value::get_value(), log_error(), modify_defaults_file(), modify_defaults_to_im_error, and LEX_STRING::str.
Referenced by Unset_option::process_option(), and Set_option::process_option().
01279 { 01280 int err_code= modify_defaults_file(Options::Main::config_file, 01281 option->get_name(), 01282 option->get_value(), 01283 instance->get_name()->str, 01284 skip); 01285 01286 DBUG_ASSERT(err_code >= 0 && err_code <= 2); 01287 01288 if (err_code) 01289 { 01290 log_error("Can not modify option (%s) in defaults file (%s). " 01291 "Original error code: %d.", 01292 (const char *) option->get_name(), 01293 (const char *) Options::Main::config_file, 01294 (int) err_code); 01295 } 01296 01297 return modify_defaults_to_im_error[err_code]; 01298 }
Here is the call graph for this function:

Here is the caller graph for this function:

Implements Command.
Definition at line 1312 of file commands.cc.
References execute_impl(), Command::instance_map, Instance_map::lock(), and Instance_map::unlock().
01313 { 01314 int err_code; 01315 01316 instance_map->lock(); 01317 01318 err_code= execute_impl(net, connection_id); 01319 01320 instance_map->unlock(); 01321 01322 return err_code; 01323 }
Here is the call graph for this function:

Definition at line 1352 of file commands.cc.
References ER_BAD_INSTANCE_NAME, ER_INSTANCE_IS_ACTIVE, Instance_map::find(), Instance_map::guardian, hash_element(), Command::instance_map, instance_options_map, Guardian_thread::is_active(), net_send_ok(), NULL, process_option(), and st_hash::records.
Referenced by execute().
01353 { 01354 int err_code; 01355 01356 /* Check that all the specified instances exist and are offline. */ 01357 01358 for (uint i= 0; i < instance_options_map.records; ++i) 01359 { 01360 Instance_options_list *lst= 01361 (Instance_options_list *) hash_element(&instance_options_map, i); 01362 01363 lst->instance= instance_map->find(lst->get_instance_name()); 01364 01365 if (!lst->instance) 01366 return ER_BAD_INSTANCE_NAME; 01367 01368 if (instance_map->guardian->is_active(lst->instance)) 01369 return ER_INSTANCE_IS_ACTIVE; 01370 } 01371 01372 /* Perform command-specific (SET/UNSET) actions. */ 01373 01374 for (uint i= 0; i < instance_options_map.records; ++i) 01375 { 01376 Instance_options_list *lst= 01377 (Instance_options_list *) hash_element(&instance_options_map, i); 01378 01379 for (int j= 0; j < lst->options.get_size(); ++j) 01380 { 01381 Named_value option= lst->options.get_element(j); 01382 err_code= process_option(lst->instance, &option); 01383 01384 if (err_code) 01385 break; 01386 } 01387 01388 if (err_code) 01389 break; 01390 } 01391 01392 if (err_code == 0) 01393 net_send_ok(net, connection_id, NULL); 01394 01395 return err_code; 01396 }
Here is the call graph for this function:

Here is the caller graph for this function:

| Instance_options_list * Abstract_option_cmd::get_instance_options_list | ( | const LEX_STRING * | instance_name | ) | [private] |
Definition at line 1327 of file commands.cc.
References hash_search(), Instance_options_list::init(), instance_options_map, LEX_STRING::length, my_hash_insert(), NULL, and LEX_STRING::str.
Referenced by add_option().
01328 { 01329 Instance_options_list *lst= 01330 (Instance_options_list *) hash_search(&instance_options_map, 01331 (byte *) instance_name->str, 01332 instance_name->length); 01333 01334 if (!lst) 01335 { 01336 lst= new Instance_options_list(instance_name); 01337 01338 if (!lst) 01339 return NULL; 01340 01341 if (lst->init() || my_hash_insert(&instance_options_map, (byte *) lst)) 01342 { 01343 delete lst; 01344 return NULL; 01345 } 01346 } 01347 01348 return lst; 01349 }
Here is the call graph for this function:

Here is the caller graph for this function:

| bool Abstract_option_cmd::init | ( | const char ** | text | ) |
Definition at line 1245 of file commands.cc.
References default_charset_info, delete_item(), FALSE, get_item_key(), hash_init, initialized, instance_options_map, parse_args(), and TRUE.
Referenced by parse_command().
01246 { 01247 static const int INITIAL_HASH_SIZE= 16; 01248 01249 if (hash_init(&instance_options_map, default_charset_info, 01250 INITIAL_HASH_SIZE, 0, 0, get_item_key, delete_item, 0)) 01251 return TRUE; 01252 01253 if (parse_args(text)) 01254 return TRUE; 01255 01256 initialized= TRUE; 01257 01258 return FALSE; 01259 }
Here is the call graph for this function:

Here is the caller graph for this function:

| virtual bool Abstract_option_cmd::parse_args | ( | const char ** | text | ) | [protected, pure virtual] |
Implemented in Set_option, and Unset_option.
Referenced by init().
Here is the caller graph for this function:

| virtual int Abstract_option_cmd::process_option | ( | Instance * | instance, | |
| Named_value * | option | |||
| ) | [protected, pure virtual] |
Implemented in Set_option, and Unset_option.
Referenced by execute_impl().
Here is the caller graph for this function:

bool Abstract_option_cmd::initialized [private] |
Definition at line 317 of file commands.h.
Referenced by execute_impl(), get_instance_options_list(), init(), and ~Abstract_option_cmd().
1.4.7

