diff options
author | unknown <monty@hundin.mysql.fi> | 2002-06-04 00:40:27 +0300 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2002-06-04 00:40:27 +0300 |
commit | a7798dfd0a6472bf65fffc2ade543605e177ff9c (patch) | |
tree | 675836bfd2d520dcffdb4499ac8cf51045c407f2 | |
parent | 7cb2e2d1dce2c7466388f4a6ade0614564be82fc (diff) | |
download | mariadb-git-a7798dfd0a6472bf65fffc2ade543605e177ff9c.tar.gz |
Enable LOAD DATA LOCAL INFILE in mysql_test
Added syntax for column comments (for compability with 4.1)
Fix of ALTER TABLE RENAME
Docs/manual.texi:
Changelog
client/mysqltest.c:
Enable LOAD DATA LOCAL INFILE
mysql-test/r/alter_table.result:
Test of syntax for column comments
mysql-test/r/func_math.result:
Fixed test of new truncate
mysql-test/t/alter_table.test:
Test of syntax for column comments
mysys/my_gethostbyname.c:
Portability fix
sql/hostname.cc:
Fixed pointer bug
sql/item_cmpfunc.cc:
Optimizing LIKE code
sql/item_cmpfunc.h:
Cleanup
sql/mysqld.cc:
Avoid warning of duplicate calls to mysql_thread_init()
sql/sql_analyse.cc:
Removed warning from DBUG
sql/sql_parse.cc:
Avoid warning of duplicate calls to mysql_thread_init()
sql/sql_table.cc:
Fix of ALTER TABLE RENAME
sql/sql_yacc.yy:
Added syntax for field comments
vio/test-sslserver.c:
Cleanup
-rw-r--r-- | Docs/manual.texi | 3 | ||||
-rw-r--r-- | client/mysqltest.c | 6 | ||||
-rw-r--r-- | mysql-test/r/alter_table.result | 8 | ||||
-rw-r--r-- | mysql-test/r/func_math.result | 2 | ||||
-rw-r--r-- | mysql-test/t/alter_table.test | 10 | ||||
-rw-r--r-- | mysys/my_gethostbyname.c | 7 | ||||
-rw-r--r-- | sql/hostname.cc | 2 | ||||
-rw-r--r-- | sql/item_cmpfunc.cc | 11 | ||||
-rw-r--r-- | sql/item_cmpfunc.h | 12 | ||||
-rw-r--r-- | sql/mysqld.cc | 3 | ||||
-rw-r--r-- | sql/sql_analyse.cc | 27 | ||||
-rw-r--r-- | sql/sql_parse.cc | 2 | ||||
-rw-r--r-- | sql/sql_table.cc | 28 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 7 | ||||
-rw-r--r-- | vio/test-sslserver.c | 10 |
15 files changed, 83 insertions, 55 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi index 4362aaa3569..fe9063d759a 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -49340,6 +49340,9 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}. @itemize @bullet @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 field can contain @code{NULL} values. @item diff --git a/client/mysqltest.c b/client/mysqltest.c index 2421ae69af5..8fad182193b 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -42,7 +42,7 @@ **********************************************************************/ -#define MTEST_VERSION "1.23" +#define MTEST_VERSION "1.24" #include <my_global.h> #include <mysql_embed.h> @@ -1446,6 +1446,8 @@ int do_connect(struct st_query* q) die("Failed on mysql_init()"); if (opt_compress) 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) con_sock=fn_format(buff, con_sock, TMPDIR, "",0); if (!con_db[0]) @@ -2355,6 +2357,8 @@ int main(int argc, char** argv) die("Failed in mysql_init()"); if (opt_compress) 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)); if (!cur_con->name) die("Out of memory"); diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index f0c3e2d162a..1d6d69465da 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -114,3 +114,11 @@ i 3 4 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; diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result index b961c839510..f067d1f651e 100644 --- a/mysql-test/r/func_math.result +++ b/mysql-test/r/func_math.result @@ -4,8 +4,10 @@ floor(5.5) floor(-5.5) select ceiling(5.5),ceiling(-5.5); ceiling(5.5) ceiling(-5.5) 6 -5 +select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2), truncate(-52.64,1),truncate(-52.64,-1); truncate(52.64,1) truncate(52.64,2) truncate(52.64,-1) truncate(52.64,-2) truncate(-52.64,1) truncate(-52.64,-1) 52.6 52.64 50 0 -52.6 -50 +select round(5.5),round(-5.5); round(5.5) round(-5.5) 6 -6 select round(5.64,1),round(5.64,2),round(5.64,-1),round(5.64,-2); diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index 22af6663e0a..2b329f3ec6e 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -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); select * from 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; diff --git a/mysys/my_gethostbyname.c b/mysys/my_gethostbyname.c index 898ca694121..1380257f660 100644 --- a/mysys/my_gethostbyname.c +++ b/mysys/my_gethostbyname.c @@ -18,7 +18,9 @@ /* Thread safe version of gethostbyname_r() */ #include "mysys_priv.h" +#ifdef THREAD #include "my_pthread.h" +#endif #include <assert.h> #if !defined(MSDOS) && !defined(__WIN__) #include <netdb.h> @@ -28,11 +30,6 @@ /* This file is not needed if my_gethostbyname_r is a macro */ #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 usage of getbostbyname_r simpler. diff --git a/sql/hostname.cc b/sql/hostname.cc index bd4ec06c083..a93af8b273e 100644 --- a/sql/hostname.cc +++ b/sql/hostname.cc @@ -58,7 +58,7 @@ void hostname_cache_refresh() bool hostname_cache_init() { 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); if (!(hostname_cache=new hash_filo(HOST_CACHE_SIZE, offset, diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index d95dbf8ef97..d2eb16ce5de 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1304,13 +1304,14 @@ bool Item_func_like::fix_fields(THD *thd,struct st_table_list *tlist) { pattern = first + 1; pattern_len = len - 2; - DBUG_PRINT("TurboBM", ("Initializing pattern: '%s'...", first)); - int* suff = (int*)thd->alloc(sizeof(int[pattern_len + 1])); - bmGs = (int*)thd->alloc(sizeof(int[pattern_len + 1])); - bmBc = (int*)thd->alloc(sizeof(int[alphabet_size])); + DBUG_PRINT("info", ("Initializing pattern: '%s'", first)); + int *suff = (int*) thd->alloc(sizeof(int)*((pattern_len + 1)*2+ + alphabet_size)); + bmGs = suff + pattern_len + 1; + bmBc = bmGs + pattern_len + 1; turboBM_compute_good_suffix_shifts(suff); turboBM_compute_bad_character_shifts(); - DBUG_PRINT("turboBM",("done")); + DBUG_PRINT("info",("done")); } } return 0; diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index cd6e3d6e414..3f674198856 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -495,16 +495,10 @@ class Item_func_like :public Item_bool_func2 enum { alphabet_size = 256 }; public: - Item_func_like::Item_func_like(Item *a,Item *b, char* escape_arg) : - Item_bool_func2(a,b), - escape(*escape_arg), - canDoTurboBM(false), - pattern(0), - pattern_len(0), - bmGs(0), - bmBc(0) + Item_func_like(Item *a,Item *b, char* escape_arg) + :Item_bool_func2(a,b), escape(*escape_arg), canDoTurboBM(false), + pattern(0), pattern_len(0), bmGs(0), bmBc(0) {} - longlong val_int(); enum Functype functype() const { return LIKE_FUNC; } optimize_type select_optimize() const; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 627888075c6..1fd68d92a88 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4004,6 +4004,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), exit(0); case 'T': test_flags= argument ? (uint) atoi(argument) : 0; + test_flags&= ~TEST_NO_THREADS; opt_endinfo=1; break; case (int) OPT_BIG_TABLES: @@ -4192,8 +4193,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), opt_specialflag|=SPECIAL_SKIP_SHOW_DB; mysql_port=0; break; +#ifdef ONE_THREAD case (int) OPT_ONE_THREAD: test_flags |= TEST_NO_THREADS; +#endif break; case (int) OPT_WANT_CORE: test_flags |= TEST_CORE_ON_SIGNAL; diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc index df8a8f1fdde..bbe82653190 100644 --- a/sql/sql_analyse.cc +++ b/sql/sql_analyse.cc @@ -90,21 +90,21 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result, (*param->item)->val() < 0) { 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(); param = param->next; if (param->next) // no third parameter possible { net_printf(&thd->net, ER_WRONG_PARAMCOUNT_TO_PROCEDURE, proc_name); - return 0; + DBUG_RETURN(0); } // second parameter if ((*param->item)->type() != Item::INT_ITEM || (*param->item)->val() < 0) { net_printf(&thd->net, ER_WRONG_PARAMETERS_TO_PROCEDURE, proc_name); - return 0; + DBUG_RETURN(0); } pc->max_treemem = (uint) (*param->item)->val_int(); } @@ -112,7 +112,7 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result, (*param->item)->val() < 0) { 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 else @@ -148,21 +148,26 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result, if (item->result_type() == STRING_RESULT) *f_info++ = new field_str(item, pc); } - return pc; -} // proc_analyse_init + DBUG_RETURN(pc); +} -// return 1 if number, else return 0 -// store info about found number in info -// NOTE:It is expected, that elements of 'info' are all zero! +/* + Return 1 if number, else return 0 + 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) { const char *begin, *end = str + str_len; 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 && isspace(*str); str++) ; if (str == end) return 0; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 3f2d4808cbe..0fac97cac38 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -589,7 +589,7 @@ pthread_handler_decl(handle_one_connection,arg) #if !defined( __WIN__) && !defined(OS2) // Win32 calls this in pthread_create // 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); statistic_increment(aborted_connects,&LOCK_thread_count); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 64a55380b69..fe66b14d697 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1235,7 +1235,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, thd->proc_info="init"; table_name=table_list->real_name; db=table_list->db; - if (!new_db) + if (!new_db || !strcmp(new_db,db)) new_db=db; used_fields=create_info->used_fields; @@ -1289,10 +1289,10 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, /* In some simple cases we need not to recreate the table */ thd->proc_info="setup"; - if (simple_alter) + if (simple_alter && !table->tmp_table) { error=0; - if (new_name != table_name) + if (new_name != table_name || new_db != db) { thd->proc_info="rename"; VOID(pthread_mutex_lock(&LOCK_open)); @@ -1315,15 +1315,15 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, } if (!error) { - switch (keys_onoff) - { - case LEAVE_AS_IS: break; - case ENABLE: - error=table->file->activate_all_index(thd); - break; - case DISABLE: - table->file->deactivate_non_unique_index(HA_POS_ERROR); - break; + switch (keys_onoff) { + case LEAVE_AS_IS: + break; + case ENABLE: + error=table->file->activate_all_index(thd); + break; + case DISABLE: + table->file->deactivate_non_unique_index(HA_POS_ERROR); + break; } } if (!error) @@ -1720,7 +1720,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, thd->proc_info="rename result table"; sprintf(old_name,"%s2-%lx-%lx", tmp_file_prefix, current_pid, thd->thread_id); - if (new_name != table_name) + if (new_name != table_name || new_db != db) { if (!access(new_name_buff,F_OK)) { @@ -1738,7 +1738,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 - 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 if (close_cached_table(thd,table)) diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index ba07aab2859..2dd25a57478 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1069,7 +1069,8 @@ attribute: | AUTO_INC { Lex->type|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG; } | PRIMARY_SYM KEY_SYM { Lex->type|= PRI_KEY_FLAG | NOT_NULL_FLAG; } | UNIQUE_SYM { Lex->type|= UNIQUE_FLAG; } - | UNIQUE_SYM KEY_SYM { Lex->type|= UNIQUE_KEY_FLAG; }; + | UNIQUE_SYM KEY_SYM { Lex->type|= UNIQUE_KEY_FLAG; } + | COMMENT_SYM text_literal {}; opt_binary: /* empty */ {} @@ -1203,8 +1204,7 @@ alter_list_item: lex->length,lex->dec,lex->type, lex->default_value, $3.str, lex->interval)) - YYABORT; - lex->simple_alter=0; + YYABORT; } opt_place | DROP opt_column field_ident opt_restrict @@ -1245,7 +1245,6 @@ alter_list_item: LEX *lex=Lex; lex->select->db=$3->db.str; lex->name= $3->table.str; - lex->simple_alter=0; } | create_table_options { Lex->simple_alter=0; } | order_clause { Lex->simple_alter=0; }; diff --git a/vio/test-sslserver.c b/vio/test-sslserver.c index a9e28ac7a58..f0116a2817d 100644 --- a/vio/test-sslserver.c +++ b/vio/test-sslserver.c @@ -36,12 +36,14 @@ const char *VER="0.2"; const char *default_dbug_option="d:t:O,-"; #endif +#if 0 static void fatal_error( const char* r) { perror(r); exit(0); } +#endif typedef struct { int sd; @@ -70,13 +72,13 @@ do_ssl_stuff( TH_ARGS* args) static void* client_thread( void* arg) { - my_thread_init(); - do_ssl_stuff((TH_ARGS*)arg); + my_thread_init(); + do_ssl_stuff((TH_ARGS*)arg); + return 0; } int -main( int argc __attribute__((unused)), - char** argv) +main(int argc __attribute__((unused)), char** argv) { char server_key[] = "../SSL/server-key.pem", server_cert[] = "../SSL/server-cert.pem"; |