diff options
author | Marc Alff <marc.alff@sun.com> | 2010-01-06 22:42:07 -0700 |
---|---|---|
committer | Marc Alff <marc.alff@sun.com> | 2010-01-06 22:42:07 -0700 |
commit | a4c3bc618bb83884a19dc157bc56d4e3d2432c22 (patch) | |
tree | ea8cbc9d70015a17aad75df30e7d223476eaa4da /sql/set_var.cc | |
parent | b2b055034c065307fca4dc04d00ce0c139b44808 (diff) | |
download | mariadb-git-a4c3bc618bb83884a19dc157bc56d4e3d2432c22.tar.gz |
WL#2360 Performance schema
Part IV: sql instrumentation
Diffstat (limited to 'sql/set_var.cc')
-rw-r--r-- | sql/set_var.cc | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc index 989934456df..73989b9c96f 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -1,4 +1,4 @@ -/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. +/* Copyright 2000-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -38,16 +38,12 @@ static uchar *get_sys_var_length(const sys_var *var, size_t *length, sys_var_chain all_sys_vars = { NULL, NULL }; -int sys_var_init(DYNAMIC_ARRAY *long_options) +int sys_var_init() { - uint count= 0; - uint saved_elements= long_options->elements; - DBUG_ENTER("sys_var_init"); - for (sys_var *var=all_sys_vars.first; var; var= var->next, count++) - if (var->register_option(long_options)) - goto error; + /* Must be already initialized. */ + DBUG_ASSERT(system_charset_info != NULL); if (my_hash_init(&system_variable_hash, system_charset_info, 100, 0, 0, (my_hash_get_key) get_sys_var_length, 0, HASH_UNIQUE)) @@ -60,6 +56,25 @@ int sys_var_init(DYNAMIC_ARRAY *long_options) error: fprintf(stderr, "failed to initialize System variables"); + DBUG_RETURN(1); +} + +int sys_var_add_options(DYNAMIC_ARRAY *long_options, int parse_flags) +{ + uint saved_elements= long_options->elements; + + DBUG_ENTER("sys_var_add_options"); + + for (sys_var *var=all_sys_vars.first; var; var= var->next) + { + if (var->register_option(long_options, parse_flags)) + goto error; + } + + DBUG_RETURN(0); + +error: + fprintf(stderr, "failed to initialize System variables"); long_options->elements= saved_elements; DBUG_RETURN(1); } @@ -99,6 +114,7 @@ void sys_var_end() @param deprecated_version if not 0 - when this variable will go away @param substitute if not 0 - what one should use instead when this deprecated variable + @param parse_flag either PARSE_EARLY or PARSE_NORMAL */ sys_var::sys_var(sys_var_chain *chain, const char *name_arg, const char *comment, int flags_arg, ptrdiff_t off, @@ -107,10 +123,11 @@ sys_var::sys_var(sys_var_chain *chain, const char *name_arg, PolyLock *lock, enum binlog_status_enum binlog_status_arg, on_check_function on_check_func, on_update_function on_update_func, - uint deprecated_version, const char *substitute) : + uint deprecated_version, const char *substitute, + int parse_flag) : next(0), binlog_status(binlog_status_arg), - flags(flags_arg), show_val_type(show_val_type_arg), + flags(flags_arg), m_parse_flag(parse_flag), show_val_type(show_val_type_arg), guard(lock), offset(off), on_check(on_check_func), on_update(on_update_func), is_os_charset(FALSE) { @@ -203,7 +220,7 @@ uchar *sys_var::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { if (type == OPT_GLOBAL || scope() == GLOBAL) { - safe_mutex_assert_owner(&LOCK_global_system_variables); + mysql_mutex_assert_owner(&LOCK_global_system_variables); AutoRLock lock(guard); return global_value_ptr(thd, base); } |