Commit 69cee792 authored by unknown's avatar unknown

WorkLog #1323 (part 2)

New Statement: SHOW [STORAGE] ENGINES
New System Variable: storage_engine
New mysqld Argument: --default-storage-engine=


include/mysqld_error.h:
  We now call handlers STORAGE ENGINEs
include/sql_state.h:
  We now call handlers STORAGE ENGINEs
mysql-test/r/create.result:
  table_type system variable becomes storage_engine
mysql-test/r/key_cache.result:
  table_type system variable becomes storage_engine
mysql-test/r/variables.result:
  table_type system variable becomes storage_engine
mysql-test/r/warnings.result:
  Test for deprecated table_type system variable
mysql-test/t/create.test:
  table_type system variable becomes storage_engine
mysql-test/t/key_cache.test:
  table_type system variable becomes storage_engine
mysql-test/t/variables.test:
  table_type system variable becomes storage_engine
mysql-test/t/warnings.test:
  Test for deprecated table_type system variable
sql/handler.cc:
  change name for consistency
sql/handler.h:
  change name for consistency
sql/lex.h:
  New keywords - ENGINES and STORAGE
sql/mysql_priv.h:
  change name for consistency
sql/mysqld.cc:
  New command like argument for default-storage-engine
sql/set_var.cc:
  New system variable for storage_engine
sql/set_var.h:
  New system variable for storage_engine
sql/sql_lex.h:
  Change for consistancy
sql/sql_parse.cc:
  Change for consistancy
sql/sql_show.cc:
  Change for consistancy
sql/sql_table.cc:
  Change for consistancy
sql/sql_yacc.yy:
  New keywords: STORAGE and ENGINES
  Change table_types to storage_engines
  New statement: SHOW [STORAGE] ENGINES
parent 24794dbc
......@@ -301,6 +301,6 @@
#define ER_BAD_FT_COLUMN 1282
#define ER_UNKNOWN_KEY_CACHE 1283
#define ER_WARN_HOSTNAME_WONT_WORK 1284
#define ER_UNKNOWN_TABLE_ENGINE 1285
#define ER_UNKNOWN_STORAGE_ENGINE 1285
#define ER_WARN_DEPRECATED_SYNTAX 1286
#define ER_ERROR_MESSAGES 287
......@@ -161,4 +161,4 @@ ER_WARN_DATA_OUT_OF_RANGE, "01000", "",
ER_WARN_DATA_TRUNCATED, "01000", "",
ER_WRONG_NAME_FOR_INDEX, "42000", "",
ER_WRONG_NAME_FOR_CATALOG, "42000", "",
ER_UNKNOWN_TABLE_ENGINE, "42000", "",
ER_UNKNOWN_STORAGE_ENGINE, "42000", "",
......@@ -189,9 +189,9 @@ select * from t1;
if('2002'='2002','Y','N')
Y
drop table if exists t1;
SET SESSION table_type="heap";
SELECT @@table_type;
@@table_type
SET SESSION storage_engine="heap";
SELECT @@storage_engine;
@@storage_engine
HEAP
CREATE TABLE t1 (a int not null);
show create table t1;
......@@ -200,10 +200,10 @@ t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0'
) ENGINE=HEAP DEFAULT CHARSET=latin1
drop table t1;
SET SESSION table_type="gemini";
SET SESSION storage_engine="gemini";
ERROR 42000: Unknown table engine 'gemini'
SELECT @@table_type;
@@table_type
SELECT @@storage_engine;
@@storage_engine
HEAP
CREATE TABLE t1 (a int not null);
show create table t1;
......@@ -211,7 +211,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0'
) ENGINE=HEAP DEFAULT CHARSET=latin1
SET SESSION table_type=default;
SET SESSION storage_engine=default;
drop table t1;
create table t1 ( k1 varchar(2), k2 int, primary key(k1,k2));
insert into t1 values ("a", 1), ("b", 2);
......@@ -334,9 +334,9 @@ ERROR 42000: Incorrect table name 'a/a'
drop table t1, t2, t3;
drop table t3;
drop database test_$1;
SET SESSION table_type="heap";
SELECT @@table_type;
@@table_type
SET SESSION storage_engine="heap";
SELECT @@storage_engine;
@@storage_engine
HEAP
CREATE TABLE t1 (a int not null);
show create table t1;
......@@ -345,10 +345,10 @@ t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0'
) ENGINE=HEAP DEFAULT CHARSET=latin1
drop table t1;
SET SESSION table_type="gemini";
SET SESSION storage_engine="gemini";
ERROR 42000: Unknown table engine 'gemini'
SELECT @@table_type;
@@table_type
SELECT @@storage_engine;
@@storage_engine
HEAP
CREATE TABLE t1 (a int not null);
show create table t1;
......@@ -356,7 +356,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0'
) ENGINE=HEAP DEFAULT CHARSET=latin1
SET SESSION table_type=default;
SET SESSION storage_engine=default;
drop table t1;
create table t1(a int,b int,c int unsigned,d date,e char,f datetime,g time,h blob);
insert into t1(a)values(1);
......
......@@ -40,8 +40,8 @@ SELECT @@medium.key_buffer_size;
SET @@global.key_buffer_size=@save_key_buffer;
SELECT @@default.key_buffer_size;
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'default.key_buffer_size' at line 1
SELECT @@skr.table_type="test";
ERROR HY000: Variable 'table_type' is not a variable component (Can't be used as XXXX.variable_name)
SELECT @@skr.storage_engine="test";
ERROR HY000: Variable 'storage_engine' is not a variable component (Can't be used as XXXX.variable_name)
select @@keycache1.key_cache_block_size;
@@keycache1.key_cache_block_size
0
......
......@@ -115,13 +115,13 @@ set global concurrent_insert=DEFAULT;
show variables like 'concurrent_insert';
Variable_name Value
concurrent_insert ON
set table_type=MYISAM, table_type="HEAP", global table_type="INNODB";
show local variables like 'table_type';
set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="INNODB";
show local variables like 'storage_engine';
Variable_name Value
table_type HEAP
show global variables like 'table_type';
storage_engine HEAP
show global variables like 'storage_engine';
Variable_name Value
table_type InnoDB
storage_engine InnoDB
set GLOBAL query_cache_size=100000;
set GLOBAL myisam_max_sort_file_size=2000000;
show global variables like 'myisam_max_sort_file_size';
......@@ -218,17 +218,17 @@ set unknown_variable=1;
ERROR HY000: Unknown system variable 'unknown_variable'
set max_join_size="hello";
ERROR 42000: Wrong argument type to variable 'max_join_size'
set table_type=UNKNOWN_TABLE_TYPE;
set storage_engine=UNKNOWN_TABLE_TYPE;
ERROR 42000: Unknown table engine 'UNKNOWN_TABLE_TYPE'
set table_type=INNODB, big_tables=2;
set storage_engine=INNODB, big_tables=2;
ERROR 42000: Variable 'big_tables' can't be set to the value of '2'
show local variables like 'table_type';
show local variables like 'storage_engine';
Variable_name Value
table_type HEAP
storage_engine HEAP
set SESSION query_cache_size=10000;
ERROR HY000: Variable 'query_cache_size' is a GLOBAL variable and should be set with SET GLOBAL
set GLOBAL table_type=DEFAULT;
ERROR 42000: Variable 'table_type' doesn't have a default value
set GLOBAL storage_engine=DEFAULT;
ERROR 42000: Variable 'storage_engine' doesn't have a default value
set character_set_client=UNKNOWN_CHARACTER_SET;
ERROR 42000: Unknown character set: 'UNKNOWN_CHARACTER_SET'
set collation_connection=UNKNOWN_COLLATION;
......@@ -348,7 +348,7 @@ set sql_select_limit=1;
set global sql_slave_skip_counter=100;
set sql_warnings=1;
set global table_cache=100;
set table_type=myisam;
set storage_engine=myisam;
set global thread_cache_size=100;
set timestamp=1, timestamp=default;
set tmp_table_size=100;
......
......@@ -133,3 +133,6 @@ alter table t1 type=myisam;
Warnings:
Warning 1286 'TYPE=database_engine' is deprecated. Use 'ENGINE=database_engine' instead.
drop table t1;
set table_type=MYISAM;
Warnings:
Warning 1286 'table_type' is deprecated. Use 'storage_engine' instead.
......@@ -152,17 +152,17 @@ drop table if exists t1;
#
# Test default table type
#
SET SESSION table_type="heap";
SELECT @@table_type;
SET SESSION storage_engine="heap";
SELECT @@storage_engine;
CREATE TABLE t1 (a int not null);
show create table t1;
drop table t1;
--error 1285
SET SESSION table_type="gemini";
SELECT @@table_type;
SET SESSION storage_engine="gemini";
SELECT @@storage_engine;
CREATE TABLE t1 (a int not null);
show create table t1;
SET SESSION table_type=default;
SET SESSION storage_engine=default;
drop table t1;
......@@ -272,17 +272,17 @@ drop database test_$1;
#
# Test default table type
#
SET SESSION table_type="heap";
SELECT @@table_type;
SET SESSION storage_engine="heap";
SELECT @@storage_engine;
CREATE TABLE t1 (a int not null);
show create table t1;
drop table t1;
--error 1285
SET SESSION table_type="gemini";
SELECT @@table_type;
SET SESSION storage_engine="gemini";
SELECT @@storage_engine;
CREATE TABLE t1 (a int not null);
show create table t1;
SET SESSION table_type=default;
SET SESSION storage_engine=default;
drop table t1;
#
......
......@@ -42,7 +42,7 @@ SET @@global.key_buffer_size=@save_key_buffer;
--error 1064
SELECT @@default.key_buffer_size;
--error 1271
SELECT @@skr.table_type="test";
SELECT @@skr.storage_engine="test";
select @@keycache1.key_cache_block_size;
select @@keycache1.key_buffer_size;
......
......@@ -70,9 +70,9 @@ show variables like 'concurrent_insert';
set global concurrent_insert=DEFAULT;
show variables like 'concurrent_insert';
set table_type=MYISAM, table_type="HEAP", global table_type="INNODB";
show local variables like 'table_type';
show global variables like 'table_type';
set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="INNODB";
show local variables like 'storage_engine';
show global variables like 'storage_engine';
set GLOBAL query_cache_size=100000;
set GLOBAL myisam_max_sort_file_size=2000000;
......@@ -125,14 +125,14 @@ set unknown_variable=1;
--error 1232
set max_join_size="hello";
--error 1285
set table_type=UNKNOWN_TABLE_TYPE;
set storage_engine=UNKNOWN_TABLE_TYPE;
--error 1231
set table_type=INNODB, big_tables=2;
show local variables like 'table_type';
set storage_engine=INNODB, big_tables=2;
show local variables like 'storage_engine';
--error 1229
set SESSION query_cache_size=10000;
--error 1230
set GLOBAL table_type=DEFAULT;
set GLOBAL storage_engine=DEFAULT;
--error 1115
set character_set_client=UNKNOWN_CHARACTER_SET;
--error 1272
......@@ -235,7 +235,7 @@ set sql_select_limit=1;
set global sql_slave_skip_counter=100;
set sql_warnings=1;
set global table_cache=100;
set table_type=myisam;
set storage_engine=myisam;
set global thread_cache_size=100;
set timestamp=1, timestamp=default;
set tmp_table_size=100;
......
......@@ -91,3 +91,8 @@ create table t1 (id int) type=heap;
alter table t1 type=myisam;
drop table t1;
#
# Test for deprecated table_type variable
#
set table_type=MYISAM;
......@@ -104,7 +104,7 @@ enum db_type ha_resolve_by_name(const char *name, uint namelen)
return DB_TYPE_UNKNOWN;
}
const char *ha_get_table_type(enum db_type db_type)
const char *ha_get_storage_engine(enum db_type db_type)
{
show_table_type_st *types;
for (types= sys_table_types; types->type; types++)
......
......@@ -392,7 +392,7 @@ extern TYPELIB tx_isolation_typelib;
#define ha_supports_generate(T) (T != DB_TYPE_INNODB)
enum db_type ha_resolve_by_name(const char *name, uint namelen);
const char *ha_get_table_type(enum db_type db_type);
const char *ha_get_storage_engine(enum db_type db_type);
handler *get_new_handler(TABLE *table, enum db_type db_type);
my_off_t ha_get_ptr(byte *ptr, uint pack_length);
void ha_store_ptr(byte *buff, uint pack_length, my_off_t pos);
......
......@@ -146,6 +146,7 @@ static SYMBOL symbols[] = {
{ "ENCLOSED", SYM(ENCLOSED),0,0},
{ "END", SYM(END),0,0},
{ "ENGINE", SYM(ENGINE_SYM),0,0},
{ "ENGINES", SYM(ENGINES_SYM),0,0},
{ "ENUM", SYM(ENUM),0,0},
{ "ERRORS", SYM(ERRORS),0,0},
{ "ESCAPE", SYM(ESCAPE_SYM),0,0},
......@@ -379,6 +380,7 @@ static SYMBOL symbols[] = {
{ "STARTING", SYM(STARTING),0,0},
{ "STATUS", SYM(STATUS_SYM),0,0},
{ "STOP", SYM(STOP_SYM),0,0},
{ "STORAGE", SYM(STORAGE_SYM),0,0},
{ "STRAIGHT_JOIN", SYM(STRAIGHT_JOIN),0,0},
{ "STRING", SYM(STRING_SYM),0,0},
{ "STRIPED", SYM(RAID_STRIPED_SYM),0,0},
......
......@@ -606,7 +606,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
pthread_mutex_t *mutex);
int mysqld_show_charsets(THD *thd,const char *wild);
int mysqld_show_collations(THD *thd,const char *wild);
int mysqld_show_table_types(THD *thd);
int mysqld_show_storage_engines(THD *thd);
int mysqld_show_privileges(THD *thd);
int mysqld_show_column_types(THD *thd);
int mysqld_help (THD *thd, const char *text);
......
......@@ -3547,7 +3547,7 @@ enum options_mysqld
OPT_SKIP_HOST_CACHE, OPT_SHORT_LOG_FORMAT,
OPT_FLUSH, OPT_SAFE,
OPT_BOOTSTRAP, OPT_SKIP_SHOW_DB,
OPT_TABLE_TYPE, OPT_INIT_FILE,
OPT_STORAGE_ENGINE, OPT_INIT_FILE,
OPT_DELAY_KEY_WRITE_ALL, OPT_SLOW_QUERY_LOG,
OPT_DELAY_KEY_WRITE, OPT_CHARSETS_DIR,
OPT_BDB_HOME, OPT_BDB_LOG,
......@@ -3756,8 +3756,11 @@ Disable with --skip-bdb (will save memory).",
{"default-collation", OPT_DEFAULT_COLLATION, "Set the default collation.",
(gptr*) &default_collation_name, (gptr*) &default_collation_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{"default-table-type", OPT_TABLE_TYPE,
"Set the default table type for tables.", 0, 0,
{"default-storage-engine", OPT_STORAGE_ENGINE,
"Set the default storage engine (table tyoe) for tables.", 0, 0,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default-table-type", OPT_STORAGE_ENGINE,
"(deprecated) Use default-storage-engine.", 0, 0,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"delay-key-write", OPT_DELAY_KEY_WRITE, "Type of DELAY_KEY_WRITE.",
0,0,0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
......@@ -4734,8 +4737,8 @@ struct show_var_st status_vars[]= {
{"Com_show_slave_hosts", (char*) (com_stat+(uint) SQLCOM_SHOW_SLAVE_HOSTS),SHOW_LONG},
{"Com_show_slave_status", (char*) (com_stat+(uint) SQLCOM_SHOW_SLAVE_STAT),SHOW_LONG},
{"Com_show_status", (char*) (com_stat+(uint) SQLCOM_SHOW_STATUS),SHOW_LONG},
{"Com_show_storage_engines", (char*) (com_stat+(uint) SQLCOM_SHOW_STORAGE_ENGINES),SHOW_LONG},
{"Com_show_tables", (char*) (com_stat+(uint) SQLCOM_SHOW_TABLES),SHOW_LONG},
{"Com_show_table_types", (char*) (com_stat+(uint) SQLCOM_SHOW_TABLE_TYPES),SHOW_LONG},
{"Com_show_variables", (char*) (com_stat+(uint) SQLCOM_SHOW_VARIABLES),SHOW_LONG},
{"Com_show_warnings", (char*) (com_stat+(uint) SQLCOM_SHOW_WARNS),SHOW_LONG},
{"Com_slave_start", (char*) (com_stat+(uint) SQLCOM_SLAVE_START),SHOW_LONG},
......@@ -5422,7 +5425,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case OPT_BOOTSTRAP:
opt_noacl=opt_bootstrap=1;
break;
case OPT_TABLE_TYPE:
case OPT_STORAGE_ENGINE:
{
if ((enum db_type)((global_system_variables.table_type=
ha_resolve_by_name(argument, strlen(argument)))) == DB_TYPE_UNKNOWN)
......
......@@ -294,6 +294,8 @@ sys_var_thd_sql_mode sys_sql_mode("sql_mode",
&SV::sql_mode);
sys_var_thd_table_type sys_table_type("table_type",
&SV::table_type);
sys_var_thd_storage_engine sys_storage_engine("storage_engine",
&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",
......@@ -526,6 +528,7 @@ sys_var *sys_variables[]=
&sys_sql_max_join_size,
&sys_sql_mode,
&sys_sql_warnings,
&sys_storage_engine,
&sys_table_cache_size,
&sys_table_type,
&sys_thread_cache_size,
......@@ -731,6 +734,7 @@ struct show_var_st init_vars[]= {
#endif
{sys_sort_buffer.name, (char*) &sys_sort_buffer, SHOW_SYS},
{sys_sql_mode.name, (char*) &sys_sql_mode, SHOW_SYS},
{sys_storage_engine.name, (char*) &sys_storage_engine, SHOW_SYS},
{"table_cache", (char*) &table_cache_size, SHOW_LONG},
{sys_table_type.name, (char*) &sys_table_type, SHOW_SYS},
{sys_thread_cache_size.name,(char*) &sys_thread_cache_size, SHOW_SYS},
......@@ -2484,7 +2488,7 @@ int set_var_password::update(THD *thd)
/* Based upon sys_var::check_enum() */
bool sys_var_thd_table_type::check(THD *thd, set_var *var)
bool sys_var_thd_storage_engine::check(THD *thd, set_var *var)
{
char buff[80];
const char *value;
......@@ -2503,23 +2507,23 @@ bool sys_var_thd_table_type::check(THD *thd, set_var *var)
}
err:
my_error(ER_UNKNOWN_TABLE_ENGINE, MYF(0), value);
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), value);
return 1;
}
byte *sys_var_thd_table_type::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
byte *sys_var_thd_storage_engine::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);
const char *table_type= ha_get_storage_engine((enum db_type)val);
return (byte *) table_type;
}
void sys_var_thd_table_type::set_default(THD *thd, enum_var_type type)
void sys_var_thd_storage_engine::set_default(THD *thd, enum_var_type type)
{
if (type == OPT_GLOBAL)
global_system_variables.*offset= (ulong) DB_TYPE_MYISAM;
......@@ -2528,7 +2532,7 @@ void sys_var_thd_table_type::set_default(THD *thd, enum_var_type type)
}
bool sys_var_thd_table_type::update(THD *thd, set_var *var)
bool sys_var_thd_storage_engine::update(THD *thd, set_var *var)
{
if (var->type == OPT_GLOBAL)
global_system_variables.*offset= var->save_result.ulong_value;
......@@ -2537,6 +2541,25 @@ bool sys_var_thd_table_type::update(THD *thd, set_var *var)
return 0;
}
void sys_var_thd_table_type::warn_deprecated(THD *thd)
{
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_DEPRECATED_SYNTAX,
ER(ER_WARN_DEPRECATED_SYNTAX), "table_type", "storage_engine");
}
void sys_var_thd_table_type::set_default(THD *thd, enum_var_type type)
{
warn_deprecated(thd);
sys_var_thd_storage_engine::set_default(thd, type);
}
bool sys_var_thd_table_type::update(THD *thd, set_var *var)
{
warn_deprecated(thd);
return sys_var_thd_storage_engine::update(thd, var);
}
/****************************************************************************
Functions to handle sql_mode
......
......@@ -344,12 +344,12 @@ public:
};
class sys_var_thd_table_type :public sys_var_thd
class sys_var_thd_storage_engine :public sys_var_thd
{
protected:
ulong SV::*offset;
public:
sys_var_thd_table_type(const char *name_arg, ulong SV::*offset_arg)
sys_var_thd_storage_engine(const char *name_arg, ulong SV::*offset_arg)
:sys_var_thd(name_arg), offset(offset_arg)
{}
bool check(THD *thd, set_var *var);
......@@ -363,6 +363,16 @@ SHOW_TYPE type() { return SHOW_CHAR; }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
class sys_var_thd_table_type :public sys_var_thd_storage_engine
{
public:
sys_var_thd_table_type(const char *name_arg, ulong SV::*offset_arg)
:sys_var_thd_storage_engine(name_arg, offset_arg)
{}
void warn_deprecated(THD *thd);
void set_default(THD *thd, enum_var_type type);
bool update(THD *thd, set_var *var);
};
class sys_var_thd_bit :public sys_var_thd
{
......
......@@ -73,7 +73,7 @@ enum enum_sql_command {
SQLCOM_SHOW_SLAVE_HOSTS, SQLCOM_DELETE_MULTI, SQLCOM_UPDATE_MULTI,
SQLCOM_SHOW_BINLOG_EVENTS, SQLCOM_SHOW_NEW_MASTER, SQLCOM_DO,
SQLCOM_SHOW_WARNS, SQLCOM_EMPTY_QUERY, SQLCOM_SHOW_ERRORS,
SQLCOM_SHOW_COLUMN_TYPES, SQLCOM_SHOW_TABLE_TYPES, SQLCOM_SHOW_PRIVILEGES,
SQLCOM_SHOW_COLUMN_TYPES, SQLCOM_SHOW_STORAGE_ENGINES, SQLCOM_SHOW_PRIVILEGES,
SQLCOM_HELP, SQLCOM_DROP_USER, SQLCOM_REVOKE_ALL, SQLCOM_CHECKSUM,
/* This should be the last !!! */
......
......@@ -2831,8 +2831,8 @@ mysql_execute_command(THD *thd)
#endif
,lex->verbose);
break;
case SQLCOM_SHOW_TABLE_TYPES:
res= mysqld_show_table_types(thd);
case SQLCOM_SHOW_STORAGE_ENGINES:
res= mysqld_show_storage_engines(thd);
break;
case SQLCOM_SHOW_PRIVILEGES:
res= mysqld_show_privileges(thd);
......
......@@ -173,11 +173,11 @@ int mysqld_show_tables(THD *thd,const char *db,const char *wild)
** List all table types supported
***************************************************************************/
int mysqld_show_table_types(THD *thd)
int mysqld_show_storage_engines(THD *thd)
{
List<Item> field_list;
Protocol *protocol= thd->protocol;
DBUG_ENTER("mysqld_show_table_types");
DBUG_ENTER("mysqld_show_storage_engines");
field_list.push_back(new Item_empty_string("Type",10));
field_list.push_back(new Item_empty_string("Support",10));
......@@ -187,7 +187,7 @@ int mysqld_show_table_types(THD *thd)
DBUG_RETURN(1);
const char *default_type_name=
ha_get_table_type((enum db_type)thd->variables.table_type);
ha_get_storage_engine((enum db_type)thd->variables.table_type);
show_table_type_st *types;
for (types= sys_table_types; types->type; types++)
......
......@@ -404,7 +404,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_USING_OTHER_HANDLER,
ER(ER_WARN_USING_OTHER_HANDLER),
ha_get_table_type(new_db_type),
ha_get_storage_engine(new_db_type),
table_name);
}
db_options=create_info->table_options;
......@@ -2016,7 +2016,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_USING_OTHER_HANDLER,
ER(ER_WARN_USING_OTHER_HANDLER),
ha_get_table_type(new_db_type),
ha_get_storage_engine(new_db_type),
new_name);
}
if (create_info->row_type == ROW_TYPE_NOT_USED)
......
......@@ -361,6 +361,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token SSL_SYM
%token STARTING
%token STATUS_SYM
%token STORAGE_SYM
%token STRAIGHT_JOIN
%token SUBJECT_SYM
%token TABLES
......@@ -473,6 +474,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token ELT_FUNC
%token ENCODE_SYM
%token ENGINE_SYM
%token ENGINES_SYM
%token ENCRYPT
%token EXPORT_SET
%token EXTRACT_SYM
......@@ -654,7 +656,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%type <date_time_type> date_time_type;
%type <interval> interval
%type <db_type> table_types
%type <db_type> storage_engines
%type <row_type> row_types
......@@ -1074,8 +1076,8 @@ create_table_options:
| create_table_option ',' create_table_options;
create_table_option:
ENGINE_SYM opt_equal table_types { Lex->create_info.db_type= $3; }
| TYPE_SYM opt_equal table_types { Lex->create_info.db_type= $3; WARN_DEPRECATED("TYPE=database_engine","ENGINE=database_engine"); }
ENGINE_SYM opt_equal storage_engines { Lex->create_info.db_type= $3; }
| TYPE_SYM opt_equal storage_engines { Lex->create_info.db_type= $3; WARN_DEPRECATED("TYPE=database_engine","ENGINE=database_engine"); }
| MAX_ROWS opt_equal ulonglong_num { Lex->create_info.max_rows= $3; Lex->create_info.used_fields|= HA_CREATE_USED_MAX_ROWS;}
| MIN_ROWS opt_equal ulonglong_num { Lex->create_info.min_rows= $3; Lex->create_info.used_fields|= HA_CREATE_USED_MIN_ROWS;}
| AVG_ROW_LENGTH opt_equal ULONG_NUM { Lex->create_info.avg_row_length=$3; Lex->create_info.used_fields|= HA_CREATE_USED_AVG_ROW_LENGTH;}
......@@ -1128,12 +1130,12 @@ create_table_option:
{ Lex->create_info.data_file_name= $4.str; }
| INDEX DIRECTORY_SYM opt_equal TEXT_STRING_sys { Lex->create_info.index_file_name= $4.str; };
table_types:
storage_engines:
ident_or_text
{
$$ = ha_resolve_by_name($1.str,$1.length);
if ($$ == DB_TYPE_UNKNOWN) {
net_printf(YYTHD, ER_UNKNOWN_TABLE_ENGINE, $1.str);
net_printf(YYTHD, ER_UNKNOWN_STORAGE_ENGINE, $1.str);
YYABORT;
}
};
......@@ -3971,7 +3973,7 @@ show_param:
lex->select_lex.db= $3;
lex->select_lex.options= 0;
}
| ENGINE_SYM table_types
| ENGINE_SYM storage_engines
{ Lex->create_info.db_type= $2; }
show_engine_param
| opt_full COLUMNS from_or_in table_ident opt_db wild
......@@ -4021,7 +4023,13 @@ show_param:
| TABLE_SYM TYPES_SYM
{
LEX *lex=Lex;
lex->sql_command= SQLCOM_SHOW_TABLE_TYPES;
lex->sql_command= SQLCOM_SHOW_STORAGE_ENGINES;
WARN_DEPRECATED("SHOW TABLE TYPES", "SHOW [STORAGE] ENGINES");
}
| opt_storage ENGINES_SYM
{
LEX *lex=Lex;
lex->sql_command= SQLCOM_SHOW_STORAGE_ENGINES;
}
| PRIVILEGES
{
......@@ -4112,6 +4120,10 @@ master_or_binary:
MASTER_SYM
| BINARY;
opt_storage:
/* empty */
| STORAGE_SYM;
opt_db:
/* empty */ { $$= 0; }
| from_or_in ident { $$= $2.str; };
......@@ -4664,6 +4676,7 @@ keyword:
| END {}
| ENUM {}
| ENGINE_SYM {}
| ENGINES_SYM {}
| ERRORS {}
| ESCAPE_SYM {}
| EVENTS_SYM {}
......@@ -4790,6 +4803,7 @@ keyword:
| START_SYM {}
| STATUS_SYM {}
| STOP_SYM {}
| STORAGE_SYM {}
| STRING_SYM {}
| SUBDATE_SYM {}
| SUBJECT_SYM {}
......@@ -4802,6 +4816,7 @@ keyword:
| TIMESTAMP {}
| TIME_SYM {}
| TYPE_SYM {}
| TYPES_SYM {}
| UDF_SYM {}
| UNCOMMITTED_SYM {}
| UNICODE_SYM {}
......
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