diff options
author | Sergey Petrunia <sergefp@mysql.com> | 2009-02-23 19:16:48 +0300 |
---|---|---|
committer | Sergey Petrunia <sergefp@mysql.com> | 2009-02-23 19:16:48 +0300 |
commit | cb6581d89459a4c45e9146a40e1f0119a2e8e325 (patch) | |
tree | 3d3b5469190266610021c7ceae3e2beb730355fe /sql/set_var.cc | |
parent | fecaef26af0417a23f6585c79de41abd5f6aba86 (diff) | |
download | mariadb-git-cb6581d89459a4c45e9146a40e1f0119a2e8e325.tar.gz |
- Backport @@optimizer_switch support from 6.0
- Add support for setting it as a server commandline argument
- Add support for those switches:
= no_index_merge
= no_index_merge_union
= no_index_merge_sort_union
= no_index_merge_intersection
mysql-test/r/index_merge_myisam.result:
Testcases for index_merge related @@optimizer_switch flags.
mysql-test/t/index_merge_myisam.test:
Testcases for index_merge related @@optimizer_switch flags.
sql/set_var.cc:
- Backport @@optimizer_switch support from 6.0
- Add support for setting it as a server commandline argument
sql/sql_class.h:
- Backport @@optimizer_switch support from 6.0
sql/sql_select.h:
- Backport @@optimizer_switch support from 6.0
Diffstat (limited to 'sql/set_var.cc')
-rw-r--r-- | sql/set_var.cc | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc index f14068fcfcb..96eaa3c9c2b 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -468,6 +468,8 @@ static sys_var_thd_ulong sys_optimizer_prune_level(&vars, "optimizer_prun &SV::optimizer_prune_level); static sys_var_thd_ulong sys_optimizer_search_depth(&vars, "optimizer_search_depth", &SV::optimizer_search_depth); +static sys_var_thd_optimizer_switch sys_optimizer_switch(&vars, "optimizer_switch", + &SV::optimizer_switch); static sys_var_const sys_pid_file(&vars, "pid_file", OPT_GLOBAL, SHOW_CHAR, (uchar*) pidfile_name); @@ -3837,6 +3839,56 @@ ulong fix_sql_mode(ulong sql_mode) } +bool +sys_var_thd_optimizer_switch:: +symbolic_mode_representation(THD *thd, ulonglong val, LEX_STRING *rep) +{ + char buff[STRING_BUFFER_USUAL_SIZE*8]; + String tmp(buff, sizeof(buff), &my_charset_latin1); + + tmp.length(0); + + for (uint i= 0; val; val>>= 1, i++) + { + if (val & 1) + { + tmp.append(optimizer_switch_typelib.type_names[i], + optimizer_switch_typelib.type_lengths[i]); + tmp.append(','); + } + } + + if (tmp.length()) + tmp.length(tmp.length() - 1); /* trim the trailing comma */ + + rep->str= thd->strmake(tmp.ptr(), tmp.length()); + + rep->length= rep->str ? tmp.length() : 0; + + return rep->length != tmp.length(); +} + + +uchar *sys_var_thd_optimizer_switch::value_ptr(THD *thd, enum_var_type type, + LEX_STRING *base) +{ + LEX_STRING opts; + ulonglong val= ((type == OPT_GLOBAL) ? global_system_variables.*offset : + thd->variables.*offset); + (void) symbolic_mode_representation(thd, val, &opts); + return (uchar *) opts.str; +} + + +void sys_var_thd_optimizer_switch::set_default(THD *thd, enum_var_type type) +{ + if (type == OPT_GLOBAL) + global_system_variables.*offset= 0; + else + thd->variables.*offset= global_system_variables.*offset; +} + + /**************************************************************************** Named list handling ****************************************************************************/ |