summaryrefslogtreecommitdiff
path: root/sql/set_var.cc
diff options
context:
space:
mode:
authorantony@ltantony.rdg.cyberkinetica.homeunix.net <>2003-12-02 20:57:34 +0000
committerantony@ltantony.rdg.cyberkinetica.homeunix.net <>2003-12-02 20:57:34 +0000
commit55d4248daed338af0a37709b3930431f1fa7d3fa (patch)
tree28430fb68ab7df9013fbdd16332a80afc913c5aa /sql/set_var.cc
parent1be4a37fa2762cf4ffd484d0c7e48b20a2fa2c8e (diff)
parentafc619f0a2e4351bd39acac53ec2fbc6be266a28 (diff)
downloadmariadb-git-55d4248daed338af0a37709b3930431f1fa7d3fa.tar.gz
Merge for update
Diffstat (limited to 'sql/set_var.cc')
-rw-r--r--sql/set_var.cc59
1 files changed, 57 insertions, 2 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 7e576b5a755..5b956cd9c76 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -284,8 +284,8 @@ sys_var_thd_ulong sys_sort_buffer("sort_buffer_size",
&SV::sortbuff_size);
sys_var_thd_sql_mode sys_sql_mode("sql_mode",
&SV::sql_mode);
-sys_var_thd_enum sys_table_type("table_type", &SV::table_type,
- &ha_table_typelib);
+sys_var_thd_table_type sys_table_type("table_type",
+ &SV::table_type);
sys_var_long_ptr sys_table_cache_size("table_cache",
&table_cache_size);
sys_var_long_ptr sys_thread_cache_size("thread_cache_size",
@@ -2409,6 +2409,61 @@ int set_var_password::update(THD *thd)
}
/****************************************************************************
+ Functions to handle table_type
+****************************************************************************/
+
+bool sys_var_thd_table_type::check(THD *thd, set_var *var)
+ /* Based upon sys_var::check_enum() */
+{
+ char buff[80];
+ const char *value;
+ String str(buff, sizeof(buff), &my_charset_latin1), *res;
+
+ if (var->value->result_type() == STRING_RESULT)
+ {
+ if (!(res=var->value->val_str(&str)) ||
+ !(var->save_result.ulong_value=
+ (ulong) ha_resolve_by_name(res->ptr(), res->length())))
+ {
+ value= res ? res->c_ptr() : "NULL";
+ goto err;
+ }
+ return 0;
+ }
+
+err:
+ my_error(ER_UNKNOWN_TABLE_ENGINE, MYF(0), value);
+ return 1;
+}
+
+byte *sys_var_thd_table_type::value_ptr(THD *thd, enum_var_type type,
+ LEX_STRING *base)
+{
+ ulong val;
+ val= ((type == OPT_GLOBAL) ? global_system_variables.*offset :
+ thd->variables.*offset);
+ const char *table_type= ha_get_table_type((enum db_type)val);
+ return (byte *)table_type;
+}
+
+void sys_var_thd_table_type::set_default(THD *thd, enum_var_type type)
+{
+ if (type == OPT_GLOBAL)
+ global_system_variables.*offset= (ulong) DB_TYPE_MYISAM;
+ else
+ thd->variables.*offset= (ulong) (global_system_variables.*offset);
+}
+
+bool sys_var_thd_table_type::update(THD *thd, set_var *var)
+{
+ if (var->type == OPT_GLOBAL)
+ global_system_variables.*offset= var->save_result.ulong_value;
+ else
+ thd->variables.*offset= var->save_result.ulong_value;
+ return 0;
+}
+
+/****************************************************************************
Functions to handle sql_mode
****************************************************************************/