Commit dba69910 authored by unknown's avatar unknown

Merge baker@bk-internal.mysql.com:/home/bk/mysql-5.0

into  zim.(none):/home/brian/mysql/fix-5.0


sql/handler.cc:
  Auto merged
parents c4eee8bd fb16683e
...@@ -119,12 +119,12 @@ struct show_table_type_st sys_table_types[]= ...@@ -119,12 +119,12 @@ struct show_table_type_st sys_table_types[]=
struct show_table_alias_st sys_table_aliases[]= struct show_table_alias_st sys_table_aliases[]=
{ {
{"INNOBASE", "InnoDB", NULL }, {"INNOBASE", "InnoDB"},
{"NDB", "NDBCLUSTER", NULL}, {"NDB", "NDBCLUSTER"},
{"BDB", "BERKELEYDB", NULL}, {"BDB", "BERKELEYDB"},
{"HEAP", "MEMORY", NULL}, {"HEAP", "MEMORY"},
{"MERGE", "MRG_MYISAM", NULL}, {"MERGE", "MRG_MYISAM"},
{NullS, NullS, NULL} {NullS, NullS}
}; };
const char *ha_row_type[] = { const char *ha_row_type[] = {
...@@ -145,28 +145,32 @@ enum db_type ha_resolve_by_name(const char *name, uint namelen) ...@@ -145,28 +145,32 @@ enum db_type ha_resolve_by_name(const char *name, uint namelen)
THD *thd= current_thd; THD *thd= current_thd;
show_table_alias_st *table_alias; show_table_alias_st *table_alias;
show_table_type_st *types; show_table_type_st *types;
const char *ptr= name;
if (thd && !my_strcasecmp(&my_charset_latin1, name, "DEFAULT")) { if (thd && !my_strcasecmp(&my_charset_latin1, ptr, "DEFAULT"))
return (enum db_type) thd->variables.table_type; return (enum db_type) thd->variables.table_type;
}
retest:
for (types= sys_table_types; types->type; types++) for (types= sys_table_types; types->type; types++)
{ {
if (!my_strcasecmp(&my_charset_latin1, name, types->type)) if (!my_strcasecmp(&my_charset_latin1, ptr, types->type))
return (enum db_type) types->db_type; return (enum db_type) types->db_type;
} }
/* /*
We check for the historical aliases next. We check for the historical aliases.
*/ */
for (table_alias= sys_table_aliases; table_alias->type; table_alias++) for (table_alias= sys_table_aliases; table_alias->type; table_alias++)
{ {
if (!my_strcasecmp(&my_charset_latin1, name, table_alias->alias) && table_alias->st) if (!my_strcasecmp(&my_charset_latin1, ptr, table_alias->alias))
return (enum db_type) table_alias->st->db_type; {
ptr= table_alias->type;
goto retest;
}
} }
return DB_TYPE_UNKNOWN; return DB_TYPE_UNKNOWN;
} }
const char *ha_get_storage_engine(enum db_type db_type) const char *ha_get_storage_engine(enum db_type db_type)
{ {
show_table_type_st *types; show_table_type_st *types;
...@@ -398,29 +402,20 @@ int ha_init() ...@@ -398,29 +402,20 @@ int ha_init()
if (ha_init_errors()) if (ha_init_errors())
return 1; return 1;
/*
This will go away soon.
*/
for (types= sys_table_types; types->type; types++) for (types= sys_table_types; types->type; types++)
{ {
switch (types->db_type) { switch (types->db_type) {
case DB_TYPE_HEAP: case DB_TYPE_HEAP:
types->ht= &heap_hton; types->ht= &heap_hton;
for (table_alias= sys_table_aliases; table_alias->type; table_alias++)
{
if (!my_strcasecmp(&my_charset_latin1, types->ht->name,
table_alias->type))
table_alias->st= types;
}
break; break;
case DB_TYPE_MYISAM: case DB_TYPE_MYISAM:
types->ht= &myisam_hton; types->ht= &myisam_hton;
break; break;
case DB_TYPE_MRG_MYISAM: case DB_TYPE_MRG_MYISAM:
types->ht= &myisammrg_hton; types->ht= &myisammrg_hton;
for (table_alias= sys_table_aliases; table_alias->type; table_alias++)
{
if (!my_strcasecmp(&my_charset_latin1, types->ht->name,
table_alias->type))
table_alias->st= types;
}
break; break;
#ifdef HAVE_BERKELEY_DB #ifdef HAVE_BERKELEY_DB
case DB_TYPE_BERKELEY_DB: case DB_TYPE_BERKELEY_DB:
...@@ -434,11 +429,6 @@ int ha_init() ...@@ -434,11 +429,6 @@ int ha_init()
else else
{ {
types->ht= &berkeley_hton; types->ht= &berkeley_hton;
for (table_alias= sys_table_aliases; table_alias->type; table_alias++)
{
if (!my_strcasecmp(&my_charset_latin1, types->ht->name, table_alias->type))
table_alias->st= types;
}
ha_was_inited_ok(ht++); ha_was_inited_ok(ht++);
} }
} }
...@@ -457,11 +447,6 @@ int ha_init() ...@@ -457,11 +447,6 @@ int ha_init()
{ {
ha_was_inited_ok(ht++); ha_was_inited_ok(ht++);
types->ht= &innobase_hton; types->ht= &innobase_hton;
for (table_alias= sys_table_aliases; table_alias->type; table_alias++)
{
if (!my_strcasecmp(&my_charset_latin1, types->ht->name, table_alias->type))
table_alias->st= types;
}
} }
} }
break; break;
...@@ -479,11 +464,6 @@ int ha_init() ...@@ -479,11 +464,6 @@ int ha_init()
{ {
ha_was_inited_ok(ht++); ha_was_inited_ok(ht++);
types->ht= &ndbcluster_hton; types->ht= &ndbcluster_hton;
for (table_alias= sys_table_aliases; table_alias->type; table_alias++)
{
if (!my_strcasecmp(&my_charset_latin1, types->ht->name, table_alias->type))
table_alias->st= types;
}
} }
} }
break; break;
......
...@@ -367,7 +367,6 @@ struct show_table_type_st { ...@@ -367,7 +367,6 @@ struct show_table_type_st {
struct show_table_alias_st { struct show_table_alias_st {
const char *alias; const char *alias;
const char *type; const char *type;
show_table_type_st *st;
}; };
/* Possible flags of a handlerton */ /* Possible flags of a handlerton */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment