Commit 74a1f9af authored by paul@teton.kitebird.com's avatar paul@teton.kitebird.com

Merge paul@bk-internal.mysql.com:/home/bk/mysql-4.1

into teton.kitebird.com:/home/paul/mysql-4.1
parents b67a1e16 3ddbc987
......@@ -2153,7 +2153,7 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
DYNAMIC_STRING *ds;
DYNAMIC_STRING ds_tmp;
DYNAMIC_STRING eval_query;
char* query, buff[MAX_DELIMITER + 1]= {0};
char* query;
int query_len;
DBUG_ENTER("run_query");
......@@ -2188,8 +2188,8 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
if ((flags & QUERY_SEND) && !disable_query_log && !counter)
{
replace_dynstr_append_mem(ds,query, query_len);
sprintf(buff, "%s\n", delimiter);
dynstr_append_mem(ds, buff, delimiter_length + 1);
dynstr_append_mem(ds, delimiter, delimiter_length);
dynstr_append_mem(ds, "\n", 1);
}
if (!(flags & QUERY_REAP))
DBUG_RETURN(0);
......
......@@ -86,5 +86,4 @@ extern const char *client_errors[]; /* Error messages */
#define CR_SHARED_MEMORY_CONNECT_SET_ERROR 2045
#define CR_CONN_UNKNOW_PROTOCOL 2046
#define CR_INVALID_CONN_HANDLE 2047
#define CR_MYSQL_SERVER_INIT_MISSED 2048
#define CR_SECURE_AUTH 2049
#define CR_SECURE_AUTH 2048
......@@ -638,9 +638,6 @@ int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
(*(mysql)->methods->advanced_command)(mysql, command, \
NullS, 0, arg, length, skip_check)
unsigned long net_safe_read(MYSQL* mysql);
void mysql_once_init(void);
extern my_bool server_inited;
#ifdef __NETWARE__
#pragma pack(pop) /* restore alignment */
......
......@@ -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", "",
......@@ -58,3 +58,14 @@ int cli_stmt_execute(MYSQL_STMT *stmt);
MYSQL_DATA * cli_read_binary_rows(MYSQL_STMT *stmt);
int cli_unbuffered_fetch(MYSQL *mysql, char **row);
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[]=
"Can't open shared memory. Can't send the request event to server (%lu)",
"Wrong or unknown protocol",
"Invalid connection handle",
"mysql_server_init wasn't called",
"Connection using old (pre 4.1.1) authentication protocol refused (client option 'secure_auth' enabled)"
};
......@@ -129,7 +128,6 @@ const char *client_errors[]=
"Can't open shared memory. Can't send the request event to server (%lu)",
"Wrong or unknown protocol",
"Invalid connection handle",
"mysql_server_init wasn't called",
"Connection using old (pre 4.1.1) authentication protocol refused (client option 'secure_auth' enabled)"
};
......@@ -184,7 +182,6 @@ const char *client_errors[]=
"Can't open shared memory. Can't send the request event to server (%lu)",
"Wrong or unknown protocol",
"Invalid connection handle",
"mysql_server_init wasn't called",
"Connection using old (pre 4.1.1) authentication protocol refused (client option 'secure_auth' enabled)"
};
#endif
......
......@@ -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 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)
{
mysql_client_init=1;
......@@ -131,24 +132,18 @@ void mysql_once_init(void)
#if defined(SIGPIPE) && !defined(__WIN__)
(void) signal(SIGPIPE, SIG_IGN);
#endif
result= init_embedded_server(argc, argv, groups);
}
#ifdef THREAD
else
my_thread_init(); /* Init if new thread */
result= (int)my_thread_init(); /* Init if new thread */
#endif
}
#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;
return result;
}
void STDCALL mysql_server_end()
{
end_embedded_server();
/* If library called my_init(), free memory allocated by it */
if (!org_my_init_done)
{
......@@ -163,8 +158,6 @@ void STDCALL mysql_server_end()
mysql_client_init= org_my_init_done= 0;
}
#endif /*EMBEDDED_LIBRARY*/
my_bool STDCALL mysql_thread_init()
{
#ifdef THREAD
......
......@@ -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 MYSQL_METHODS embedded_methods;
void free_old_query(MYSQL *mysql);
extern my_bool server_inited;
C_MODE_END
......@@ -42,9 +42,6 @@ C_MODE_START
#include "errmsg.h"
#include <sql_common.h>
static my_bool org_my_init_done;
my_bool server_inited;
static my_bool
emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
const char *header, ulong header_length,
......@@ -305,7 +302,7 @@ extern "C"
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];
......@@ -329,17 +326,7 @@ int STDCALL mysql_server_init(int argc, char **argv, char **groups)
if (!groups)
groups= (char**) fake_groups;
/* 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
}
my_progname= (char *)"mysql_embedded";
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)
return 0;
}
void STDCALL mysql_server_end()
void end_embedded_server()
{
my_free((char*) copy_arguments_ptr, MYF(MY_ALLOW_ZERO_PTR));
copy_arguments_ptr=0;
clean_up(0);
/* If library called my_init(), free memory allocated by it */
if (!org_my_init_done)
my_end(0);
}
} /* extern "C" */
......
......@@ -163,20 +163,12 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
db ? db : "(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 ||
(mysql->options.methods_to_use == MYSQL_OPT_GUESS_CONNECTION &&
host && strcmp(host,LOCAL_HOST)))
cli_mysql_real_connect(mysql, host, user,
passwd, db, port, unix_socket, client_flag);
DBUG_RETURN(cli_mysql_real_connect(mysql, host, user,
passwd, db, port,
unix_socket, client_flag));
mysql->methods= &embedded_methods;
......
......@@ -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;
......@@ -1310,7 +1310,8 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths)
MYSQL * STDCALL
mysql_init(MYSQL *mysql)
{
mysql_once_init();
if (mysql_server_init(0, NULL, NULL))
return 0;
if (!mysql)
{
if (!(mysql=(MYSQL*) my_malloc(sizeof(*mysql),MYF(MY_WME | MY_ZEROFILL))))
......
......@@ -32,3 +32,5 @@
#undef HAVE_SMEM
#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)
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)
......
......@@ -54,6 +54,12 @@
#ifdef EMBEDDED_LIBRARY
#undef MYSQL_SERVER
#ifndef MYSQL_CLIENT
#define MYSQL_CLIENT
#endif
#undef net_flush
extern "C" {
......
......@@ -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
{
......
......@@ -38,8 +38,3 @@ void my_net_local_init(NET *net)
}
}
extern "C" {
void mysql_once_init(void)
{
}
}
......@@ -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 {}
......
......@@ -681,7 +681,7 @@ my_bool lookup_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
}
initid->max_length=11;
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);
#endif
return 0;
......@@ -689,7 +689,7 @@ my_bool lookup_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
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);
#endif
}
......@@ -756,7 +756,7 @@ my_bool reverse_lookup_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
}
initid->max_length=32;
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);
#endif
return 0;
......@@ -764,7 +764,7 @@ my_bool reverse_lookup_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
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);
#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