Commit fc8490a1 authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi

merge with 4.0 to get last fixes to last merge

parents ee6bd848 8cba72fe
...@@ -50,6 +50,7 @@ sasha@mysql.sashanet.com ...@@ -50,6 +50,7 @@ sasha@mysql.sashanet.com
serg@serg.mysql.com serg@serg.mysql.com
serg@sergbook.mysql.com serg@sergbook.mysql.com
sinisa@rhols221.adsl.netsonic.fi sinisa@rhols221.adsl.netsonic.fi
tfr@indrek.tfr.cafe.ee
tfr@sarvik.tfr.cafe.ee tfr@sarvik.tfr.cafe.ee
tim@bitch.mysql.fi tim@bitch.mysql.fi
tim@black.box tim@black.box
......
OriginalAuthor: PaulDuBois OriginalAuthor: Paul DuBois
!!! ManualStyleGuidelines !!! ManualStyleGuidelines
''Version 1.0'' ''Version 1.1''
!! Revision History !! Revision History
* 2002-05-17 ArjenLentz - Version 1.0, Posted to Wiki * 2002-05-17 ArjenLentz - Version 1.0, Posted to Wiki
* 2002-06-03 ArjenLentz - Version 1.1, updates.
!! MySQL Manual Style Guidelines !! MySQL Manual Style Guidelines
...@@ -277,3 +278,5 @@ Logical NOT/OR/AND are operators, not functions, so they take operands, not argu ...@@ -277,3 +278,5 @@ Logical NOT/OR/AND are operators, not functions, so they take operands, not argu
It's NetWare, not Netware (as per Novell's trademark guidelines). It's NetWare, not Netware (as per Novell's trademark guidelines).
It's deprecated, not depricated.
...@@ -14341,7 +14341,7 @@ privilege. ...@@ -14341,7 +14341,7 @@ privilege.
@item --skip-stack-trace @item --skip-stack-trace
Don't write stack traces. This option is useful when you are running Don't write stack traces. This option is useful when you are running
@code{mysqld} under a debugger. On some system you also have to use @code{mysqld} under a debugger. On some systems you also have to use
this option to get a core file. @xref{Debugging server}. this option to get a core file. @xref{Debugging server}.
@item --skip-thread-priority @item --skip-thread-priority
...@@ -22662,9 +22662,12 @@ Overrides option --databases (-B). ...@@ -22662,9 +22662,12 @@ Overrides option --databases (-B).
@item -T, --tab=path-to-some-directory @item -T, --tab=path-to-some-directory
Creates a @code{table_name.sql} file, that contains the SQL CREATE commands, Creates a @code{table_name.sql} file, that contains the SQL CREATE commands,
and a @code{table_name.txt} file, that contains the data, for each give table. and a @code{table_name.txt} file, that contains the data, for each give table.
@strong{Note}: This only works if @code{mysqldump} is run on the same The format of the @file{.txt} file is made according to the
machine as the @code{mysqld} daemon. The format of the @file{.txt} file @code{--fields-xxx} and @code{--lines--xxx} options.
is made according to the @code{--fields-xxx} and @code{--lines--xxx} options. @strong{Note}: This option only works if @code{mysqldump} is run on the same
machine as the @code{mysqld} daemon, and the user/group that @code{mysqld}
is running as (normally user @code{mysql}, group @code{mysql}) needs to have
permission to create/write a file at the location you specify.
@item -u user_name, --user=user_name @item -u user_name, --user=user_name
The MySQL user name to use when connecting to the server. The The MySQL user name to use when connecting to the server. The
default value is your Unix login name. default value is your Unix login name.
...@@ -49340,6 +49343,9 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}. ...@@ -49340,6 +49343,9 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
@itemize @bullet @itemize @bullet
@item @item
Fixed that @code{ALTER TABLE table_name RENAME new_table_name} is as fast
as @code{RENAME TABLE}.
@item
Fixed bug in @code{GROUP BY} with two or more fields, where at least one Fixed bug in @code{GROUP BY} with two or more fields, where at least one
field can contain @code{NULL} values. field can contain @code{NULL} values.
@item @item
...@@ -71,10 +71,6 @@ FTP (@uref{ftp://mir1.ovh.net/ftp.mysql.com/}) ...@@ -71,10 +71,6 @@ FTP (@uref{ftp://mir1.ovh.net/ftp.mysql.com/})
@image{Flags/france} France [Netsample] @@ @image{Flags/france} France [Netsample] @@
WWW (@uref{http://www.mysql.netsample.com/}) WWW (@uref{http://www.mysql.netsample.com/})
@item
@image{Flags/france} France [Omegatomic] @@
WWW (@uref{http://mysql.omegatomic.com/})
@item @item
@image{Flags/france} France [Universite Paris 10] @@ @image{Flags/france} France [Universite Paris 10] @@
WWW (@uref{http://ftp.u-paris10.fr/mysql.com}) WWW (@uref{http://ftp.u-paris10.fr/mysql.com})
...@@ -269,10 +265,6 @@ FTP (@uref{ftp://mysql.unam.mx/pub/mysql/}) ...@@ -269,10 +265,6 @@ FTP (@uref{ftp://mysql.unam.mx/pub/mysql/})
@image{Flags/usa} USA [adgrafix.com / Boston, MA] @@ @image{Flags/usa} USA [adgrafix.com / Boston, MA] @@
WWW (@uref{http://mysql.adgrafix.com/}) WWW (@uref{http://mysql.adgrafix.com/})
@item
@image{Flags/usa} USA [Fast Mirror / Englewood, CO] @@
WWW (@uref{http://mysql.fastmirror.com/})
@item @item
@image{Flags/usa} USA [Hurricane Electric / San Jose, CA] @@ @image{Flags/usa} USA [Hurricane Electric / San Jose, CA] @@
WWW (@uref{http://mysql.he.net/}) WWW (@uref{http://mysql.he.net/})
...@@ -432,4 +424,3 @@ FTP (@uref{ftp://ftp.is.co.za/linux/mysql/}) ...@@ -432,4 +424,3 @@ FTP (@uref{ftp://ftp.is.co.za/linux/mysql/})
@end itemize @end itemize
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
**********************************************************************/ **********************************************************************/
#define MTEST_VERSION "1.23" #define MTEST_VERSION "1.24"
#include <my_global.h> #include <my_global.h>
#include <mysql_embed.h> #include <mysql_embed.h>
...@@ -1446,6 +1446,8 @@ int do_connect(struct st_query* q) ...@@ -1446,6 +1446,8 @@ int do_connect(struct st_query* q)
die("Failed on mysql_init()"); die("Failed on mysql_init()");
if (opt_compress) if (opt_compress)
mysql_options(&next_con->mysql,MYSQL_OPT_COMPRESS,NullS); mysql_options(&next_con->mysql,MYSQL_OPT_COMPRESS,NullS);
mysql_options(&next_con->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
if (con_sock && !free_con_sock && *con_sock && *con_sock != FN_LIBCHAR) if (con_sock && !free_con_sock && *con_sock && *con_sock != FN_LIBCHAR)
con_sock=fn_format(buff, con_sock, TMPDIR, "",0); con_sock=fn_format(buff, con_sock, TMPDIR, "",0);
if (!con_db[0]) if (!con_db[0])
...@@ -2356,6 +2358,8 @@ int main(int argc, char** argv) ...@@ -2356,6 +2358,8 @@ int main(int argc, char** argv)
die("Failed in mysql_init()"); die("Failed in mysql_init()");
if (opt_compress) if (opt_compress)
mysql_options(&cur_con->mysql,MYSQL_OPT_COMPRESS,NullS); mysql_options(&cur_con->mysql,MYSQL_OPT_COMPRESS,NullS);
mysql_options(&cur_con->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
cur_con->name = my_strdup("default", MYF(MY_WME)); cur_con->name = my_strdup("default", MYF(MY_WME));
if (!cur_con->name) if (!cur_con->name)
die("Out of memory"); die("Out of memory");
......
...@@ -114,3 +114,11 @@ i ...@@ -114,3 +114,11 @@ i
3 3
4 4
drop table t1; drop table t1;
create table t1 (i int unsigned not null auto_increment primary key);
alter table t1 rename t2;
alter table t2 rename t1, add c char(10) comment "no comment";
show columns from t1;
Field Type Null Key Default Extra
i int(10) unsigned PRI NULL auto_increment
c char(10) YES NULL
drop table t1;
...@@ -105,3 +105,13 @@ insert into t1 values (null),(null),(null),(null); ...@@ -105,3 +105,13 @@ insert into t1 values (null),(null),(null),(null);
alter table t1 drop i,add i int unsigned not null auto_increment, drop primary key, add primary key (i); alter table t1 drop i,add i int unsigned not null auto_increment, drop primary key, add primary key (i);
select * from t1; select * from t1;
drop table t1; drop table t1;
#
# Alter table and rename
#
create table t1 (i int unsigned not null auto_increment primary key);
alter table t1 rename t2;
alter table t2 rename t1, add c char(10) comment "no comment";
show columns from t1;
drop table t1;
...@@ -18,7 +18,9 @@ ...@@ -18,7 +18,9 @@
/* Thread safe version of gethostbyname_r() */ /* Thread safe version of gethostbyname_r() */
#include "mysys_priv.h" #include "mysys_priv.h"
#ifdef THREAD
#include "my_pthread.h" #include "my_pthread.h"
#endif
#include <assert.h> #include <assert.h>
#if !defined(MSDOS) && !defined(__WIN__) #if !defined(MSDOS) && !defined(__WIN__)
#include <netdb.h> #include <netdb.h>
...@@ -28,11 +30,6 @@ ...@@ -28,11 +30,6 @@
/* This file is not needed if my_gethostbyname_r is a macro */ /* This file is not needed if my_gethostbyname_r is a macro */
#if !defined(my_gethostbyname_r) #if !defined(my_gethostbyname_r)
#ifndef THREAD
#define pthread_mutex_lock(A)
#define pthread_mutex_unlock(A)
#endif
/* /*
Emulate SOLARIS style calls, not because it's better, but just to make the Emulate SOLARIS style calls, not because it's better, but just to make the
usage of getbostbyname_r simpler. usage of getbostbyname_r simpler.
......
...@@ -68,7 +68,7 @@ int handle_options(int *argc, char ***argv, ...@@ -68,7 +68,7 @@ int handle_options(int *argc, char ***argv,
{ {
uint opt_found, argvpos= 0, length, spec_len, i; uint opt_found, argvpos= 0, length, spec_len, i;
my_bool end_of_options= 0, must_be_var, set_maximum_value, special_used, my_bool end_of_options= 0, must_be_var, set_maximum_value, special_used,
option_is_loose; option_is_loose, option_used= 0;
char *progname= *(*argv), **pos, *optend, *prev_found; char *progname= *(*argv), **pos, *optend, *prev_found;
const struct my_option *optp; const struct my_option *optp;
int error; int error;
...@@ -84,6 +84,7 @@ int handle_options(int *argc, char ***argv, ...@@ -84,6 +84,7 @@ int handle_options(int *argc, char ***argv,
if (cur_arg[0] == '-' && cur_arg[1] && !end_of_options) /* must be opt */ if (cur_arg[0] == '-' && cur_arg[1] && !end_of_options) /* must be opt */
{ {
char *argument= 0; char *argument= 0;
option_used= 1;
must_be_var= 0; must_be_var= 0;
set_maximum_value= 0; set_maximum_value= 0;
special_used= 0; special_used= 0;
...@@ -336,7 +337,6 @@ int handle_options(int *argc, char ***argv, ...@@ -336,7 +337,6 @@ int handle_options(int *argc, char ***argv,
if (optp->var_type == GET_BOOL && optp->arg_type == NO_ARG) if (optp->var_type == GET_BOOL && optp->arg_type == NO_ARG)
{ {
*((my_bool*) optp->value)= (my_bool) 1; *((my_bool*) optp->value)= (my_bool) 1;
(*argc)--;
continue; // For GET_BOOL get_one_option() shouldn't be called continue; // For GET_BOOL get_one_option() shouldn't be called
} }
else if (optp->arg_type == REQUIRED_ARG || else if (optp->arg_type == REQUIRED_ARG ||
...@@ -401,6 +401,12 @@ int handle_options(int *argc, char ***argv, ...@@ -401,6 +401,12 @@ int handle_options(int *argc, char ***argv,
else /* non-option found */ else /* non-option found */
(*argv)[argvpos++]= cur_arg; (*argv)[argvpos++]= cur_arg;
} }
/* Destroy the first, already handled option, so that programs that look
for arguments in 'argv', without checking 'argc', know when to stop.
Items in argv, before the destroyed one, are all non-option -arguments
to the program, yet to be (possibly) handled. */
if (option_used)
(*argv)[argvpos]= 0;
return 0; return 0;
} }
......
...@@ -58,7 +58,7 @@ void hostname_cache_refresh() ...@@ -58,7 +58,7 @@ void hostname_cache_refresh()
bool hostname_cache_init() bool hostname_cache_init()
{ {
host_entry *tmp; host_entry *tmp;
uint offset= (uint) ((char*) (&tmp->ip) - (char*) &tmp); uint offset= (uint) ((char*) (&tmp->ip) - (char*) tmp);
(void) pthread_mutex_init(&LOCK_hostname,MY_MUTEX_INIT_SLOW); (void) pthread_mutex_init(&LOCK_hostname,MY_MUTEX_INIT_SLOW);
if (!(hostname_cache=new hash_filo(HOST_CACHE_SIZE, offset, if (!(hostname_cache=new hash_filo(HOST_CACHE_SIZE, offset,
......
...@@ -1308,13 +1308,14 @@ bool Item_func_like::fix_fields(THD *thd,struct st_table_list *tlist) ...@@ -1308,13 +1308,14 @@ bool Item_func_like::fix_fields(THD *thd,struct st_table_list *tlist)
{ {
pattern = first + 1; pattern = first + 1;
pattern_len = len - 2; pattern_len = len - 2;
DBUG_PRINT("TurboBM", ("Initializing pattern: '%s'...", first)); DBUG_PRINT("info", ("Initializing pattern: '%s'", first));
int* suff = (int*)thd->alloc(sizeof(int[pattern_len + 1])); int *suff = (int*) thd->alloc(sizeof(int)*((pattern_len + 1)*2+
bmGs = (int*)thd->alloc(sizeof(int[pattern_len + 1])); alphabet_size));
bmBc = (int*)thd->alloc(sizeof(int[alphabet_size])); bmGs = suff + pattern_len + 1;
bmBc = bmGs + pattern_len + 1;
turboBM_compute_good_suffix_shifts(suff); turboBM_compute_good_suffix_shifts(suff);
turboBM_compute_bad_character_shifts(); turboBM_compute_bad_character_shifts();
DBUG_PRINT("turboBM",("done")); DBUG_PRINT("info",("done"));
} }
} }
return 0; return 0;
......
...@@ -495,16 +495,10 @@ class Item_func_like :public Item_bool_func2 ...@@ -495,16 +495,10 @@ class Item_func_like :public Item_bool_func2
enum { alphabet_size = 256 }; enum { alphabet_size = 256 };
public: public:
Item_func_like::Item_func_like(Item *a,Item *b, char* escape_arg) : Item_func_like(Item *a,Item *b, char* escape_arg)
Item_bool_func2(a,b), :Item_bool_func2(a,b), escape(*escape_arg), canDoTurboBM(false),
escape(*escape_arg), pattern(0), pattern_len(0), bmGs(0), bmBc(0)
canDoTurboBM(false),
pattern(0),
pattern_len(0),
bmGs(0),
bmBc(0)
{} {}
longlong val_int(); longlong val_int();
enum Functype functype() const { return LIKE_FUNC; } enum Functype functype() const { return LIKE_FUNC; }
optimize_type select_optimize() const; optimize_type select_optimize() const;
......
...@@ -4004,6 +4004,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -4004,6 +4004,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
exit(0); exit(0);
case 'T': case 'T':
test_flags= argument ? (uint) atoi(argument) : 0; test_flags= argument ? (uint) atoi(argument) : 0;
test_flags&= ~TEST_NO_THREADS;
opt_endinfo=1; opt_endinfo=1;
break; break;
case (int) OPT_BIG_TABLES: case (int) OPT_BIG_TABLES:
...@@ -4193,8 +4194,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -4193,8 +4194,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_specialflag|=SPECIAL_SKIP_SHOW_DB; opt_specialflag|=SPECIAL_SKIP_SHOW_DB;
mysql_port=0; mysql_port=0;
break; break;
#ifdef ONE_THREAD
case (int) OPT_ONE_THREAD: case (int) OPT_ONE_THREAD:
test_flags |= TEST_NO_THREADS; test_flags |= TEST_NO_THREADS;
#endif
break; break;
case (int) OPT_WANT_CORE: case (int) OPT_WANT_CORE:
test_flags |= TEST_CORE_ON_SIGNAL; test_flags |= TEST_CORE_ON_SIGNAL;
......
...@@ -90,21 +90,21 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result, ...@@ -90,21 +90,21 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
(*param->item)->val() < 0) (*param->item)->val() < 0)
{ {
net_printf(&thd->net, ER_WRONG_PARAMETERS_TO_PROCEDURE, proc_name); net_printf(&thd->net, ER_WRONG_PARAMETERS_TO_PROCEDURE, proc_name);
return 0; DBUG_RETURN(0);
} }
pc->max_tree_elements = (uint) (*param->item)->val_int(); pc->max_tree_elements = (uint) (*param->item)->val_int();
param = param->next; param = param->next;
if (param->next) // no third parameter possible if (param->next) // no third parameter possible
{ {
net_printf(&thd->net, ER_WRONG_PARAMCOUNT_TO_PROCEDURE, proc_name); net_printf(&thd->net, ER_WRONG_PARAMCOUNT_TO_PROCEDURE, proc_name);
return 0; DBUG_RETURN(0);
} }
// second parameter // second parameter
if ((*param->item)->type() != Item::INT_ITEM || if ((*param->item)->type() != Item::INT_ITEM ||
(*param->item)->val() < 0) (*param->item)->val() < 0)
{ {
net_printf(&thd->net, ER_WRONG_PARAMETERS_TO_PROCEDURE, proc_name); net_printf(&thd->net, ER_WRONG_PARAMETERS_TO_PROCEDURE, proc_name);
return 0; DBUG_RETURN(0);
} }
pc->max_treemem = (uint) (*param->item)->val_int(); pc->max_treemem = (uint) (*param->item)->val_int();
} }
...@@ -112,7 +112,7 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result, ...@@ -112,7 +112,7 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
(*param->item)->val() < 0) (*param->item)->val() < 0)
{ {
net_printf(&thd->net, ER_WRONG_PARAMETERS_TO_PROCEDURE, proc_name); net_printf(&thd->net, ER_WRONG_PARAMETERS_TO_PROCEDURE, proc_name);
return 0; DBUG_RETURN(0);
} }
// if only one parameter was given, it will be the value of max_tree_elements // if only one parameter was given, it will be the value of max_tree_elements
else else
...@@ -148,21 +148,26 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result, ...@@ -148,21 +148,26 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
if (item->result_type() == STRING_RESULT) if (item->result_type() == STRING_RESULT)
*f_info++ = new field_str(item, pc); *f_info++ = new field_str(item, pc);
} }
return pc; DBUG_RETURN(pc);
} // proc_analyse_init }
// return 1 if number, else return 0 /*
// store info about found number in info Return 1 if number, else return 0
// NOTE:It is expected, that elements of 'info' are all zero! store info about found number in info
NOTE:It is expected, that elements of 'info' are all zero!
*/
bool test_if_number(NUM_INFO *info, const char *str, uint str_len) bool test_if_number(NUM_INFO *info, const char *str, uint str_len)
{ {
const char *begin, *end = str + str_len; const char *begin, *end = str + str_len;
DBUG_ENTER("test_if_number"); DBUG_ENTER("test_if_number");
// MySQL removes any endspaces of a string, so we must take care only of /*
// spaces in front of a string MySQL removes any endspaces of a string, so we must take care only of
spaces in front of a string
*/
for (; str != end && my_isspace(system_charset_info, *str); str++) ; for (; str != end && my_isspace(system_charset_info, *str); str++) ;
if (str == end) if (str == end)
return 0; return 0;
......
...@@ -590,7 +590,7 @@ pthread_handler_decl(handle_one_connection,arg) ...@@ -590,7 +590,7 @@ pthread_handler_decl(handle_one_connection,arg)
#if !defined( __WIN__) && !defined(OS2) // Win32 calls this in pthread_create #if !defined( __WIN__) && !defined(OS2) // Win32 calls this in pthread_create
// The following calls needs to be done before we call DBUG_ macros // The following calls needs to be done before we call DBUG_ macros
if (my_thread_init()) if (!(test_flags & TEST_NO_THREADS) & my_thread_init())
{ {
close_connection(&thd->net,ER_OUT_OF_RESOURCES); close_connection(&thd->net,ER_OUT_OF_RESOURCES);
statistic_increment(aborted_connects,&LOCK_thread_count); statistic_increment(aborted_connects,&LOCK_thread_count);
...@@ -1972,6 +1972,7 @@ mysql_execute_command(void) ...@@ -1972,6 +1972,7 @@ mysql_execute_command(void)
} }
auxi->lock_type=walk->lock_type=TL_WRITE; auxi->lock_type=walk->lock_type=TL_WRITE;
auxi->table= (TABLE *) walk; // Remember corresponding table auxi->table= (TABLE *) walk; // Remember corresponding table
(void)add_item_to_list(new Item_field(auxi->db,auxi->real_name,"*"));
} }
tables->grant.want_privilege=(SELECT_ACL & ~tables->grant.privilege); tables->grant.want_privilege=(SELECT_ACL & ~tables->grant.privilege);
if (add_item_to_list(new Item_null())) if (add_item_to_list(new Item_null()))
...@@ -2583,8 +2584,17 @@ check_table_access(THD *thd,uint want_access,TABLE_LIST *tables, ...@@ -2583,8 +2584,17 @@ check_table_access(THD *thd,uint want_access,TABLE_LIST *tables,
} }
} }
else if (check_access(thd,want_access,tables->db,&tables->grant.privilege, else if (check_access(thd,want_access,tables->db,&tables->grant.privilege,
0, no_errors | grant_option))
{
if (grant_option)
{
if ( check_access(thd,want_access & (uint) ~TABLE_ACLS,tables->db,&tables->grant.privilege,
0, no_errors)) 0, no_errors))
return TRUE; // Access denied return TRUE;
}
else
return TRUE;
}
} }
if (grant_option) if (grant_option)
return check_grant(thd,want_access & ~EXTRA_ACL,org_tables, return check_grant(thd,want_access & ~EXTRA_ACL,org_tables,
......
...@@ -1303,7 +1303,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -1303,7 +1303,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
thd->proc_info="init"; thd->proc_info="init";
table_name=table_list->real_name; table_name=table_list->real_name;
db=table_list->db; db=table_list->db;
if (!new_db) if (!new_db || !strcmp(new_db,db))
new_db=db; new_db=db;
used_fields=create_info->used_fields; used_fields=create_info->used_fields;
...@@ -1357,10 +1357,10 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -1357,10 +1357,10 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
/* In some simple cases we need not to recreate the table */ /* In some simple cases we need not to recreate the table */
thd->proc_info="setup"; thd->proc_info="setup";
if (simple_alter) if (simple_alter && !table->tmp_table)
{ {
error=0; error=0;
if (new_name != table_name) if (new_name != table_name || new_db != db)
{ {
thd->proc_info="rename"; thd->proc_info="rename";
VOID(pthread_mutex_lock(&LOCK_open)); VOID(pthread_mutex_lock(&LOCK_open));
...@@ -1383,9 +1383,9 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -1383,9 +1383,9 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
} }
if (!error) if (!error)
{ {
switch (keys_onoff) switch (keys_onoff) {
{ case LEAVE_AS_IS:
case LEAVE_AS_IS: break; break;
case ENABLE: case ENABLE:
error=table->file->activate_all_index(thd); error=table->file->activate_all_index(thd);
break; break;
...@@ -1797,7 +1797,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -1797,7 +1797,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
thd->proc_info="rename result table"; thd->proc_info="rename result table";
sprintf(old_name,"%s2-%lx-%lx", tmp_file_prefix, current_pid, sprintf(old_name,"%s2-%lx-%lx", tmp_file_prefix, current_pid,
thd->thread_id); thd->thread_id);
if (new_name != table_name) if (new_name != table_name || new_db != db)
{ {
if (!access(new_name_buff,F_OK)) if (!access(new_name_buff,F_OK))
{ {
...@@ -1815,7 +1815,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -1815,7 +1815,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
{ {
/* /*
Win32 and InnoDB can't drop a table that is in use, so we must Win32 and InnoDB can't drop a table that is in use, so we must
close all the original table at before doing the rename close the original table at before doing the rename
*/ */
table_name=thd->strdup(table_name); // must be saved table_name=thd->strdup(table_name); // must be saved
if (close_cached_table(thd,table)) if (close_cached_table(thd,table))
......
...@@ -1329,7 +1329,6 @@ alter_list_item: ...@@ -1329,7 +1329,6 @@ alter_list_item:
LEX *lex=Lex; LEX *lex=Lex;
lex->select->db=$3->db.str; lex->select->db=$3->db.str;
lex->name= $3->table.str; lex->name= $3->table.str;
lex->simple_alter=0;
} }
| create_table_options { Lex->simple_alter=0; } | create_table_options { Lex->simple_alter=0; }
| order_clause { Lex->simple_alter=0; }; | order_clause { Lex->simple_alter=0; };
......
...@@ -36,12 +36,14 @@ const char *VER="0.2"; ...@@ -36,12 +36,14 @@ const char *VER="0.2";
const char *default_dbug_option="d:t:O,-"; const char *default_dbug_option="d:t:O,-";
#endif #endif
#if 0
static void static void
fatal_error( const char* r) fatal_error( const char* r)
{ {
perror(r); perror(r);
exit(0); exit(0);
} }
#endif
typedef struct { typedef struct {
int sd; int sd;
...@@ -72,11 +74,11 @@ client_thread( void* arg) ...@@ -72,11 +74,11 @@ client_thread( void* arg)
{ {
my_thread_init(); my_thread_init();
do_ssl_stuff((TH_ARGS*)arg); do_ssl_stuff((TH_ARGS*)arg);
return 0;
} }
int int
main( int argc __attribute__((unused)), main(int argc __attribute__((unused)), char** argv)
char** argv)
{ {
char server_key[] = "../SSL/server-key.pem", char server_key[] = "../SSL/server-key.pem",
server_cert[] = "../SSL/server-cert.pem"; server_cert[] = "../SSL/server-cert.pem";
......
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