Commit 1dcd1bbe authored by unknown's avatar unknown

Merge


client/mysqltest.c:
  Auto merged
include/mysqld_error.h:
  Auto merged
libmysql/libmysql.c:
  Auto merged
libmysqld/lib_sql.cc:
  Auto merged
mysql-test/r/variables.result:
  Auto merged
mysql-test/t/variables.test:
  Auto merged
sql/handler.cc:
  Auto merged
sql/handler.h:
  Auto merged
sql/lex.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/net_serv.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/udf_example.cc:
  Auto merged
include/sql_state.h:
  SCCS merged
sql/sql_yacc.yy:
  SCCS merged
parents aeea2ec4 30b4b5d1
...@@ -2153,7 +2153,7 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags) ...@@ -2153,7 +2153,7 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
DYNAMIC_STRING *ds; DYNAMIC_STRING *ds;
DYNAMIC_STRING ds_tmp; DYNAMIC_STRING ds_tmp;
DYNAMIC_STRING eval_query; DYNAMIC_STRING eval_query;
char* query, buff[MAX_DELIMITER + 1]= {0}; char* query;
int query_len; int query_len;
DBUG_ENTER("run_query"); DBUG_ENTER("run_query");
...@@ -2188,8 +2188,8 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags) ...@@ -2188,8 +2188,8 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
if ((flags & QUERY_SEND) && !disable_query_log && !counter) if ((flags & QUERY_SEND) && !disable_query_log && !counter)
{ {
replace_dynstr_append_mem(ds,query, query_len); replace_dynstr_append_mem(ds,query, query_len);
sprintf(buff, "%s\n", delimiter); dynstr_append_mem(ds, delimiter, delimiter_length);
dynstr_append_mem(ds, buff, delimiter_length + 1); dynstr_append_mem(ds, "\n", 1);
} }
if (!(flags & QUERY_REAP)) if (!(flags & QUERY_REAP))
DBUG_RETURN(0); DBUG_RETURN(0);
......
...@@ -86,5 +86,4 @@ extern const char *client_errors[]; /* Error messages */ ...@@ -86,5 +86,4 @@ extern const char *client_errors[]; /* Error messages */
#define CR_SHARED_MEMORY_CONNECT_SET_ERROR 2045 #define CR_SHARED_MEMORY_CONNECT_SET_ERROR 2045
#define CR_CONN_UNKNOW_PROTOCOL 2046 #define CR_CONN_UNKNOW_PROTOCOL 2046
#define CR_INVALID_CONN_HANDLE 2047 #define CR_INVALID_CONN_HANDLE 2047
#define CR_MYSQL_SERVER_INIT_MISSED 2048 #define CR_SECURE_AUTH 2048
#define CR_SECURE_AUTH 2049
...@@ -638,9 +638,6 @@ int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB); ...@@ -638,9 +638,6 @@ int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
(*(mysql)->methods->advanced_command)(mysql, command, \ (*(mysql)->methods->advanced_command)(mysql, command, \
NullS, 0, arg, length, skip_check) NullS, 0, arg, length, skip_check)
unsigned long net_safe_read(MYSQL* mysql); unsigned long net_safe_read(MYSQL* mysql);
void mysql_once_init(void);
extern my_bool server_inited;
#ifdef __NETWARE__ #ifdef __NETWARE__
#pragma pack(pop) /* restore alignment */ #pragma pack(pop) /* restore alignment */
......
...@@ -301,7 +301,7 @@ ...@@ -301,7 +301,7 @@
#define ER_BAD_FT_COLUMN 1282 #define ER_BAD_FT_COLUMN 1282
#define ER_UNKNOWN_KEY_CACHE 1283 #define ER_UNKNOWN_KEY_CACHE 1283
#define ER_WARN_HOSTNAME_WONT_WORK 1284 #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_WARN_DEPRECATED_SYNTAX 1286
#define ER_SP_NO_RECURSIVE_CREATE 1287 #define ER_SP_NO_RECURSIVE_CREATE 1287
#define ER_SP_ALREADY_EXISTS 1288 #define ER_SP_ALREADY_EXISTS 1288
......
...@@ -161,7 +161,7 @@ ER_WARN_DATA_OUT_OF_RANGE, "01000", "", ...@@ -161,7 +161,7 @@ ER_WARN_DATA_OUT_OF_RANGE, "01000", "",
ER_WARN_DATA_TRUNCATED, "01000", "", ER_WARN_DATA_TRUNCATED, "01000", "",
ER_WRONG_NAME_FOR_INDEX, "42000", "", ER_WRONG_NAME_FOR_INDEX, "42000", "",
ER_WRONG_NAME_FOR_CATALOG, "42000", "", ER_WRONG_NAME_FOR_CATALOG, "42000", "",
ER_UNKNOWN_TABLE_ENGINE, "42000", "", ER_UNKNOWN_STORAGE_ENGINE, "42000", "",
/* 5.0 */ /* 5.0 */
ER_SP_NO_RECURSIVE_CREATE, "2F003", "", ER_SP_NO_RECURSIVE_CREATE, "2F003", "",
ER_SP_ALREADY_EXISTS, "42000", "", ER_SP_ALREADY_EXISTS, "42000", "",
......
...@@ -58,3 +58,14 @@ int cli_stmt_execute(MYSQL_STMT *stmt); ...@@ -58,3 +58,14 @@ int cli_stmt_execute(MYSQL_STMT *stmt);
MYSQL_DATA * cli_read_binary_rows(MYSQL_STMT *stmt); MYSQL_DATA * cli_read_binary_rows(MYSQL_STMT *stmt);
int cli_unbuffered_fetch(MYSQL *mysql, char **row); int cli_unbuffered_fetch(MYSQL *mysql, char **row);
const char * cli_read_statistic(MYSQL *mysql); const char * cli_read_statistic(MYSQL *mysql);
#ifdef EMBEDDED_LIBRARY
int init_embedded_server(int argc, char **argv, char **groups);
void end_embedded_server();
#else
/* Prevent warnings of unused parameters */
#define init_embedded_server(a,b,c) ((void)a, (void)b, (void)c, 0)
#define end_embedded_server()
#endif /*EMBEDDED_LIBRARY*/
...@@ -72,7 +72,6 @@ const char *client_errors[]= ...@@ -72,7 +72,6 @@ const char *client_errors[]=
"Can't open shared memory. Can't send the request event to server (%lu)", "Can't open shared memory. Can't send the request event to server (%lu)",
"Wrong or unknown protocol", "Wrong or unknown protocol",
"Invalid connection handle", "Invalid connection handle",
"mysql_server_init wasn't called",
"Connection using old (pre 4.1.1) authentication protocol refused (client option 'secure_auth' enabled)" "Connection using old (pre 4.1.1) authentication protocol refused (client option 'secure_auth' enabled)"
}; };
...@@ -129,7 +128,6 @@ const char *client_errors[]= ...@@ -129,7 +128,6 @@ const char *client_errors[]=
"Can't open shared memory. Can't send the request event to server (%lu)", "Can't open shared memory. Can't send the request event to server (%lu)",
"Wrong or unknown protocol", "Wrong or unknown protocol",
"Invalid connection handle", "Invalid connection handle",
"mysql_server_init wasn't called",
"Connection using old (pre 4.1.1) authentication protocol refused (client option 'secure_auth' enabled)" "Connection using old (pre 4.1.1) authentication protocol refused (client option 'secure_auth' enabled)"
}; };
...@@ -184,7 +182,6 @@ const char *client_errors[]= ...@@ -184,7 +182,6 @@ const char *client_errors[]=
"Can't open shared memory. Can't send the request event to server (%lu)", "Can't open shared memory. Can't send the request event to server (%lu)",
"Wrong or unknown protocol", "Wrong or unknown protocol",
"Invalid connection handle", "Invalid connection handle",
"mysql_server_init wasn't called",
"Connection using old (pre 4.1.1) authentication protocol refused (client option 'secure_auth' enabled)" "Connection using old (pre 4.1.1) authentication protocol refused (client option 'secure_auth' enabled)"
}; };
#endif #endif
......
...@@ -94,8 +94,9 @@ my_bool stmt_close(MYSQL_STMT *stmt, my_bool skip_list); ...@@ -94,8 +94,9 @@ my_bool stmt_close(MYSQL_STMT *stmt, my_bool skip_list);
static my_bool mysql_client_init= 0; static my_bool mysql_client_init= 0;
static my_bool org_my_init_done= 0; static my_bool org_my_init_done= 0;
void mysql_once_init(void) int STDCALL mysql_server_init(int argc, char **argv, char **groups)
{ {
int result= 0;
if (!mysql_client_init) if (!mysql_client_init)
{ {
mysql_client_init=1; mysql_client_init=1;
...@@ -131,24 +132,18 @@ void mysql_once_init(void) ...@@ -131,24 +132,18 @@ void mysql_once_init(void)
#if defined(SIGPIPE) && !defined(__WIN__) #if defined(SIGPIPE) && !defined(__WIN__)
(void) signal(SIGPIPE, SIG_IGN); (void) signal(SIGPIPE, SIG_IGN);
#endif #endif
result= init_embedded_server(argc, argv, groups);
} }
#ifdef THREAD #ifdef THREAD
else else
my_thread_init(); /* Init if new thread */ result= (int)my_thread_init(); /* Init if new thread */
#endif #endif
} return result;
#ifndef EMBEDDED_LIBRARY
int STDCALL mysql_server_init(int argc __attribute__((unused)),
char **argv __attribute__((unused)),
char **groups __attribute__((unused)))
{
mysql_once_init();
return 0;
} }
void STDCALL mysql_server_end() void STDCALL mysql_server_end()
{ {
end_embedded_server();
/* If library called my_init(), free memory allocated by it */ /* If library called my_init(), free memory allocated by it */
if (!org_my_init_done) if (!org_my_init_done)
{ {
...@@ -163,8 +158,6 @@ void STDCALL mysql_server_end() ...@@ -163,8 +158,6 @@ void STDCALL mysql_server_end()
mysql_client_init= org_my_init_done= 0; mysql_client_init= org_my_init_done= 0;
} }
#endif /*EMBEDDED_LIBRARY*/
my_bool STDCALL mysql_thread_init() my_bool STDCALL mysql_thread_init()
{ {
#ifdef THREAD #ifdef THREAD
......
...@@ -28,5 +28,4 @@ extern void init_embedded_mysql(MYSQL *mysql, int client_flag, char *db); ...@@ -28,5 +28,4 @@ extern void init_embedded_mysql(MYSQL *mysql, int client_flag, char *db);
extern void *create_embedded_thd(int client_flag, char *db); extern void *create_embedded_thd(int client_flag, char *db);
extern MYSQL_METHODS embedded_methods; extern MYSQL_METHODS embedded_methods;
void free_old_query(MYSQL *mysql); void free_old_query(MYSQL *mysql);
extern my_bool server_inited;
C_MODE_END C_MODE_END
...@@ -42,9 +42,6 @@ C_MODE_START ...@@ -42,9 +42,6 @@ C_MODE_START
#include "errmsg.h" #include "errmsg.h"
#include <sql_common.h> #include <sql_common.h>
static my_bool org_my_init_done;
my_bool server_inited;
static my_bool static my_bool
emb_advanced_command(MYSQL *mysql, enum enum_server_command command, emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
const char *header, ulong header_length, const char *header, ulong header_length,
...@@ -305,7 +302,7 @@ extern "C" ...@@ -305,7 +302,7 @@ extern "C"
char ** copy_arguments_ptr= 0; char ** copy_arguments_ptr= 0;
int STDCALL mysql_server_init(int argc, char **argv, char **groups) int init_embedded_server(int argc, char **argv, char **groups)
{ {
char glob_hostname[FN_REFLEN]; char glob_hostname[FN_REFLEN];
...@@ -329,17 +326,7 @@ int STDCALL mysql_server_init(int argc, char **argv, char **groups) ...@@ -329,17 +326,7 @@ int STDCALL mysql_server_init(int argc, char **argv, char **groups)
if (!groups) if (!groups)
groups= (char**) fake_groups; groups= (char**) fake_groups;
my_progname= (char *)"mysql_embedded";
/* Only call MY_INIT() if it hasn't been called before */
if (!server_inited)
{
server_inited=1;
org_my_init_done=my_init_done;
}
if (!org_my_init_done)
{
MY_INIT((char *)"mysql_embedded"); // init my_sys library & pthreads
}
if (init_common_variables("my", *argcp, *argvp, (const char **)groups)) if (init_common_variables("my", *argcp, *argvp, (const char **)groups))
{ {
...@@ -438,14 +425,11 @@ int STDCALL mysql_server_init(int argc, char **argv, char **groups) ...@@ -438,14 +425,11 @@ int STDCALL mysql_server_init(int argc, char **argv, char **groups)
return 0; return 0;
} }
void STDCALL mysql_server_end() void end_embedded_server()
{ {
my_free((char*) copy_arguments_ptr, MYF(MY_ALLOW_ZERO_PTR)); my_free((char*) copy_arguments_ptr, MYF(MY_ALLOW_ZERO_PTR));
copy_arguments_ptr=0; copy_arguments_ptr=0;
clean_up(0); clean_up(0);
/* If library called my_init(), free memory allocated by it */
if (!org_my_init_done)
my_end(0);
} }
} /* extern "C" */ } /* extern "C" */
......
...@@ -163,20 +163,12 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, ...@@ -163,20 +163,12 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
db ? db : "(Null)", db ? db : "(Null)",
user ? user : "(Null)")); user ? user : "(Null)"));
#if defined(EMBEDDED_LIBRARY) || !defined(DBUG_OFF)
if (!server_inited)
{
mysql->net.last_errno=CR_MYSQL_SERVER_INIT_MISSED;
strmov(mysql->net.last_error,ER(mysql->net.last_errno));
goto error;
}
#endif
if (mysql->options.methods_to_use == MYSQL_OPT_USE_REMOTE_CONNECTION || if (mysql->options.methods_to_use == MYSQL_OPT_USE_REMOTE_CONNECTION ||
(mysql->options.methods_to_use == MYSQL_OPT_GUESS_CONNECTION && (mysql->options.methods_to_use == MYSQL_OPT_GUESS_CONNECTION &&
host && strcmp(host,LOCAL_HOST))) host && strcmp(host,LOCAL_HOST)))
cli_mysql_real_connect(mysql, host, user, DBUG_RETURN(cli_mysql_real_connect(mysql, host, user,
passwd, db, port, unix_socket, client_flag); passwd, db, port,
unix_socket, client_flag));
mysql->methods= &embedded_methods; mysql->methods= &embedded_methods;
......
...@@ -189,9 +189,9 @@ select * from t1; ...@@ -189,9 +189,9 @@ select * from t1;
if('2002'='2002','Y','N') if('2002'='2002','Y','N')
Y Y
drop table if exists t1; drop table if exists t1;
SET SESSION table_type="heap"; SET SESSION storage_engine="heap";
SELECT @@table_type; SELECT @@storage_engine;
@@table_type @@storage_engine
HEAP HEAP
CREATE TABLE t1 (a int not null); CREATE TABLE t1 (a int not null);
show create table t1; show create table t1;
...@@ -200,10 +200,10 @@ t1 CREATE TABLE `t1` ( ...@@ -200,10 +200,10 @@ t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0' `a` int(11) NOT NULL default '0'
) ENGINE=HEAP DEFAULT CHARSET=latin1 ) ENGINE=HEAP DEFAULT CHARSET=latin1
drop table t1; drop table t1;
SET SESSION table_type="gemini"; SET SESSION storage_engine="gemini";
ERROR 42000: Unknown table engine 'gemini' ERROR 42000: Unknown table engine 'gemini'
SELECT @@table_type; SELECT @@storage_engine;
@@table_type @@storage_engine
HEAP HEAP
CREATE TABLE t1 (a int not null); CREATE TABLE t1 (a int not null);
show create table t1; show create table t1;
...@@ -211,7 +211,7 @@ Table Create Table ...@@ -211,7 +211,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0' `a` int(11) NOT NULL default '0'
) ENGINE=HEAP DEFAULT CHARSET=latin1 ) ENGINE=HEAP DEFAULT CHARSET=latin1
SET SESSION table_type=default; SET SESSION storage_engine=default;
drop table t1; drop table t1;
create table t1 ( k1 varchar(2), k2 int, primary key(k1,k2)); create table t1 ( k1 varchar(2), k2 int, primary key(k1,k2));
insert into t1 values ("a", 1), ("b", 2); insert into t1 values ("a", 1), ("b", 2);
...@@ -334,9 +334,9 @@ ERROR 42000: Incorrect table name 'a/a' ...@@ -334,9 +334,9 @@ ERROR 42000: Incorrect table name 'a/a'
drop table t1, t2, t3; drop table t1, t2, t3;
drop table t3; drop table t3;
drop database test_$1; drop database test_$1;
SET SESSION table_type="heap"; SET SESSION storage_engine="heap";
SELECT @@table_type; SELECT @@storage_engine;
@@table_type @@storage_engine
HEAP HEAP
CREATE TABLE t1 (a int not null); CREATE TABLE t1 (a int not null);
show create table t1; show create table t1;
...@@ -345,10 +345,10 @@ t1 CREATE TABLE `t1` ( ...@@ -345,10 +345,10 @@ t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0' `a` int(11) NOT NULL default '0'
) ENGINE=HEAP DEFAULT CHARSET=latin1 ) ENGINE=HEAP DEFAULT CHARSET=latin1
drop table t1; drop table t1;
SET SESSION table_type="gemini"; SET SESSION storage_engine="gemini";
ERROR 42000: Unknown table engine 'gemini' ERROR 42000: Unknown table engine 'gemini'
SELECT @@table_type; SELECT @@storage_engine;
@@table_type @@storage_engine
HEAP HEAP
CREATE TABLE t1 (a int not null); CREATE TABLE t1 (a int not null);
show create table t1; show create table t1;
...@@ -356,7 +356,7 @@ Table Create Table ...@@ -356,7 +356,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0' `a` int(11) NOT NULL default '0'
) ENGINE=HEAP DEFAULT CHARSET=latin1 ) ENGINE=HEAP DEFAULT CHARSET=latin1
SET SESSION table_type=default; SET SESSION storage_engine=default;
drop table t1; drop table t1;
create table t1(a int,b int,c int unsigned,d date,e char,f datetime,g time,h blob); 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); insert into t1(a)values(1);
......
...@@ -40,8 +40,8 @@ SELECT @@medium.key_buffer_size; ...@@ -40,8 +40,8 @@ SELECT @@medium.key_buffer_size;
SET @@global.key_buffer_size=@save_key_buffer; SET @@global.key_buffer_size=@save_key_buffer;
SELECT @@default.key_buffer_size; 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 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"; SELECT @@skr.storage_engine="test";
ERROR HY000: Variable 'table_type' is not a variable component (Can't be used as XXXX.variable_name) ERROR HY000: Variable 'storage_engine' is not a variable component (Can't be used as XXXX.variable_name)
select @@keycache1.key_cache_block_size; select @@keycache1.key_cache_block_size;
@@keycache1.key_cache_block_size @@keycache1.key_cache_block_size
0 0
......
...@@ -137,13 +137,13 @@ set global concurrent_insert=DEFAULT; ...@@ -137,13 +137,13 @@ set global concurrent_insert=DEFAULT;
show variables like 'concurrent_insert'; show variables like 'concurrent_insert';
Variable_name Value Variable_name Value
concurrent_insert ON concurrent_insert ON
set table_type=MYISAM, table_type="HEAP", global table_type="INNODB"; set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="INNODB";
show local variables like 'table_type'; show local variables like 'storage_engine';
Variable_name Value Variable_name Value
table_type HEAP storage_engine HEAP
show global variables like 'table_type'; show global variables like 'storage_engine';
Variable_name Value Variable_name Value
table_type InnoDB storage_engine InnoDB
set GLOBAL query_cache_size=100000; set GLOBAL query_cache_size=100000;
set GLOBAL myisam_max_sort_file_size=2000000; set GLOBAL myisam_max_sort_file_size=2000000;
show global variables like 'myisam_max_sort_file_size'; show global variables like 'myisam_max_sort_file_size';
...@@ -240,17 +240,17 @@ set unknown_variable=1; ...@@ -240,17 +240,17 @@ set unknown_variable=1;
ERROR HY000: Unknown system variable 'unknown_variable' ERROR HY000: Unknown system variable 'unknown_variable'
set max_join_size="hello"; set max_join_size="hello";
ERROR 42000: Wrong argument type to variable 'max_join_size' 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' 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' 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 Variable_name Value
table_type HEAP storage_engine HEAP
set SESSION query_cache_size=10000; set SESSION query_cache_size=10000;
ERROR HY000: Variable 'query_cache_size' is a GLOBAL variable and should be set with SET GLOBAL ERROR HY000: Variable 'query_cache_size' is a GLOBAL variable and should be set with SET GLOBAL
set GLOBAL table_type=DEFAULT; set GLOBAL storage_engine=DEFAULT;
ERROR 42000: Variable 'table_type' doesn't have a default value ERROR 42000: Variable 'storage_engine' doesn't have a default value
set character_set_client=UNKNOWN_CHARACTER_SET; set character_set_client=UNKNOWN_CHARACTER_SET;
ERROR 42000: Unknown character set: 'UNKNOWN_CHARACTER_SET' ERROR 42000: Unknown character set: 'UNKNOWN_CHARACTER_SET'
set collation_connection=UNKNOWN_COLLATION; set collation_connection=UNKNOWN_COLLATION;
...@@ -372,7 +372,7 @@ set sql_select_limit=1; ...@@ -372,7 +372,7 @@ set sql_select_limit=1;
set global sql_slave_skip_counter=100; set global sql_slave_skip_counter=100;
set sql_warnings=1; set sql_warnings=1;
set global table_cache=100; set global table_cache=100;
set table_type=myisam; set storage_engine=myisam;
set global thread_cache_size=100; set global thread_cache_size=100;
set timestamp=1, timestamp=default; set timestamp=1, timestamp=default;
set tmp_table_size=100; set tmp_table_size=100;
......
...@@ -133,3 +133,6 @@ alter table t1 type=myisam; ...@@ -133,3 +133,6 @@ alter table t1 type=myisam;
Warnings: Warnings:
Warning 1286 'TYPE=database_engine' is deprecated. Use 'ENGINE=database_engine' instead. Warning 1286 'TYPE=database_engine' is deprecated. Use 'ENGINE=database_engine' instead.
drop table t1; 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; ...@@ -152,17 +152,17 @@ drop table if exists t1;
# #
# Test default table type # Test default table type
# #
SET SESSION table_type="heap"; SET SESSION storage_engine="heap";
SELECT @@table_type; SELECT @@storage_engine;
CREATE TABLE t1 (a int not null); CREATE TABLE t1 (a int not null);
show create table t1; show create table t1;
drop table t1; drop table t1;
--error 1285 --error 1285
SET SESSION table_type="gemini"; SET SESSION storage_engine="gemini";
SELECT @@table_type; SELECT @@storage_engine;
CREATE TABLE t1 (a int not null); CREATE TABLE t1 (a int not null);
show create table t1; show create table t1;
SET SESSION table_type=default; SET SESSION storage_engine=default;
drop table t1; drop table t1;
...@@ -272,17 +272,17 @@ drop database test_$1; ...@@ -272,17 +272,17 @@ drop database test_$1;
# #
# Test default table type # Test default table type
# #
SET SESSION table_type="heap"; SET SESSION storage_engine="heap";
SELECT @@table_type; SELECT @@storage_engine;
CREATE TABLE t1 (a int not null); CREATE TABLE t1 (a int not null);
show create table t1; show create table t1;
drop table t1; drop table t1;
--error 1285 --error 1285
SET SESSION table_type="gemini"; SET SESSION storage_engine="gemini";
SELECT @@table_type; SELECT @@storage_engine;
CREATE TABLE t1 (a int not null); CREATE TABLE t1 (a int not null);
show create table t1; show create table t1;
SET SESSION table_type=default; SET SESSION storage_engine=default;
drop table t1; drop table t1;
# #
......
...@@ -42,7 +42,7 @@ SET @@global.key_buffer_size=@save_key_buffer; ...@@ -42,7 +42,7 @@ SET @@global.key_buffer_size=@save_key_buffer;
--error 1064 --error 1064
SELECT @@default.key_buffer_size; SELECT @@default.key_buffer_size;
--error 1271 --error 1271
SELECT @@skr.table_type="test"; SELECT @@skr.storage_engine="test";
select @@keycache1.key_cache_block_size; select @@keycache1.key_cache_block_size;
select @@keycache1.key_buffer_size; select @@keycache1.key_buffer_size;
......
...@@ -82,9 +82,9 @@ show variables like 'concurrent_insert'; ...@@ -82,9 +82,9 @@ show variables like 'concurrent_insert';
set global concurrent_insert=DEFAULT; set global concurrent_insert=DEFAULT;
show variables like 'concurrent_insert'; show variables like 'concurrent_insert';
set table_type=MYISAM, table_type="HEAP", global table_type="INNODB"; set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="INNODB";
show local variables like 'table_type'; show local variables like 'storage_engine';
show global variables like 'table_type'; show global variables like 'storage_engine';
set GLOBAL query_cache_size=100000; set GLOBAL query_cache_size=100000;
set GLOBAL myisam_max_sort_file_size=2000000; set GLOBAL myisam_max_sort_file_size=2000000;
...@@ -137,14 +137,14 @@ set unknown_variable=1; ...@@ -137,14 +137,14 @@ set unknown_variable=1;
--error 1232 --error 1232
set max_join_size="hello"; set max_join_size="hello";
--error 1285 --error 1285
set table_type=UNKNOWN_TABLE_TYPE; set storage_engine=UNKNOWN_TABLE_TYPE;
--error 1231 --error 1231
set table_type=INNODB, big_tables=2; set storage_engine=INNODB, big_tables=2;
show local variables like 'table_type'; show local variables like 'storage_engine';
--error 1229 --error 1229
set SESSION query_cache_size=10000; set SESSION query_cache_size=10000;
--error 1230 --error 1230
set GLOBAL table_type=DEFAULT; set GLOBAL storage_engine=DEFAULT;
--error 1115 --error 1115
set character_set_client=UNKNOWN_CHARACTER_SET; set character_set_client=UNKNOWN_CHARACTER_SET;
--error 1272 --error 1272
...@@ -247,7 +247,7 @@ set sql_select_limit=1; ...@@ -247,7 +247,7 @@ set sql_select_limit=1;
set global sql_slave_skip_counter=100; set global sql_slave_skip_counter=100;
set sql_warnings=1; set sql_warnings=1;
set global table_cache=100; set global table_cache=100;
set table_type=myisam; set storage_engine=myisam;
set global thread_cache_size=100; set global thread_cache_size=100;
set timestamp=1, timestamp=default; set timestamp=1, timestamp=default;
set tmp_table_size=100; set tmp_table_size=100;
......
...@@ -91,3 +91,8 @@ create table t1 (id int) type=heap; ...@@ -91,3 +91,8 @@ create table t1 (id int) type=heap;
alter table t1 type=myisam; alter table t1 type=myisam;
drop table t1; drop table t1;
#
# Test for deprecated table_type variable
#
set table_type=MYISAM;
...@@ -1310,7 +1310,8 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths) ...@@ -1310,7 +1310,8 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths)
MYSQL * STDCALL MYSQL * STDCALL
mysql_init(MYSQL *mysql) mysql_init(MYSQL *mysql)
{ {
mysql_once_init(); if (mysql_server_init(0, NULL, NULL))
return 0;
if (!mysql) if (!mysql)
{ {
if (!(mysql=(MYSQL*) my_malloc(sizeof(*mysql),MYF(MY_WME | MY_ZEROFILL)))) if (!(mysql=(MYSQL*) my_malloc(sizeof(*mysql),MYF(MY_WME | MY_ZEROFILL))))
......
...@@ -32,3 +32,5 @@ ...@@ -32,3 +32,5 @@
#undef HAVE_SMEM #undef HAVE_SMEM
#undef _CUSTOMCONFIG_ #undef _CUSTOMCONFIG_
#define mysql_server_init(a,b,c) 0
...@@ -104,7 +104,7 @@ enum db_type ha_resolve_by_name(const char *name, uint namelen) ...@@ -104,7 +104,7 @@ enum db_type ha_resolve_by_name(const char *name, uint namelen)
return DB_TYPE_UNKNOWN; 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; show_table_type_st *types;
for (types= sys_table_types; types->type; types++) for (types= sys_table_types; types->type; types++)
......
...@@ -392,7 +392,7 @@ extern TYPELIB tx_isolation_typelib; ...@@ -392,7 +392,7 @@ extern TYPELIB tx_isolation_typelib;
#define ha_supports_generate(T) (T != DB_TYPE_INNODB) #define ha_supports_generate(T) (T != DB_TYPE_INNODB)
enum db_type ha_resolve_by_name(const char *name, uint namelen); 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); handler *get_new_handler(TABLE *table, enum db_type db_type);
my_off_t ha_get_ptr(byte *ptr, uint pack_length); my_off_t ha_get_ptr(byte *ptr, uint pack_length);
void ha_store_ptr(byte *buff, uint pack_length, my_off_t pos); void ha_store_ptr(byte *buff, uint pack_length, my_off_t pos);
......
...@@ -156,6 +156,7 @@ static SYMBOL symbols[] = { ...@@ -156,6 +156,7 @@ static SYMBOL symbols[] = {
{ "ENCLOSED", SYM(ENCLOSED),0,0}, { "ENCLOSED", SYM(ENCLOSED),0,0},
{ "END", SYM(END),0,0}, { "END", SYM(END),0,0},
{ "ENGINE", SYM(ENGINE_SYM),0,0}, { "ENGINE", SYM(ENGINE_SYM),0,0},
{ "ENGINES", SYM(ENGINES_SYM),0,0},
{ "ENUM", SYM(ENUM),0,0}, { "ENUM", SYM(ENUM),0,0},
{ "ERRORS", SYM(ERRORS),0,0}, { "ERRORS", SYM(ERRORS),0,0},
{ "ESCAPE", SYM(ESCAPE_SYM),0,0}, { "ESCAPE", SYM(ESCAPE_SYM),0,0},
...@@ -421,6 +422,7 @@ static SYMBOL symbols[] = { ...@@ -421,6 +422,7 @@ static SYMBOL symbols[] = {
{ "STARTING", SYM(STARTING),0,0}, { "STARTING", SYM(STARTING),0,0},
{ "STATUS", SYM(STATUS_SYM),0,0}, { "STATUS", SYM(STATUS_SYM),0,0},
{ "STOP", SYM(STOP_SYM),0,0}, { "STOP", SYM(STOP_SYM),0,0},
{ "STORAGE", SYM(STORAGE_SYM),0,0},
{ "STRAIGHT_JOIN", SYM(STRAIGHT_JOIN),0,0}, { "STRAIGHT_JOIN", SYM(STRAIGHT_JOIN),0,0},
{ "STRING", SYM(STRING_SYM),0,0}, { "STRING", SYM(STRING_SYM),0,0},
{ "STRIPED", SYM(RAID_STRIPED_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, ...@@ -606,7 +606,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
pthread_mutex_t *mutex); pthread_mutex_t *mutex);
int mysqld_show_charsets(THD *thd,const char *wild); int mysqld_show_charsets(THD *thd,const char *wild);
int mysqld_show_collations(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_privileges(THD *thd);
int mysqld_show_column_types(THD *thd); int mysqld_show_column_types(THD *thd);
int mysqld_help (THD *thd, const char *text); int mysqld_help (THD *thd, const char *text);
......
...@@ -3600,7 +3600,7 @@ enum options_mysqld ...@@ -3600,7 +3600,7 @@ enum options_mysqld
OPT_SKIP_HOST_CACHE, OPT_SHORT_LOG_FORMAT, OPT_SKIP_HOST_CACHE, OPT_SHORT_LOG_FORMAT,
OPT_FLUSH, OPT_SAFE, OPT_FLUSH, OPT_SAFE,
OPT_BOOTSTRAP, OPT_SKIP_SHOW_DB, 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_ALL, OPT_SLOW_QUERY_LOG,
OPT_DELAY_KEY_WRITE, OPT_CHARSETS_DIR, OPT_DELAY_KEY_WRITE, OPT_CHARSETS_DIR,
OPT_BDB_HOME, OPT_BDB_LOG, OPT_BDB_HOME, OPT_BDB_LOG,
...@@ -3809,8 +3809,11 @@ Disable with --skip-bdb (will save memory).", ...@@ -3809,8 +3809,11 @@ Disable with --skip-bdb (will save memory).",
{"default-collation", OPT_DEFAULT_COLLATION, "Set the default collation.", {"default-collation", OPT_DEFAULT_COLLATION, "Set the default collation.",
(gptr*) &default_collation_name, (gptr*) &default_collation_name, (gptr*) &default_collation_name, (gptr*) &default_collation_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{"default-table-type", OPT_TABLE_TYPE, {"default-storage-engine", OPT_STORAGE_ENGINE,
"Set the default table type for tables.", 0, 0, "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}, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"delay-key-write", OPT_DELAY_KEY_WRITE, "Type of DELAY_KEY_WRITE.", {"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}, 0,0,0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
...@@ -4788,8 +4791,8 @@ struct show_var_st status_vars[]= { ...@@ -4788,8 +4791,8 @@ struct show_var_st status_vars[]= {
{"Com_show_slave_hosts", (char*) (com_stat+(uint) SQLCOM_SHOW_SLAVE_HOSTS),SHOW_LONG}, {"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_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_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_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_variables", (char*) (com_stat+(uint) SQLCOM_SHOW_VARIABLES),SHOW_LONG},
{"Com_show_warnings", (char*) (com_stat+(uint) SQLCOM_SHOW_WARNS),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}, {"Com_slave_start", (char*) (com_stat+(uint) SQLCOM_SLAVE_START),SHOW_LONG},
...@@ -5476,7 +5479,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -5476,7 +5479,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case OPT_BOOTSTRAP: case OPT_BOOTSTRAP:
opt_noacl=opt_bootstrap=1; opt_noacl=opt_bootstrap=1;
break; break;
case OPT_TABLE_TYPE: case OPT_STORAGE_ENGINE:
{ {
if ((enum db_type)((global_system_variables.table_type= if ((enum db_type)((global_system_variables.table_type=
ha_resolve_by_name(argument, strlen(argument)))) == DB_TYPE_UNKNOWN) ha_resolve_by_name(argument, strlen(argument)))) == DB_TYPE_UNKNOWN)
......
...@@ -54,6 +54,12 @@ ...@@ -54,6 +54,12 @@
#ifdef EMBEDDED_LIBRARY #ifdef EMBEDDED_LIBRARY
#undef MYSQL_SERVER
#ifndef MYSQL_CLIENT
#define MYSQL_CLIENT
#endif
#undef net_flush #undef net_flush
extern "C" { extern "C" {
......
...@@ -295,6 +295,8 @@ sys_var_thd_sql_mode sys_sql_mode("sql_mode", ...@@ -295,6 +295,8 @@ sys_var_thd_sql_mode sys_sql_mode("sql_mode",
&SV::sql_mode); &SV::sql_mode);
sys_var_thd_table_type sys_table_type("table_type", sys_var_thd_table_type sys_table_type("table_type",
&SV::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", sys_var_long_ptr sys_table_cache_size("table_cache",
&table_cache_size); &table_cache_size);
sys_var_long_ptr sys_thread_cache_size("thread_cache_size", sys_var_long_ptr sys_thread_cache_size("thread_cache_size",
...@@ -527,6 +529,7 @@ sys_var *sys_variables[]= ...@@ -527,6 +529,7 @@ sys_var *sys_variables[]=
&sys_sql_max_join_size, &sys_sql_max_join_size,
&sys_sql_mode, &sys_sql_mode,
&sys_sql_warnings, &sys_sql_warnings,
&sys_storage_engine,
&sys_table_cache_size, &sys_table_cache_size,
&sys_table_type, &sys_table_type,
&sys_thread_cache_size, &sys_thread_cache_size,
...@@ -732,6 +735,7 @@ struct show_var_st init_vars[]= { ...@@ -732,6 +735,7 @@ struct show_var_st init_vars[]= {
#endif #endif
{sys_sort_buffer.name, (char*) &sys_sort_buffer, SHOW_SYS}, {sys_sort_buffer.name, (char*) &sys_sort_buffer, SHOW_SYS},
{sys_sql_mode.name, (char*) &sys_sql_mode, 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}, {"table_cache", (char*) &table_cache_size, SHOW_LONG},
{sys_table_type.name, (char*) &sys_table_type, SHOW_SYS}, {sys_table_type.name, (char*) &sys_table_type, SHOW_SYS},
{sys_thread_cache_size.name,(char*) &sys_thread_cache_size, SHOW_SYS}, {sys_thread_cache_size.name,(char*) &sys_thread_cache_size, SHOW_SYS},
...@@ -2510,7 +2514,7 @@ int set_var_password::update(THD *thd) ...@@ -2510,7 +2514,7 @@ int set_var_password::update(THD *thd)
/* Based upon sys_var::check_enum() */ /* 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]; char buff[80];
const char *value; const char *value;
...@@ -2529,23 +2533,23 @@ bool sys_var_thd_table_type::check(THD *thd, set_var *var) ...@@ -2529,23 +2533,23 @@ bool sys_var_thd_table_type::check(THD *thd, set_var *var)
} }
err: err:
my_error(ER_UNKNOWN_TABLE_ENGINE, MYF(0), value); my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), value);
return 1; return 1;
} }
byte *sys_var_thd_table_type::value_ptr(THD *thd, enum_var_type type, byte *sys_var_thd_storage_engine::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base) LEX_STRING *base)
{ {
ulong val; ulong val;
val= ((type == OPT_GLOBAL) ? global_system_variables.*offset : val= ((type == OPT_GLOBAL) ? global_system_variables.*offset :
thd->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; 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) if (type == OPT_GLOBAL)
global_system_variables.*offset= (ulong) DB_TYPE_MYISAM; global_system_variables.*offset= (ulong) DB_TYPE_MYISAM;
...@@ -2554,7 +2558,7 @@ void sys_var_thd_table_type::set_default(THD *thd, enum_var_type type) ...@@ -2554,7 +2558,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) if (var->type == OPT_GLOBAL)
global_system_variables.*offset= var->save_result.ulong_value; global_system_variables.*offset= var->save_result.ulong_value;
...@@ -2563,6 +2567,25 @@ bool sys_var_thd_table_type::update(THD *thd, set_var *var) ...@@ -2563,6 +2567,25 @@ bool sys_var_thd_table_type::update(THD *thd, set_var *var)
return 0; 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 Functions to handle sql_mode
......
...@@ -344,12 +344,12 @@ class sys_var_thd_sql_mode :public sys_var_thd_enum ...@@ -344,12 +344,12 @@ class sys_var_thd_sql_mode :public sys_var_thd_enum
}; };
class sys_var_thd_table_type :public sys_var_thd class sys_var_thd_storage_engine :public sys_var_thd
{ {
protected: protected:
ulong SV::*offset; ulong SV::*offset;
public: 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) :sys_var_thd(name_arg), offset(offset_arg)
{} {}
bool check(THD *thd, set_var *var); bool check(THD *thd, set_var *var);
...@@ -363,6 +363,16 @@ SHOW_TYPE type() { return SHOW_CHAR; } ...@@ -363,6 +363,16 @@ SHOW_TYPE type() { return SHOW_CHAR; }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); 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 class sys_var_thd_bit :public sys_var_thd
{ {
......
...@@ -38,8 +38,3 @@ void my_net_local_init(NET *net) ...@@ -38,8 +38,3 @@ void my_net_local_init(NET *net)
} }
} }
extern "C" {
void mysql_once_init(void)
{
}
}
...@@ -76,7 +76,7 @@ enum enum_sql_command { ...@@ -76,7 +76,7 @@ enum enum_sql_command {
SQLCOM_SHOW_SLAVE_HOSTS, SQLCOM_DELETE_MULTI, SQLCOM_UPDATE_MULTI, SQLCOM_SHOW_SLAVE_HOSTS, SQLCOM_DELETE_MULTI, SQLCOM_UPDATE_MULTI,
SQLCOM_SHOW_BINLOG_EVENTS, SQLCOM_SHOW_NEW_MASTER, SQLCOM_DO, SQLCOM_SHOW_BINLOG_EVENTS, SQLCOM_SHOW_NEW_MASTER, SQLCOM_DO,
SQLCOM_SHOW_WARNS, SQLCOM_EMPTY_QUERY, SQLCOM_SHOW_ERRORS, 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, SQLCOM_HELP, SQLCOM_DROP_USER, SQLCOM_REVOKE_ALL, SQLCOM_CHECKSUM,
SQLCOM_CREATE_PROCEDURE, SQLCOM_CREATE_SPFUNCTION, SQLCOM_CALL, SQLCOM_CREATE_PROCEDURE, SQLCOM_CREATE_SPFUNCTION, SQLCOM_CALL,
SQLCOM_DROP_PROCEDURE, SQLCOM_ALTER_PROCEDURE,SQLCOM_ALTER_FUNCTION, SQLCOM_DROP_PROCEDURE, SQLCOM_ALTER_PROCEDURE,SQLCOM_ALTER_FUNCTION,
......
...@@ -2846,8 +2846,8 @@ mysql_execute_command(THD *thd) ...@@ -2846,8 +2846,8 @@ mysql_execute_command(THD *thd)
#endif #endif
,lex->verbose); ,lex->verbose);
break; break;
case SQLCOM_SHOW_TABLE_TYPES: case SQLCOM_SHOW_STORAGE_ENGINES:
res= mysqld_show_table_types(thd); res= mysqld_show_storage_engines(thd);
break; break;
case SQLCOM_SHOW_PRIVILEGES: case SQLCOM_SHOW_PRIVILEGES:
res= mysqld_show_privileges(thd); res= mysqld_show_privileges(thd);
......
...@@ -173,11 +173,11 @@ int mysqld_show_tables(THD *thd,const char *db,const char *wild) ...@@ -173,11 +173,11 @@ int mysqld_show_tables(THD *thd,const char *db,const char *wild)
** List all table types supported ** List all table types supported
***************************************************************************/ ***************************************************************************/
int mysqld_show_table_types(THD *thd) int mysqld_show_storage_engines(THD *thd)
{ {
List<Item> field_list; List<Item> field_list;
Protocol *protocol= thd->protocol; 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("Type",10));
field_list.push_back(new Item_empty_string("Support",10)); field_list.push_back(new Item_empty_string("Support",10));
...@@ -187,7 +187,7 @@ int mysqld_show_table_types(THD *thd) ...@@ -187,7 +187,7 @@ int mysqld_show_table_types(THD *thd)
DBUG_RETURN(1); DBUG_RETURN(1);
const char *default_type_name= 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; show_table_type_st *types;
for (types= sys_table_types; types->type; types++) for (types= sys_table_types; types->type; types++)
......
...@@ -400,7 +400,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, ...@@ -400,7 +400,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_USING_OTHER_HANDLER, ER_WARN_USING_OTHER_HANDLER,
ER(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); table_name);
} }
db_options=create_info->table_options; db_options=create_info->table_options;
...@@ -2007,7 +2007,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -2007,7 +2007,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_USING_OTHER_HANDLER, ER_WARN_USING_OTHER_HANDLER,
ER(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); new_name);
} }
if (create_info->row_type == ROW_TYPE_NOT_USED) if (create_info->row_type == ROW_TYPE_NOT_USED)
......
...@@ -390,6 +390,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -390,6 +390,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token SSL_SYM %token SSL_SYM
%token STARTING %token STARTING
%token STATUS_SYM %token STATUS_SYM
%token STORAGE_SYM
%token STRAIGHT_JOIN %token STRAIGHT_JOIN
%token SUBJECT_SYM %token SUBJECT_SYM
%token TABLES %token TABLES
...@@ -506,6 +507,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -506,6 +507,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token ELT_FUNC %token ELT_FUNC
%token ENCODE_SYM %token ENCODE_SYM
%token ENGINE_SYM %token ENGINE_SYM
%token ENGINES_SYM
%token ENCRYPT %token ENCRYPT
%token EXPORT_SET %token EXPORT_SET
%token EXTRACT_SYM %token EXTRACT_SYM
...@@ -706,7 +708,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -706,7 +708,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%type <interval_time_st> interval_time_st %type <interval_time_st> interval_time_st
%type <db_type> table_types %type <db_type> storage_engines
%type <row_type> row_types %type <row_type> row_types
...@@ -2103,8 +2105,8 @@ create_table_options: ...@@ -2103,8 +2105,8 @@ create_table_options:
| create_table_option ',' create_table_options; | create_table_option ',' create_table_options;
create_table_option: create_table_option:
ENGINE_SYM opt_equal table_types { Lex->create_info.db_type= $3; } ENGINE_SYM opt_equal storage_engines { 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"); } | 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;} | 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;} | 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;} | 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;}
...@@ -2157,12 +2159,12 @@ create_table_option: ...@@ -2157,12 +2159,12 @@ create_table_option:
{ Lex->create_info.data_file_name= $4.str; } { Lex->create_info.data_file_name= $4.str; }
| INDEX DIRECTORY_SYM opt_equal TEXT_STRING_sys { Lex->create_info.index_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 ident_or_text
{ {
$$ = ha_resolve_by_name($1.str,$1.length); $$ = ha_resolve_by_name($1.str,$1.length);
if ($$ == DB_TYPE_UNKNOWN) { if ($$ == DB_TYPE_UNKNOWN) {
net_printf(YYTHD, ER_UNKNOWN_TABLE_ENGINE, $1.str); net_printf(YYTHD, ER_UNKNOWN_STORAGE_ENGINE, $1.str);
YYABORT; YYABORT;
} }
}; };
...@@ -5112,7 +5114,7 @@ show_param: ...@@ -5112,7 +5114,7 @@ show_param:
lex->select_lex.db= $3; lex->select_lex.db= $3;
lex->select_lex.options= 0; lex->select_lex.options= 0;
} }
| ENGINE_SYM table_types | ENGINE_SYM storage_engines
{ Lex->create_info.db_type= $2; } { Lex->create_info.db_type= $2; }
show_engine_param show_engine_param
| opt_full COLUMNS from_or_in table_ident opt_db wild | opt_full COLUMNS from_or_in table_ident opt_db wild
...@@ -5162,7 +5164,13 @@ show_param: ...@@ -5162,7 +5164,13 @@ show_param:
| TABLE_SYM TYPES_SYM | TABLE_SYM TYPES_SYM
{ {
LEX *lex=Lex; 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 | PRIVILEGES
{ {
...@@ -5271,6 +5279,10 @@ master_or_binary: ...@@ -5271,6 +5279,10 @@ master_or_binary:
MASTER_SYM MASTER_SYM
| BINARY; | BINARY;
opt_storage:
/* empty */
| STORAGE_SYM;
opt_db: opt_db:
/* empty */ { $$= 0; } /* empty */ { $$= 0; }
| from_or_in ident { $$= $2.str; }; | from_or_in ident { $$= $2.str; };
...@@ -5846,6 +5858,7 @@ keyword: ...@@ -5846,6 +5858,7 @@ keyword:
| END {} | END {}
| ENUM {} | ENUM {}
| ENGINE_SYM {} | ENGINE_SYM {}
| ENGINES_SYM {}
| ERRORS {} | ERRORS {}
| ESCAPE_SYM {} | ESCAPE_SYM {}
| EVENTS_SYM {} | EVENTS_SYM {}
...@@ -5978,6 +5991,7 @@ keyword: ...@@ -5978,6 +5991,7 @@ keyword:
| START_SYM {} | START_SYM {}
| STATUS_SYM {} | STATUS_SYM {}
| STOP_SYM {} | STOP_SYM {}
| STORAGE_SYM {}
| STRING_SYM {} | STRING_SYM {}
| SUBDATE_SYM {} | SUBDATE_SYM {}
| SUBJECT_SYM {} | SUBJECT_SYM {}
...@@ -5992,6 +6006,7 @@ keyword: ...@@ -5992,6 +6006,7 @@ keyword:
| TIMESTAMP_DIFF {} | TIMESTAMP_DIFF {}
| TIME_SYM {} | TIME_SYM {}
| TYPE_SYM {} | TYPE_SYM {}
| TYPES_SYM {}
| FUNCTION_SYM {} | FUNCTION_SYM {}
| UNCOMMITTED_SYM {} | UNCOMMITTED_SYM {}
| UNICODE_SYM {} | UNICODE_SYM {}
......
...@@ -685,7 +685,7 @@ my_bool lookup_init(UDF_INIT *initid, UDF_ARGS *args, char *message) ...@@ -685,7 +685,7 @@ my_bool lookup_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
} }
initid->max_length=11; initid->max_length=11;
initid->maybe_null=1; initid->maybe_null=1;
#if !defined(HAVE_GETHOSTBYADDR_R) && defined(HAVE_SOLARIS_STYLE_GETHOST) #if !defined(HAVE_GETHOSTBYADDR_R) || !defined(HAVE_SOLARIS_STYLE_GETHOST)
(void) pthread_mutex_init(&LOCK_hostname,MY_MUTEX_INIT_SLOW); (void) pthread_mutex_init(&LOCK_hostname,MY_MUTEX_INIT_SLOW);
#endif #endif
return 0; return 0;
...@@ -693,7 +693,7 @@ my_bool lookup_init(UDF_INIT *initid, UDF_ARGS *args, char *message) ...@@ -693,7 +693,7 @@ my_bool lookup_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
void lookup_deinit(UDF_INIT *initid) void lookup_deinit(UDF_INIT *initid)
{ {
#if !defined(HAVE_GETHOSTBYADDR_R) && defined(HAVE_SOLARIS_STYLE_GETHOST) #if !defined(HAVE_GETHOSTBYADDR_R) || !defined(HAVE_SOLARIS_STYLE_GETHOST)
(void) pthread_mutex_destroy(&LOCK_hostname); (void) pthread_mutex_destroy(&LOCK_hostname);
#endif #endif
} }
...@@ -760,7 +760,7 @@ my_bool reverse_lookup_init(UDF_INIT *initid, UDF_ARGS *args, char *message) ...@@ -760,7 +760,7 @@ my_bool reverse_lookup_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
} }
initid->max_length=32; initid->max_length=32;
initid->maybe_null=1; initid->maybe_null=1;
#if !defined(HAVE_GETHOSTBYADDR_R) && defined(HAVE_SOLARIS_STYLE_GETHOST) #if !defined(HAVE_GETHOSTBYADDR_R) || !defined(HAVE_SOLARIS_STYLE_GETHOST)
(void) pthread_mutex_init(&LOCK_hostname,MY_MUTEX_INIT_SLOW); (void) pthread_mutex_init(&LOCK_hostname,MY_MUTEX_INIT_SLOW);
#endif #endif
return 0; return 0;
...@@ -768,7 +768,7 @@ my_bool reverse_lookup_init(UDF_INIT *initid, UDF_ARGS *args, char *message) ...@@ -768,7 +768,7 @@ my_bool reverse_lookup_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
void reverse_lookup_deinit(UDF_INIT *initid) void reverse_lookup_deinit(UDF_INIT *initid)
{ {
#if !defined(HAVE_GETHOSTBYADDR_R) && defined(HAVE_SOLARIS_STYLE_GETHOST) #if !defined(HAVE_GETHOSTBYADDR_R) || !defined(HAVE_SOLARIS_STYLE_GETHOST)
(void) pthread_mutex_destroy(&LOCK_hostname); (void) pthread_mutex_destroy(&LOCK_hostname);
#endif #endif
} }
......
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