From 669184f41ef2c6255bbea26838575bf4d3497fab Mon Sep 17 00:00:00 2001 From: "Sinisa@sinisa.nasamreza.org" <> Date: Mon, 23 Dec 2002 14:56:41 +0200 Subject: many bug fixes --- sql/log.cc | 1 + sql/mysqld.cc | 2 +- sql/sql_select.cc | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'sql') diff --git a/sql/log.cc b/sql/log.cc index b6c842e551d..ab3277fe58b 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -963,6 +963,7 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length, end=strxmov(buff, "# administrator command: ", command_name[thd->command], NullS); query_length=(ulong) (end-buff); + query=buff; } if (my_b_write(&log_file, (byte*) query,query_length) || my_b_write(&log_file, (byte*) ";\n",2) || diff --git a/sql/mysqld.cc b/sql/mysqld.cc index bd17f7339a4..ec56f2ce086 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2984,7 +2984,7 @@ CHANGEABLE_VAR changeable_vars[] = { #endif ,0, 1, 0, 1 }, { "max_allowed_packet", (long*) &max_allowed_packet, - 1024*1024L, 80, 64*1024*1024L, MALLOC_OVERHEAD, 1024 }, + 1024*1024L, 80, 255*255*255L, MALLOC_OVERHEAD, 1024 }, { "max_binlog_cache_size", (long*) &max_binlog_cache_size, ~0L, IO_SIZE, ~0L, 0, IO_SIZE }, { "max_binlog_size", (long*) &max_binlog_size, diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 3596fdc0c05..64a0f9e6df1 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2328,7 +2328,8 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) if ((tab->keys & ~ tab->const_keys && i > 0) || tab->const_keys && i == join->const_tables && - join->thd->select_limit < join->best_positions[i].records_read) + join->thd->select_limit < join->best_positions[i].records_read && + join->tables > 1) { /* Join with outer join condition */ COND *orig_cond=sel->cond; -- cgit v1.2.1 From 4833d9dd7a0f99dcc509660143c142fabdf99f0d Mon Sep 17 00:00:00 2001 From: "Sinisa@sinisa.nasamreza.org" <> Date: Fri, 27 Dec 2002 14:39:12 +0200 Subject: reverting a patch --- sql/mysqld.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/mysqld.cc b/sql/mysqld.cc index ec56f2ce086..87fb613fe88 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2984,7 +2984,7 @@ CHANGEABLE_VAR changeable_vars[] = { #endif ,0, 1, 0, 1 }, { "max_allowed_packet", (long*) &max_allowed_packet, - 1024*1024L, 80, 255*255*255L, MALLOC_OVERHEAD, 1024 }, + 1024*1024L, 80, 16L*1024L*1024L-1, MALLOC_OVERHEAD, 1024 }, { "max_binlog_cache_size", (long*) &max_binlog_cache_size, ~0L, IO_SIZE, ~0L, 0, IO_SIZE }, { "max_binlog_size", (long*) &max_binlog_size, -- cgit v1.2.1 From 0ccaf94016ad978d64d41eec47a52fc299ec11d5 Mon Sep 17 00:00:00 2001 From: "Sinisa@sinisa.nasamreza.org" <> Date: Sat, 4 Jan 2003 21:02:58 +0200 Subject: Fixing that 3.23 API / clients do not disconnect if a large packet is issued. --- sql/net_serv.cc | 22 +++++++++++++++++++--- sql/sql_select.cc | 3 +-- 2 files changed, 20 insertions(+), 5 deletions(-) (limited to 'sql') diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 2583f0767f4..c6a0b8c5b3e 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -34,13 +34,18 @@ #include #include #include +#ifdef MYSQL_SERVER +#include +#endif + +#define MAX_PACKET_LENGTH (256L*256L*256L-1) #ifdef MYSQL_SERVER ulong max_allowed_packet=65536; extern ulong net_read_timeout,net_write_timeout; extern uint test_flags; #else -ulong max_allowed_packet=16*1024*1024L-1; +ulong max_allowed_packet=MAX_PACKET_LENGTH; ulong net_read_timeout= NET_READ_TIMEOUT; ulong net_write_timeout= NET_WRITE_TIMEOUT; #endif @@ -226,6 +231,12 @@ int my_net_write(NET *net,const char *packet,ulong len) { uchar buff[NET_HEADER_SIZE]; + if (len >= MAX_PACKET_LENGTH) + { + net->error=1; + net->last_errno=ER_NET_PACKET_TOO_LARGE; + return 1; + } int3store(buff,len); buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++); if (net_write_buff(net,(char*) buff,NET_HEADER_SIZE)) @@ -238,7 +249,12 @@ net_write_command(NET *net,uchar command,const char *packet,ulong len) { uchar buff[NET_HEADER_SIZE+1]; uint length=len+1; /* 1 extra byte for command */ - + if (length >= MAX_PACKET_LENGTH) + { + net->error=1; + net->last_errno=ER_NET_PACKET_TOO_LARGE; + return 1; + } int3store(buff,length); buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++); buff[4]=command; @@ -276,7 +292,7 @@ net_real_write(NET *net,const char *packet,ulong len) int length; char *pos,*end; thr_alarm_t alarmed; -#if !defined(__WIN__) +#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) ALARM alarm_buff; #endif uint retry_count=0; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 64a0f9e6df1..3596fdc0c05 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2328,8 +2328,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) if ((tab->keys & ~ tab->const_keys && i > 0) || tab->const_keys && i == join->const_tables && - join->thd->select_limit < join->best_positions[i].records_read && - join->tables > 1) + join->thd->select_limit < join->best_positions[i].records_read) { /* Join with outer join condition */ COND *orig_cond=sel->cond; -- cgit v1.2.1 From 6b9f24be88ec99f9524c9f22f1ba3ee9d7266308 Mon Sep 17 00:00:00 2001 From: "Sinisa@sinisa.nasamreza.org" <> Date: Thu, 9 Jan 2003 23:21:20 +0200 Subject: changing a bit SHOW GRANTS to display empty row in global table. --- sql/sql_acl.cc | 2 -- 1 file changed, 2 deletions(-) (limited to 'sql') diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 1f8f25e5fb8..0d434c38e3a 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -2762,8 +2762,6 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) VOID(pthread_mutex_lock(&acl_cache->lock)); /* Add first global access grants */ - if (acl_user->access || acl_user->password || - acl_user->ssl_type != SSL_TYPE_NONE) { want_access=acl_user->access; String global(buff,sizeof(buff)); -- cgit v1.2.1 From 6b386c08a5c2c7dc3e379b1160d82da6f1688d05 Mon Sep 17 00:00:00 2001 From: "Sinisa@sinisa.nasamreza.org" <> Date: Sat, 11 Jan 2003 18:02:10 +0200 Subject: Fix for a bug in SHOW GRANTS when : grant on database.* to xx@yy with grant option; is done. --- sql/item.cc | 2 +- sql/sql_acl.cc | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/item.cc b/sql/item.cc index ec9b07c443c..03b6585f6f0 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -505,7 +505,7 @@ bool Item::save_in_field(Field *field, bool no_conversions) { double nr=val(); if (null_value) - return set_field_to_null(field); + return set_field_to_null_with_conversions(field, no_conversions); field->set_notnull(); field->store(nr); } diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 0d434c38e3a..a9bb22fb8f7 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -2894,6 +2894,8 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) if (test_all_bits(want_access,(DB_ACLS & ~GRANT_ACL))) db.append("ALL PRIVILEGES",14); + else if (!(want_access & ~GRANT_ACL)) + db.append("USAGE",5); else { int found=0, cnt; -- cgit v1.2.1 From 6f753e37d19c39e55b2c6cc983d061a4797a6dd0 Mon Sep 17 00:00:00 2001 From: "Sinisa@sinisa.nasamreza.org" <> Date: Mon, 13 Jan 2003 22:36:50 +0200 Subject: Fix for a crashing bug in send_data.. --- sql/net_pkg.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'sql') diff --git a/sql/net_pkg.cc b/sql/net_pkg.cc index 30cad3a4177..2ce811157af 100644 --- a/sql/net_pkg.cc +++ b/sql/net_pkg.cc @@ -283,8 +283,13 @@ bool net_store_data(String *packet,const char *from,uint length) { ulong packet_length=packet->length(); - if (packet_length+5+length > packet->alloced_length() && - packet->realloc(packet_length+5+length)) +/* + We have added net5store in net_store_length. + Before that largest size was int3store. + Therefore +5 is changed to +9 +*/ + if (packet_length+9+length > packet->alloced_length() && + packet->realloc(packet_length+9+length)) return 1; char *to=(char*) net_store_length((char*) packet->ptr()+packet_length, (ulonglong) length); @@ -300,8 +305,8 @@ net_store_data(String *packet,const char *from) { uint length=(uint) strlen(from); uint packet_length=packet->length(); - if (packet_length+5+length > packet->alloced_length() && - packet->realloc(packet_length+5+length)) + if (packet_length+9+length > packet->alloced_length() && + packet->realloc(packet_length+9+length)) return 1; char *to=(char*) net_store_length((char*) packet->ptr()+packet_length, length); -- cgit v1.2.1 From 2325a5f60078f6d3f50412a6b6191ee7d86e9402 Mon Sep 17 00:00:00 2001 From: "Sinisa@sinisa.nasamreza.org" <> Date: Tue, 14 Jan 2003 16:15:09 +0200 Subject: reverting a fix --- sql/item.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/item.cc b/sql/item.cc index 03b6585f6f0..ec9b07c443c 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -505,7 +505,7 @@ bool Item::save_in_field(Field *field, bool no_conversions) { double nr=val(); if (null_value) - return set_field_to_null_with_conversions(field, no_conversions); + return set_field_to_null(field); field->set_notnull(); field->store(nr); } -- cgit v1.2.1 From ff4ef4c4e7d51421cfde0016148eda935f65cd4e Mon Sep 17 00:00:00 2001 From: "heikki@hundin.mysql.fi" <> Date: Tue, 21 Jan 2003 00:38:55 +0200 Subject: ha_innodb.cc: Convert TL_READ_NO_INSERT to TL_READ to allow concurrent inserts to the table in INSERT INTO ... SELECT ... FROM table --- sql/ha_innodb.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sql') diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index b4fe6130e9b..b1cb45be6b3 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -4166,6 +4166,16 @@ ha_innobase::store_lock( lock_type = TL_WRITE_ALLOW_WRITE; } + /* In queries of type INSERT INTO t1 SELECT ... FROM t2 ... + MySQL would use the lock TL_READ_NO_INSERT on t2, and that + would conflict with TL_WRITE_ALLOW_WRITE, blocking all inserts + to t2. Convert the lock to a normal read lock to allow + concurrent inserts to t2. */ + + if (lock_type == TL_READ_NO_INSERT && !thd->in_lock_tables) { + lock_type = TL_READ; + } + lock.type=lock_type; } -- cgit v1.2.1 From d3145a91357472463da3f94cd3de79bb1a5df4e8 Mon Sep 17 00:00:00 2001 From: "heikki@hundin.mysql.fi" <> Date: Tue, 21 Jan 2003 00:44:49 +0200 Subject: ha_innobase.cc: Backport from 4.0: convert TL_READ_NO_INSERT to TL_READ to allow concurrent inserts to the table in INSERT INTO ... SELECT ... FROM table --- sql/ha_innobase.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sql') diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index 19ec6a9bb06..7045e5c31d5 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -3718,6 +3718,16 @@ ha_innobase::store_lock( lock_type = TL_WRITE_ALLOW_WRITE; } + /* In queries of type INSERT INTO t1 SELECT ... FROM t2 ... + MySQL would use the lock TL_READ_NO_INSERT on t2, and that + would conflict with TL_WRITE_ALLOW_WRITE, blocking all inserts + to t2. Convert the lock to a normal read lock to allow + concurrent inserts to t2. */ + + if (lock_type == TL_READ_NO_INSERT && !thd->in_lock_tables) { + lock_type = TL_READ; + } + lock.type=lock_type; } -- cgit v1.2.1 From f028989badb3623caff424b05c9cc81c95be9da7 Mon Sep 17 00:00:00 2001 From: "serg@serg.mysql.com" <> Date: Tue, 21 Jan 2003 16:07:31 +0100 Subject: fixed double-free bug in COM_CHANGE_USER --- sql/sql_parse.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index d8a4a5fee83..d11548a62e2 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -793,6 +793,7 @@ bool do_command(THD *thd) char *save_user= thd->user; char *save_priv_user= thd->priv_user; char *save_db= thd->db; + thd->user=0; if ((uint) ((uchar*) db - net->read_pos) > packet_length) { // Check if protocol is ok @@ -802,7 +803,6 @@ bool do_command(THD *thd) if (check_user(thd, COM_CHANGE_USER, user, passwd, db, 0)) { // Restore old user x_free(thd->user); - x_free(thd->db); thd->master_access=save_master_access; thd->db_access=save_db_access; thd->db=save_db; -- cgit v1.2.1 From 274df581180e62eddaee716e3d1c39eebbb37ee4 Mon Sep 17 00:00:00 2001 From: "serg@serg.mysql.com" <> Date: Thu, 23 Jan 2003 13:20:37 +0100 Subject: --ft_stopword_file command-line option --- sql/mysqld.cc | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'sql') diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 46fbee0a7ea..5ddeb642340 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2072,8 +2072,8 @@ int main(int argc, char **argv) #endif if (opt_myisam_log) - (void) mi_log( 1 ); - ft_init_stopwords(ft_precompiled_stopwords); + (void) mi_log(1); + ft_init_stopwords(); #ifdef __WIN__ if (!opt_console) @@ -2929,7 +2929,7 @@ enum options { OPT_CONNECT_TIMEOUT, OPT_DELAYED_INSERT_TIMEOUT, OPT_DELAYED_INSERT_LIMIT, OPT_DELAYED_QUEUE_SIZE, OPT_FLUSH_TIME, OPT_FT_MIN_WORD_LEN, - OPT_FT_MAX_WORD_LEN, OPT_FT_MAX_WORD_LEN_FOR_SORT, + OPT_FT_MAX_WORD_LEN, OPT_FT_MAX_WORD_LEN_FOR_SORT, OPT_FT_STOPWORD_FILE, OPT_INTERACTIVE_TIMEOUT, OPT_JOIN_BUFF_SIZE, OPT_KEY_BUFFER_SIZE, OPT_LONG_QUERY_TIME, OPT_LOWER_CASE_TABLE_NAMES, OPT_MAX_ALLOWED_PACKET, @@ -3415,7 +3415,8 @@ struct my_option my_long_options[] = (gptr*) &max_system_variables.log_warnings, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, { "back_log", OPT_BACK_LOG, - "The number of outstanding connection requests MySQL can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time.", (gptr*) &back_log, (gptr*) &back_log, 0, GET_ULONG, + "The number of outstanding connection requests MySQL can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time.", + (gptr*) &back_log, (gptr*) &back_log, 0, GET_ULONG, REQUIRED_ARG, 50, 1, 65535, 0, 1, 0 }, #ifdef HAVE_BERKELEY_DB { "bdb_cache_size", OPT_BDB_CACHE_SIZE, @@ -3468,9 +3469,13 @@ struct my_option my_long_options[] = (gptr*) &ft_max_word_len, (gptr*) &ft_max_word_len, 0, GET_ULONG, REQUIRED_ARG, HA_FT_MAXLEN, 10, HA_FT_MAXLEN, 0, 1, 0}, { "ft_max_word_len_for_sort", OPT_FT_MAX_WORD_LEN_FOR_SORT, - "Undocumented", (gptr*) &ft_max_word_len_for_sort, - (gptr*) &ft_max_word_len_for_sort, 0, GET_ULONG, REQUIRED_ARG, 20, 4, - HA_FT_MAXLEN, 0, 1, 0}, + "The maximum length of the word for repair_by_sorting. Longer words are included the slow way. The lower this value, the more words will be put in one sort bucket.", + (gptr*) &ft_max_word_len_for_sort, (gptr*) &ft_max_word_len_for_sort, 0, GET_ULONG, + REQUIRED_ARG, 20, 4, HA_FT_MAXLEN, 0, 1, 0}, + { "ft_stopword_file", OPT_FT_STOPWORD_FILE, + "Use stopwords from this file instead of built-in list.", + (gptr*) &ft_stopword_file, (gptr*) &ft_stopword_file, 0, GET_STR, + REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_INNOBASE_DB {"innodb_mirrored_log_groups", OPT_INNODB_MIRRORED_LOG_GROUPS, "Number of identical copies of log groups we keep for the database. Currently this should be set to 1.", -- cgit v1.2.1 From a90a0cc96675cd8e83b01ee12f6c10c3c7a3b3a0 Mon Sep 17 00:00:00 2001 From: "Sinisa@sinisa.nasamreza.org" <> Date: Thu, 23 Jan 2003 15:49:56 +0200 Subject: small fix for SHOW STATUS --- sql/mysqld.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sql') diff --git a/sql/mysqld.cc b/sql/mysqld.cc index e2adc1a068e..acbc09c0f68 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3278,8 +3278,8 @@ struct show_var_st status_vars[]= { {"Not_flushed_key_blocks", (char*) &_my_blocks_changed, SHOW_LONG_CONST}, {"Not_flushed_delayed_rows", (char*) &delayed_rows_in_use, SHOW_LONG_CONST}, {"Open_tables", (char*) 0, SHOW_OPENTABLES}, - {"Open_files", (char*) &my_file_opened, SHOW_INT_CONST}, - {"Open_streams", (char*) &my_stream_opened, SHOW_INT_CONST}, + {"Open_files", (char*) &my_file_opened, SHOW_LONG_CONST}, + {"Open_streams", (char*) &my_stream_opened, SHOW_LONG_CONST}, {"Opened_tables", (char*) &opened_tables, SHOW_LONG}, {"Questions", (char*) 0, SHOW_QUESTION}, {"Select_full_join", (char*) &select_full_join_count, SHOW_LONG}, -- cgit v1.2.1 From 9ec97f2c08fbc022d597e30e249ae403b467dc6b Mon Sep 17 00:00:00 2001 From: "bell@sanja.is.com.ua" <> Date: Fri, 24 Jan 2003 01:54:39 +0200 Subject: fixed table invalidation in simple renaming --- sql/sql_table.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sql') diff --git a/sql/sql_table.cc b/sql/sql_table.cc index c04b4871b4d..a763d6b6b91 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1432,6 +1432,8 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, } send_ok(&thd->net); } + table_list->table=0; // For query cache + query_cache_invalidate3(thd, table_list, 0); DBUG_RETURN(error); } -- cgit v1.2.1 From fa7a94ed14f0bdd39b99abfca872444fdb5fff11 Mon Sep 17 00:00:00 2001 From: "monty@mashka.mysql.fi" <> Date: Sat, 25 Jan 2003 15:07:51 +0200 Subject: Added timeout for wait_for_master_pos Fixed comparision of log-binary name to handle comparison when file name extension wraps from .999 to .1000 Don't replicate CREATE/DROP DATABASE if wild_xxx_table=database.% is used. --- sql/item_create.cc | 6 -- sql/item_create.h | 1 - sql/item_func.cc | 5 +- sql/item_func.h | 3 +- sql/lex.h | 3 +- sql/slave.cc | 274 ++++++++++++++++++++++++++++++++++++++++++++++------- sql/slave.h | 4 +- sql/sql_parse.cc | 23 +++++ sql/sql_repl.cc | 21 ++-- sql/sql_yacc.yy | 11 +++ 10 files changed, 291 insertions(+), 60 deletions(-) (limited to 'sql') diff --git a/sql/item_create.cc b/sql/item_create.cc index c6fca1c01e1..d2454a7fc7e 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -424,12 +424,6 @@ Item *create_load_file(Item* a) return new Item_load_file(a); } -Item *create_wait_for_master_pos(Item* a, Item* b) -{ - current_thd->safe_to_cache_query=0; - return new Item_master_pos_wait(a, b); -} - Item *create_func_cast(Item *a, Item_cast cast_type) { Item *res; diff --git a/sql/item_create.h b/sql/item_create.h index 80ef57e436a..10b404ec2fd 100644 --- a/sql/item_create.h +++ b/sql/item_create.h @@ -92,6 +92,5 @@ Item *create_func_ucase(Item* a); Item *create_func_version(void); Item *create_func_weekday(Item* a); Item *create_load_file(Item* a); -Item *create_wait_for_master_pos(Item* a, Item* b); Item *create_func_is_free_lock(Item* a); Item *create_func_quote(Item* a); diff --git a/sql/item_func.cc b/sql/item_func.cc index 20d7bffce21..78885038654 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1549,9 +1549,10 @@ longlong Item_master_pos_wait::val_int() null_value = 1; return 0; } - ulong pos = (ulong)args[1]->val_int(); + longlong pos = args[1]->val_int(); + longlong timeout = (arg_count==3) ? args[2]->val_int() : 0 ; LOCK_ACTIVE_MI; - if ((event_count = active_mi->rli.wait_for_pos(thd, log_name, pos)) == -1) + if ((event_count = active_mi->rli.wait_for_pos(thd, log_name, pos, timeout)) == -2) { null_value = 1; event_count=0; diff --git a/sql/item_func.h b/sql/item_func.h index 31310ab564e..be8ae6b57c8 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -865,9 +865,10 @@ class Item_master_pos_wait :public Item_int_func String value; public: Item_master_pos_wait(Item *a,Item *b) :Item_int_func(a,b) {} + Item_master_pos_wait(Item *a,Item *b,Item *c) :Item_int_func(a,b,c) {} longlong val_int(); const char *func_name() const { return "master_pos_wait"; } - void fix_length_and_dec() { max_length=1; maybe_null=1;} + void fix_length_and_dec() { max_length=21; maybe_null=1;} unsigned int size_of() { return sizeof(*this);} }; diff --git a/sql/lex.h b/sql/lex.h index 82ed322af83..6ebbcb44003 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -462,9 +462,8 @@ static SYMBOL sql_functions[] = { { "LOWER", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_lcase)}, { "LPAD", SYM(FUNC_ARG3),0,CREATE_FUNC(create_func_lpad)}, { "LTRIM", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ltrim)}, - { "MASTER_POS_WAIT", SYM(FUNC_ARG2),0, - CREATE_FUNC(create_wait_for_master_pos)}, { "MAKE_SET", SYM(MAKE_SET_SYM),0,0}, + { "MASTER_POS_WAIT", SYM(MASTER_POS_WAIT),0,0}, { "MAX", SYM(MAX_SYM),0,0}, { "MD5", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_md5)}, { "MID", SYM(SUBSTRING),0,0}, /* unireg function */ diff --git a/sql/slave.cc b/sql/slave.cc index 30c345f8030..839189956a1 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB +/* Copyright (C) 2000-2003 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -586,40 +586,118 @@ static TABLE_RULE_ENT* find_wild(DYNAMIC_ARRAY *a, const char* key, int len) return 0; } + +/* + Checks whether tables match some (wild_)do_table and (wild_)ignore_table + rules (for replication) + + SYNOPSIS + tables_ok() + thd thread (SQL slave thread normally) + tables list of tables to check + + NOTES + Note that changing the order of the tables in the list can lead to + different results. Note also the order of precedence of the do/ignore + rules (see code below). For that reason, users should not set conflicting + rules because they may get unpredicted results. + + RETURN VALUES + 0 should not be logged/replicated + 1 should be logged/replicated +*/ + int tables_ok(THD* thd, TABLE_LIST* tables) { + DBUG_ENTER("tables_ok"); + for (; tables; tables = tables->next) { + char hash_key[2*NAME_LEN+2]; + char *end; + uint len; + if (!tables->updating) continue; - char hash_key[2*NAME_LEN+2]; - char* p; - p = strmov(hash_key, tables->db ? tables->db : thd->db); - *p++ = '.'; - uint len = strmov(p, tables->real_name) - hash_key ; + end= strmov(hash_key, tables->db ? tables->db : thd->db); + *end++= '.'; + len= (uint) (strmov(end, tables->real_name) - hash_key); if (do_table_inited) // if there are any do's { if (hash_search(&replicate_do_table, (byte*) hash_key, len)) - return 1; + DBUG_RETURN(1); } if (ignore_table_inited) // if there are any ignores { if (hash_search(&replicate_ignore_table, (byte*) hash_key, len)) - return 0; + DBUG_RETURN(0); } if (wild_do_table_inited && find_wild(&replicate_wild_do_table, hash_key, len)) - return 1; + DBUG_RETURN(1); if (wild_ignore_table_inited && find_wild(&replicate_wild_ignore_table, hash_key, len)) - return 0; + DBUG_RETURN(0); } /* If no explicit rule found and there was a do list, do not replicate. If there was no do list, go ahead */ - return !do_table_inited && !wild_do_table_inited; + DBUG_RETURN(!do_table_inited && !wild_do_table_inited); +} + + +/* + Checks whether a db matches wild_do_table and wild_ignore_table + rules (for replication) + + SYNOPSIS + db_ok_with_wild_table() + db name of the db to check. + Is tested with check_db_name() before calling this function. + + NOTES + Here is the reason for this function. + We advise users who want to exclude a database 'db1' safely to do it + with replicate_wild_ignore_table='db1.%' instead of binlog_ignore_db or + replicate_ignore_db because the two lasts only check for the selected db, + which won't work in that case: + USE db2; + UPDATE db1.t SET ... #this will be replicated and should not + whereas replicate_wild_ignore_table will work in all cases. + With replicate_wild_ignore_table, we only check tables. When + one does 'DROP DATABASE db1', tables are not involved and the + statement will be replicated, while users could expect it would not (as it + rougly means 'DROP db1.first_table, DROP db1.second_table...'). + In other words, we want to interpret 'db1.%' as "everything touching db1". + That is why we want to match 'db1' against 'db1.%' wild table rules. + + RETURN VALUES + 0 should not be logged/replicated + 1 should be logged/replicated + */ + +int db_ok_with_wild_table(const char *db) +{ + char hash_key[NAME_LEN+2]; + char *end; + int len; + end= strmov(hash_key, db); + *end++= '.'; + len= end - hash_key ; + if (wild_do_table_inited && find_wild(&replicate_wild_do_table, + hash_key, len)) + return 1; + if (wild_ignore_table_inited && find_wild(&replicate_wild_ignore_table, + hash_key, len)) + return 0; + + /* + If no explicit rule found and there was a do list, do not replicate. + If there was no do list, go ahead + */ + return !wild_do_table_inited; } @@ -750,6 +828,21 @@ char* rewrite_db(char* db) } +/* + Checks whether a db matches some do_db and ignore_db rules + (for logging or replication) + + SYNOPSIS + db_ok() + db name of the db to check + do_list either binlog_do_db or replicate_do_db + ignore_list either binlog_ignore_db or replicate_ignore_db + + RETURN VALUES + 0 should not be logged/replicated + 1 should be logged/replicated +*/ + int db_ok(const char* db, I_List &do_list, I_List &ignore_list ) { @@ -1470,62 +1563,171 @@ bool flush_master_info(MASTER_INFO* mi) DBUG_RETURN(0); } +/* + Waits until the SQL thread reaches (has executed up to) the + log/position or timed out. + + SYNOPSIS + wait_for_pos() + thd client thread that sent SELECT MASTER_POS_WAIT + log_name log name to wait for + log_pos position to wait for + timeout timeout in seconds before giving up waiting + + NOTES + timeout is longlong whereas it should be ulong ; but this is + to catch if the user submitted a negative timeout. + + RETURN VALUES + -2 improper arguments (log_pos<0) + or slave not running, or master info changed + during the function's execution, + or client thread killed. -2 is translated to NULL by caller + -1 timed out + >=0 number of log events the function had to wait + before reaching the desired log/position + */ int st_relay_log_info::wait_for_pos(THD* thd, String* log_name, - ulonglong log_pos) + longlong log_pos, + longlong timeout) { if (!inited) return -1; int event_count = 0; ulong init_abort_pos_wait; + int error=0; + struct timespec abstime; // for timeout checking + set_timespec(abstime,timeout); + DBUG_ENTER("wait_for_pos"); - DBUG_PRINT("enter",("master_log_name: '%s' pos: %ld", - master_log_name, (ulong) master_log_pos)); + DBUG_PRINT("enter",("master_log_name: '%s' pos: %lu timeout: %ld", + master_log_name, (ulong) master_log_pos, + (long) timeout)); pthread_mutex_lock(&data_lock); - // abort only if master info changes during wait + /* + This function will abort when it notices that + some CHANGE MASTER or RESET MASTER has changed + the master info. To catch this, these commands + modify abort_pos_wait ; we just monitor abort_pos_wait + and see if it has changed. + */ init_abort_pos_wait= abort_pos_wait; + /* + We'll need to + handle all possible log names comparisons (e.g. 999 vs 1000). + We use ulong for string->number conversion ; this is no + stronger limitation than in find_uniq_filename in sql/log.cc + */ + ulong log_name_extension; + char log_name_tmp[FN_REFLEN]; //make a char[] from String + char *end= strmake(log_name_tmp, log_name->ptr(), min(log_name->length(), FN_REFLEN-1)); + char *p= fn_ext(log_name_tmp); + char *p_end; + if (!*p || log_pos<0) + { + error= -2; //means improper arguments + goto err; + } + //p points to '.' + log_name_extension= strtoul(++p, &p_end, 10); + /* + p_end points to the first invalid character. + If it equals to p, no digits were found, error. + If it contains '\0' it means conversion went ok. + */ + if (p_end==p || *p_end) + { + error= -2; + goto err; + } + + //"compare and wait" main loop while (!thd->killed && - init_abort_pos_wait == abort_pos_wait && - mi->slave_running) + init_abort_pos_wait == abort_pos_wait && + mi->slave_running) { bool pos_reached; int cmp_result= 0; DBUG_ASSERT(*master_log_name || master_log_pos == 0); if (*master_log_name) { + char *basename= master_log_name + dirname_length(master_log_name); /* - TODO: - Replace strncmp() with a comparison function that - can handle comparison of the following files: - mysqlbin.999 - mysqlbin.1000 + First compare the parts before the extension. + Find the dot in the master's log basename, + and protect against user's input error : + if the names do not match up to '.' included, return error */ - char *basename= master_log_name + dirname_length(master_log_name); - cmp_result = strncmp(basename, log_name->ptr(), - log_name->length()); + char *q= (char*)(fn_ext(basename)+1); + if (strncmp(basename, log_name_tmp, (int)(q-basename))) + { + error= -2; + break; + } + // Now compare extensions. + char *q_end; + ulong master_log_name_extension= strtoul(q, &q_end, 10); + if (master_log_name_extension < log_name_extension) + cmp_result = -1 ; + else + cmp_result= (master_log_name_extension > log_name_extension) ? 1 : 0 ; } - pos_reached = ((!cmp_result && master_log_pos >= log_pos) || - cmp_result > 0); + pos_reached = ((!cmp_result && master_log_pos >= (ulonglong)log_pos) || + cmp_result > 0); if (pos_reached || thd->killed) break; + + //wait for master update, with optional timeout. DBUG_PRINT("info",("Waiting for master update")); const char* msg = thd->enter_cond(&data_cond, &data_lock, - "Waiting for master update"); - pthread_cond_wait(&data_cond, &data_lock); + "Waiting for master update"); + if (timeout > 0) + { + /* + Note that pthread_cond_timedwait checks for the timeout + before for the condition ; i.e. it returns ETIMEDOUT + if the system time equals or exceeds the time specified by abstime + before the condition variable is signaled or broadcast, _or_ if + the absolute time specified by abstime has already passed at the time + of the call. + For that reason, pthread_cond_timedwait will do the "timeoutting" job + even if its condition is always immediately signaled (case of a loaded + master). + */ + error=pthread_cond_timedwait(&data_cond, &data_lock, &abstime); + } + else + pthread_cond_wait(&data_cond, &data_lock); thd->exit_cond(msg); + if (error == ETIMEDOUT || error == ETIME) + { + error= -1; + break; + } + else + error=0; event_count++; } + +err: pthread_mutex_unlock(&data_lock); - DBUG_PRINT("exit",("killed: %d abort: %d slave_running: %d", - (int) thd->killed, - (int) (init_abort_pos_wait != abort_pos_wait), - (int) mi->slave_running)); - DBUG_RETURN((thd->killed || init_abort_pos_wait != abort_pos_wait || - !mi->slave_running) ? - -1 : event_count); + DBUG_PRINT("exit",("killed: %d abort: %d slave_running: %d \ +improper_arguments: %d timed_out: %d", + (int) thd->killed, + (int) (init_abort_pos_wait != abort_pos_wait), + (int) mi->slave_running, + (int) (error == -2), + (int) (error == -1))); + if (thd->killed || init_abort_pos_wait != abort_pos_wait || + !mi->slave_running) + { + error= -2; + } + DBUG_RETURN( error ? error : event_count ); } diff --git a/sql/slave.h b/sql/slave.h index cb368ad26b1..72ddcd8b471 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -226,7 +226,8 @@ typedef struct st_relay_log_info pthread_mutex_unlock(&data_lock); } - int wait_for_pos(THD* thd, String* log_name, ulonglong log_pos); + int wait_for_pos(THD* thd, String* log_name, longlong log_pos, + longlong timeout); } RELAY_LOG_INFO; @@ -390,6 +391,7 @@ int tables_ok(THD* thd, TABLE_LIST* tables); */ int db_ok(const char* db, I_List &do_list, I_List &ignore_list ); +int db_ok_with_wild_table(const char *db); int add_table_rule(HASH* h, const char* table_spec); int add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 0b6170f1e37..4a7fc78ee7f 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2253,6 +2253,18 @@ mysql_execute_command(void) } if (lower_case_table_names) casedn_str(lex->name); + /* + If in a slave thread : + CREATE DATABASE DB was certainly not preceded by USE DB. + For that reason, db_ok() in sql/slave.cc did not check the + do_db/ignore_db. And as this query involves no tables, tables_ok() + above was not called. So we have to check rules again here. + */ + if (thd->slave_thread && + (!db_ok(lex->name, replicate_do_db, replicate_ignore_db) || + !db_ok_with_wild_table(lex->name))) + break; + if (check_access(thd,CREATE_ACL,lex->name,0,1)) break; res=mysql_create_db(thd,lex->name,lex->create_info.options,0); @@ -2267,6 +2279,17 @@ mysql_execute_command(void) } if (lower_case_table_names) casedn_str(lex->name); + /* + If in a slave thread : + DROP DATABASE DB may not be preceded by USE DB. + For that reason, maybe db_ok() in sql/slave.cc did not check the + do_db/ignore_db. And as this query involves no tables, tables_ok() + above was not called. So we have to check rules again here. + */ + if (thd->slave_thread && + (!db_ok(lex->name, replicate_do_db, replicate_ignore_db) || + !db_ok_with_wild_table(lex->name))) + break; if (check_access(thd,DROP_ACL,lex->name,0,1)) break; if (thd->locked_tables || thd->active_transaction()) diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 02440f511e1..6a14a7c5d16 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -925,18 +925,17 @@ int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1, const char* log_file_name2, ulonglong log_pos2) { int res; - /* - TODO: Change compare function to work with file name of type - '.999 and .1000' - */ + uint log_file_name1_len= strlen(log_file_name1); + uint log_file_name2_len= strlen(log_file_name2); - if ((res = strcmp(log_file_name1, log_file_name2))) - return res; - if (log_pos1 > log_pos2) - return 1; - else if (log_pos1 == log_pos2) - return 0; - return -1; + // We assume that both log names match up to '.' + if (log_file_name1_len == log_file_name2_len) + { + if ((res= strcmp(log_file_name1, log_file_name2))) + return res; + return (log_pos1 < log_pos2) ? -1 : (log_pos1 == log_pos2) ? 0 : 1; + } + return ((log_file_name1_len < log_file_name2_len) ? -1 : 1); } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 0e93f048406..f09aac1b357 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -426,6 +426,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %token LEFT %token LOCATE %token MAKE_SET_SYM +%token MASTER_POS_WAIT %token MINUTE_SECOND_SYM %token MINUTE_SYM %token MODE_SYM @@ -1855,6 +1856,16 @@ simple_expr: { $$= new Item_func_log($3); } | LOG_SYM '(' expr ',' expr ')' { $$= new Item_func_log($3, $5); } + | MASTER_POS_WAIT '(' expr ',' expr ')' + { + $$= new Item_master_pos_wait($3, $5); + current_thd->safe_to_cache_query=0; + } + | MASTER_POS_WAIT '(' expr ',' expr ',' expr ')' + { + $$= new Item_master_pos_wait($3, $5, $7); + current_thd->safe_to_cache_query=0; + } | MINUTE_SYM '(' expr ')' { $$= new Item_func_minute($3); } | MONTH_SYM '(' expr ')' -- cgit v1.2.1 From 4b61ba5a8918b05903ac4432e254113523054591 Mon Sep 17 00:00:00 2001 From: "serg@serg.mysql.com" <> Date: Mon, 27 Jan 2003 11:15:54 +0100 Subject: ft_stopword_file added to 'SHOW VARIABLES' output --- sql/set_var.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/set_var.cc b/sql/set_var.cc index 8e0baa234da..9976f13a469 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -411,10 +411,11 @@ struct show_var_st init_vars[]= { {sys_delayed_queue_size.name,(char*) &sys_delayed_queue_size, SHOW_SYS}, {sys_flush.name, (char*) &sys_flush, SHOW_SYS}, {sys_flush_time.name, (char*) &sys_flush_time, SHOW_SYS}, + {"ft_boolean_syntax", (char*) ft_boolean_syntax, SHOW_CHAR}, {"ft_min_word_len", (char*) &ft_min_word_len, SHOW_LONG}, {"ft_max_word_len", (char*) &ft_max_word_len, SHOW_LONG}, {"ft_max_word_len_for_sort",(char*) &ft_max_word_len_for_sort, SHOW_LONG}, - {"ft_boolean_syntax", (char*) ft_boolean_syntax, SHOW_CHAR}, + {"ft_stopword_file", (char*) &ft_stopword_file, SHOW_CHAR}, {"have_bdb", (char*) &have_berkeley_db, SHOW_HAVE}, {"have_innodb", (char*) &have_innodb, SHOW_HAVE}, {"have_isam", (char*) &have_isam, SHOW_HAVE}, -- cgit v1.2.1 From 5f6b6fa3b361bec35e604fccbd93ed2cc9c76191 Mon Sep 17 00:00:00 2001 From: "serg@serg.mysql.com" <> Date: Mon, 27 Jan 2003 12:12:12 +0100 Subject: fixes for SHOW VARIABLES and --ft-stopword-list --- sql/set_var.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/set_var.cc b/sql/set_var.cc index 9976f13a469..a7692cbe73a 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -415,7 +415,7 @@ struct show_var_st init_vars[]= { {"ft_min_word_len", (char*) &ft_min_word_len, SHOW_LONG}, {"ft_max_word_len", (char*) &ft_max_word_len, SHOW_LONG}, {"ft_max_word_len_for_sort",(char*) &ft_max_word_len_for_sort, SHOW_LONG}, - {"ft_stopword_file", (char*) &ft_stopword_file, SHOW_CHAR}, + {"ft_stopword_file", (char*) &ft_stopword_file, SHOW_CHAR_PTR}, {"have_bdb", (char*) &have_berkeley_db, SHOW_HAVE}, {"have_innodb", (char*) &have_innodb, SHOW_HAVE}, {"have_isam", (char*) &have_isam, SHOW_HAVE}, -- cgit v1.2.1 From 82aca82da0c382ca0cc34549011fd47bd2502412 Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Mon, 27 Jan 2003 13:44:16 +0100 Subject: - added a dummy file "reservedwords.texi" to the BK tree and the Makefiles, so it's part of the distribution (manual.texi includes this file) It will be replaced with the correct one from the mysqldoc tree before building the distribution - removed generation and inclusion of MIRRORS file, since the mirror list is no longer part of manual.texi anyway - replaced YFLAGS with AM_YFLAGS in sql/Makefile.am to make automake happy - Redirect standard error when checking for dpkg-architecture in ltconfig to avoid error message showing during configuration --- sql/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/Makefile.am b/sql/Makefile.am index 659633727ae..17930242dc4 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -91,7 +91,7 @@ DEFS = -DMYSQL_SERVER \ # Don't put lex_hash.h in BUILT_SOURCES as this will give infinite recursion BUILT_SOURCES = sql_yacc.cc sql_yacc.h EXTRA_DIST = udf_example.cc $(BUILT_SOURCES) -YFLAGS = -d +AM_YFLAGS = -d link_sources: rm -f mini_client_errors.c -- cgit v1.2.1 From 826993bba2c8e0ecb12e480b79e7eb952b790bec Mon Sep 17 00:00:00 2001 From: "Administrador@light." <> Date: Mon, 27 Jan 2003 15:37:25 -0200 Subject: Added option hostname.err --- sql/log.cc | 46 ++++++++++++++++++++++++++++++++++++++++++++++ sql/mysql_priv.h | 4 ++++ sql/mysqld.cc | 29 +++++++++++++++++++++++++---- sql/set_var.cc | 1 + sql/sql_parse.cc | 2 ++ 5 files changed, 78 insertions(+), 4 deletions(-) (limited to 'sql') diff --git a/sql/log.cc b/sql/log.cc index 58f5298dad0..df39adf1cbe 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1568,3 +1568,49 @@ void sql_perror(const char *message) perror(message); #endif } + +bool flush_error_log() +{ + bool result=0; + if (log_error_file[0] != '\0') /* --log-error="" */ + { + char err_renamed[FN_REFLEN], *end; + end= strmake(err_renamed,log_error_file,FN_REFLEN-4); + strmov(end, "-old"); +#ifdef __WIN__ + char err_temp[FN_REFLEN+4]; + /* + On Windows is necessary a temporary file for to rename + the current error file. + */ + strmov(strmov(err_temp, err_renamed),"-tmp"); + (void) my_delete(err_temp, MYF(0)); + if (freopen(err_temp,"a+",stdout)) + { + freopen(err_temp,"a+",stderr); + (void) my_delete(err_renamed, MYF(0)); + my_rename(log_error_file,err_renamed,MYF(0)); + if (freopen(log_error_file,"a+",stdout)) + freopen(log_error_file,"a+",stderr); + int fd, bytes; + char buf[IO_SIZE]; + if ((fd = my_open(err_temp, O_RDONLY, MYF(0))) >= 0) + { + while ((bytes = (int) my_read(fd, (byte*) buf, IO_SIZE, MYF(0))) > 0) + my_fwrite(stderr, (byte*) buf, (uint) strlen(buf),MYF(0)); + my_close(fd, MYF(0)); + } + (void) my_delete(err_temp, MYF(0)); + } + else + result= 1; +#else + my_rename(log_error_file,err_renamed,MYF(0)); + if (freopen(log_error_file,"a+",stdout)) + freopen(log_error_file,"a+",stderr); + else + result= 1; +#endif + } + return result; +} diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 75bf4e97634..5a957514d28 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -627,6 +627,7 @@ extern uchar *days_in_month; extern char language[LIBLEN],reg_ext[FN_EXTLEN]; extern char glob_hostname[FN_REFLEN], mysql_home[FN_REFLEN]; extern char pidfile_name[FN_REFLEN], time_zone[30], *opt_init_file; +extern char log_error_file[FN_REFLEN]; extern char blob_newline; extern double log_10[32]; extern ulonglong keybuff_size; @@ -813,6 +814,9 @@ extern int sql_cache_hit(THD *thd, char *inBuf, uint length); /* item.cc */ Item *get_system_var(enum_var_type var_type, LEX_STRING name); +/* log.cc */ +bool flush_error_log(void); + /* Some inline functions for more speed */ inline bool add_item_to_list(Item *item) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 5ddeb642340..24576ddbc9f 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -262,6 +262,7 @@ my_bool opt_reckless_slave = 0; ulong back_log, connect_timeout, concurrency; char mysql_home[FN_REFLEN], pidfile_name[FN_REFLEN], time_zone[30]; +char log_error_file[FN_REFLEN]; bool opt_log, opt_update_log, opt_bin_log, opt_slow_log; bool opt_disable_networking=0, opt_skip_show_db=0; my_bool opt_enable_named_pipe= 0; @@ -278,6 +279,7 @@ static my_string opt_logname=0,opt_update_logname=0, static char* mysql_home_ptr= mysql_home; static char* pidfile_name_ptr= pidfile_name; +char* log_error_file_ptr= log_error_file; static pthread_t select_thread; static my_bool opt_noacl=0, opt_bootstrap=0, opt_myisam_log=0; my_bool opt_safe_user_create = 0, opt_no_mix_types = 0; @@ -2042,13 +2044,28 @@ int main(int argc, char **argv) open_log(&mysql_slow_log, glob_hostname, opt_slow_logname, "-slow.log", NullS, LOG_NORMAL); #ifdef __WIN__ -#define MYSQL_ERR_FILE "mysql.err" if (!opt_console) { - freopen(MYSQL_ERR_FILE,"a+",stdout); - freopen(MYSQL_ERR_FILE,"a+",stderr); +#endif + if (log_error_file_ptr != log_error_file) + strmake(log_error_file, log_error_file_ptr, sizeof(log_error_file)); + else + { + char *end; + uint length= ((end=strmake(log_error_file, + mysql_real_data_home, + FN_REFLEN-5)) - + log_error_file); + *strxnmov(end, sizeof(log_error_file)-length-1, + glob_hostname, ".err", NullS)= '\0'; + } + if (log_error_file[0] != '\0') + if (freopen(log_error_file, "a+", stdout)) + freopen(log_error_file, "a+", stderr); +#ifdef __WIN__ } #endif + if (ha_init()) { sql_print_error("Can't init databases"); @@ -2964,7 +2981,8 @@ enum options { OPT_INNODB_FORCE_RECOVERY, OPT_BDB_CACHE_SIZE, OPT_BDB_LOG_BUFFER_SIZE, - OPT_BDB_MAX_LOCK + OPT_BDB_MAX_LOCK, + OPT_ERROR_LOG_FILE }; @@ -3253,6 +3271,9 @@ struct my_option my_long_options[] = {"pid-file", OPT_PID_FILE, "Pid file used by safe_mysqld", (gptr*) &pidfile_name_ptr, (gptr*) &pidfile_name_ptr, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"log-error", OPT_ERROR_LOG_FILE, "Log error file", + (gptr*) &log_error_file_ptr, (gptr*) &log_error_file_ptr, 0, GET_STR, + REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection.", (gptr*) &mysql_port, (gptr*) &mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"reckless-slave", OPT_RECKLESS_SLAVE, "For debugging", 0, 0, 0, GET_NO_ARG, diff --git a/sql/set_var.cc b/sql/set_var.cc index a7692cbe73a..b4e243019bc 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -491,6 +491,7 @@ struct show_var_st init_vars[]= { {sys_net_write_timeout.name,(char*) &sys_net_write_timeout, SHOW_SYS}, {"open_files_limit", (char*) &open_files_limit, SHOW_LONG}, {"pid_file", (char*) pidfile_name, SHOW_CHAR}, + {"log_error", (char*) log_error_file, SHOW_CHAR}, {"port", (char*) &mysql_port, SHOW_INT}, {"protocol_version", (char*) &protocol_version, SHOW_INT}, {sys_read_buff_size.name, (char*) &sys_read_buff_size, SHOW_SYS}, diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 0b6170f1e37..1778fca8019 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3407,6 +3407,8 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables) mysql_slow_log.new_file(1); if (ha_flush_logs()) result=1; + if (flush_error_log()) + result=1; } #ifdef HAVE_QUERY_CACHE if (options & REFRESH_QUERY_CACHE_FREE) -- cgit v1.2.1 From 78f492b112cd1aa54d862ee4d2bdd6d8902c302b Mon Sep 17 00:00:00 2001 From: "serg@serg.mysql.com" <> Date: Tue, 28 Jan 2003 00:55:41 +0100 Subject: do not force CONNECTION_ID(), FOUND_ROWS(), PI(), CURRENT_USER(), and VERSION() to be uppercase in e.g. "select pi()" --- sql/item_create.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sql') diff --git a/sql/item_create.cc b/sql/item_create.cc index c6fca1c01e1..f298a3e08d1 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -77,7 +77,7 @@ Item *create_func_connection_id(void) { THD *thd=current_thd; thd->safe_to_cache_query=0; - return new Item_int("CONNECTION_ID()",(longlong) thd->thread_id,10); + return new Item_int(NullS,(longlong) thd->thread_id,10); } Item *create_func_conv(Item* a, Item *b, Item *c) @@ -145,7 +145,7 @@ Item *create_func_found_rows(void) { THD *thd=current_thd; thd->safe_to_cache_query=0; - return new Item_int("FOUND_ROWS()",(longlong) thd->found_rows(),21); + return new Item_int(NullS,(longlong) thd->found_rows(),21); } Item *create_func_from_days(Item* a) @@ -283,7 +283,7 @@ Item *create_func_period_diff(Item* a, Item *b) Item *create_func_pi(void) { - return new Item_real("PI()",M_PI,6,8); + return new Item_real(NullS,M_PI,6,8); } Item *create_func_pow(Item* a, Item *b) @@ -299,7 +299,7 @@ Item *create_func_current_user() length= (uint) (strxmov(buff, thd->priv_user, "@", thd->host_or_ip, NullS) - buff); - return new Item_string("CURRENT_USER()", thd->memdup(buff, length), length); + return new Item_string(NullS, thd->memdup(buff, length), length); } Item *create_func_quarter(Item* a) @@ -405,7 +405,7 @@ Item *create_func_ucase(Item* a) Item *create_func_version(void) { - return new Item_string("VERSION()",server_version, strlen(server_version)); + return new Item_string(NullS,server_version, strlen(server_version)); } Item *create_func_weekday(Item* a) -- cgit v1.2.1 From 710ffb2d89a05ae723de98170b66a80f2f79beef Mon Sep 17 00:00:00 2001 From: "monty@mashka.mysql.fi" <> Date: Tue, 28 Jan 2003 06:48:26 +0200 Subject: Fix when using auto_increment and last_insert_id() in the same insert statement. --- sql/log.cc | 2 +- sql/sql_base.cc | 19 ++++++------------- 2 files changed, 7 insertions(+), 14 deletions(-) (limited to 'sql') diff --git a/sql/log.cc b/sql/log.cc index ab3277fe58b..5e5d5b9368e 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -697,7 +697,7 @@ bool MYSQL_LOG::write(Query_log_event* event_info) if (thd->last_insert_id_used) { - Intvar_log_event e((uchar)LAST_INSERT_ID_EVENT, thd->last_insert_id); + Intvar_log_event e((uchar)LAST_INSERT_ID_EVENT, thd->current_insert_id); if(thd->server_id) e.server_id = thd->server_id; if (e.write(file)) diff --git a/sql/sql_base.cc b/sql/sql_base.cc index fb120442385..bab4c151ef3 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -522,26 +522,19 @@ void close_temporary_tables(THD *thd) { TABLE *table,*next; char *query, *end; - const uint init_query_buf_size = 11; // "drop table " uint query_buf_size; bool found_user_tables = 0; - LINT_INIT(end); - query_buf_size = init_query_buf_size; - - for (table=thd->temporary_tables ; table ; table=table->next) - { - query_buf_size += table->key_length; - } - if (query_buf_size == init_query_buf_size) + if (!thd->temporary_tables) return; // no tables to close + query_buf_size= 11; // "drop table " + for (table=thd->temporary_tables ; table ; table=table->next) + query_buf_size+= table->key_length +1; + if ((query = alloc_root(&thd->mem_root, query_buf_size))) - { - memcpy(query, "drop table ", init_query_buf_size); - end = query + init_query_buf_size; - } + end= strmov(query, "drop table "); for (table=thd->temporary_tables ; table ; table=next) { -- cgit v1.2.1 From 689578a0997f54c590bcf4791e30710602851bc4 Mon Sep 17 00:00:00 2001 From: "monty@mashka.mysql.fi" <> Date: Tue, 28 Jan 2003 08:38:28 +0200 Subject: Fixes for Netware Call pthread_mutex_destroy() on not used mutex. Changed comments in .h and .c files from // -> /* */ Added detection of mutex on which one didn't call pthread_mutex_destroy() Fixed bug in create_tmp_field() which causes a memory overrun in queries that uses "ORDER BY constant_expression" Added optimisation for ORDER BY NULL --- sql/ChangeLog | 3307 ------------------------------------------ sql/des_key_file.cc | 11 + sql/ha_innodb.cc | 1 + sql/ha_myisam.cc | 6 +- sql/hostname.cc | 2 + sql/item.h | 16 + sql/item_func.cc | 1 + sql/item_sum.cc | 2 +- sql/log.cc | 11 + sql/my_lock.c | 2 +- sql/mysql_priv.h | 4 +- sql/mysqld.cc | 269 +++- sql/repl_failsafe.cc | 2 +- sql/set_var.cc | 1 + sql/share/english/errmsg.txt | 2 +- sql/slave.cc | 108 +- sql/slave.h | 31 +- sql/sql_base.cc | 2 +- sql/sql_class.h | 11 +- sql/sql_insert.cc | 2 +- sql/sql_parse.cc | 10 +- sql/sql_select.cc | 44 +- sql/sql_select.h | 4 +- sql/sql_table.cc | 2 +- sql/sql_udf.cc | 5 + 25 files changed, 419 insertions(+), 3437 deletions(-) delete mode 100644 sql/ChangeLog (limited to 'sql') diff --git a/sql/ChangeLog b/sql/ChangeLog deleted file mode 100644 index a75e9761766..00000000000 --- a/sql/ChangeLog +++ /dev/null @@ -1,3307 +0,0 @@ -2000-12-07 Jeremy Cole - -* Added UPDATE ... ORDER BY ... -* Added DELETE ... ORDER BY ... - -2000-11-11 Jeremy Cole - -* Added ALTER TABLE ... ORDER BY ... - -2000-09-17 Michael Widenius - -* Added option QUICK to DELETE to tell MySQL not to balance the - trees on delete. - -2000-09-15 Michael Widenius - -* Added a thd argument to log::write() to get more speed. - -2000-09-01 Michael Widenius - -* Avoid allocation of "localhost" string. -* Changed that TIMESTAMP(X) is sometimes as string -* Release of 3.23.23 - -2000-08-21 Michael Widenius - -* Added RENAME TABLE. - -2000-08-20 Michael Widenius - -* Added memory as inline functions to THD to get them a bit faster -* Don't count entries with NULL in COUNT(DISTINCT ..) - -2000-08-08 Michael Widenius - -* Changed ALTER TABLE and LOAD DATA INFILE to create non unique, small keys - after all rows are inserted. -* Fixed use of UDF function with const arguments in WHERE clause. - -2000-07-11 Michael Widenius - -* Extended safe_mysqld; Patch by Christian Hammers - -2000-07-04 Michael Widenius - -* Changed the update log to take the query length argument; This - should make the update log \0 safe. - -2000-06-21 Michael Widenius - -* Added net_read_timeout and net_write_timeout as startup parameters to mysqld - -2000-06-19 Michael Widenius - -* Changed the copyright of MySQL to GPL and LGPL. -* Added myisampack and pack_isam to the MySQL distribution. - -2000-06-01 Michael Widenius - -* Added "FLUSH TABLES WITH READ LOCK" command - -2000-05-31 Michael Widenius - -* Added table locks to Berkeley DB. - -2000-05-28 Michael Widenius - -* Allow ON and USING with INNER JOIN. - -2000-05-23 Sasha - -* Fix that USE INDEX with 'PRIMARY' keys works. - -2000-05-20 Michael Widenius - -* Added symbolic links support for Win32. - -2000-05-19 Michael Widenius - -* Changed protocol to let client know if the server is in AUTOCOMMIT mode - and if there is a pending transaction. If there is a pending transaction - the client library will give an error before reconnecting to the server to - let the client know that the server did a rollback. - The protocol is still backward compatible with old clients -* 'kill' now works on a thread that is locked on a 'write' to a dead client. - -2000-05-18 Michael Widenius - -* unlock tables before sending last packet of SELECT ... result to client. - -2000-05-16 Michael Widenius - -* split Item_bool_func2::compare function into individual functions to get more - speed. -* Small optimizations of do_select() to get more speed. - -2000-05-15 Michael Widenius - -* CHECK will update the statistics for the keys. -* Fixed bug in REPAIR TABLE when the table was used by other threads. - -2000-05-11 Michael Widenius - -* put CREATE TEMPORARY TABLE commands in the update log. -* UPDATE IGNORE will not abort if an update gives a DUPLICATE_KEY error. -* Ensure that all fn_format() or unpack_filename() is called for all - generated filenames. - -2000-05-05 Michael Widenius - -* Added timzone variable to SHOW VARIABLES. - -2000-05-04 Michael Widenius - -* Don't write INSERT DELAYED to update log if SQL_LOG_UPDATE=0 - -2000-05-03 Michael Widenius - -* Fixed problem with REPLACE on HEAP tables. - -2000-04-26 Michael Widenius - -* Added 'Writing to net' and 'Reading from net' as 'status' to - mysqladmin processlist. - -2000-04-23 Michael Widenius - -* Added CREATE DATABASE and DROP DATABASE to the update log -* Fixed problem when doing a GROUP BY on an enum column with MANY - value combinations. -* Avoid sorting for some simple GROUP BY queries. - -2000-04-22 Michael Widenius - -* Fixed problems in update log when using LAST_INSERT_ID() to update - an table with an auto_increment key. -* New function: 'NULLIF(expr1,expr2)' - -2000-04-14 Michael Widenius - -* UPDATE and DELETE on UNIQUE keys, where the whole key is used in the WHERE - part, are now faster than before. - -* Added optimisation to skip ORDER BY parts where the order by column - is a constant expression in the WHERE part. ORDER BY will also - be skipped if ORDER BY matches a key where the key parts that are - missing in the ORDER BY is constants: - - In the following case the ORDER BY will be removed: - SELECT * FROM foo WHERE column=constant ORDER BY column; - - In the following case the first key will be used to solve the ORDER BY: - SELECT * FROM foo WHERE key_part1=const ORDER BY key_part2; - -2000-04-10 Michael Widenius - -* Changed mysql.server to wait until the pid file is deleted on stop -* Clients will automaticly be set to the same character set as the - server if one hasn't specified a character set with mysql_option() - or in the my.cnf files. - -2000-04-09 Michael Widenius - -* Release of 3.23.14 -* Fixed bug where complex CONCAT() use returned the wrong result. - -2000-04-07 Michael Widenius - -* Added some optimization to LIMIT when the used KEY matches almost all - rows in the table. (SELECT * from table where key_column > "a" LIMIT 1). -* REPLACE now honors the LOW_PRIORITY_UPDATES flag. - -2000-04-05 Michael Widenius - -* Fixed that DROP TABLE is logged in the update log. -* Fixed problem when searching on DECIMAL() key field - where the column data contained pre-zeros. - -2000-04-02 Michael Widenius - -* Fix bug in myisamchk when the auto_increment isn't the first key. - -2000-03-30 "Thimble Smith" - -* Allow DATETIME in ISO8601 format: 2000-03-12T12:00:00 - -2000-03-30 Michael Widenius - -* Added UMASK_DIR environment variable. -* Fixed problem with seek and RAID tables. - -2000-03-29 Michael Widenius - -* slow_queries log wasn't flushed on FLUSH LOGS. - -2000-03-28 Michael Widenius - -* Fix that DELETE FROM table_name; works on RAID tables. -* Fix that DROP DATABASE works correctly with RAID tables. - -2000-03-27 Michael Widenius - -* Added function CONNECTION_ID() - -2000-03-26 Michael Widenius - -* When using = on BLOB or VARCHAR BINARY keys where only a part of the column - was indexed, the whole column of the result row wasn't compared. - -2000-03-24 takeshi@SoftAgency.co.jp - -* Fix for sjis & order by - -2000-03-23 Michael Widenius - -* Added patches to allow client library to compile on BEOS. - -2000-03-16 Michael Widenius - -* Added STDCALL to some functions in libmysql that missed this. -* When running in ANSI mode, don't allow one to use columns that isn't in - the GROUP BY part. - -2000-03-14 Michael Widenius - -* Release of 3.23.13 -* Removed end space from double/float numbers in results from temporary - tables. - -2000-03-13 Michael Widenius - -* Fixed automatic removal of table locks if doing a DROP TABLE on the last - locked table. - -2000-03-13 Sasha - -* Added CHECK TABLE command. - -2000-03-12 Michael Widenius - -* Changed int2str and longlong2str to use the optimized - int10_to_str / longlong10_to_str functions. - -2000-03-09 Michael Widenius - -* Fixed bug so that mysqladmin shutdown will wait for the local server to close - down. -* Fixed a possible endless loop when calculating timestamp. - -2000-02-27 Michael Widenius - -* Release of 3.23.12 -* Changed that mysql_ping() doesn't increment the 'questions' status variable. -* Fixed that mysql -D database doesn't kill 'mysql'. - -2000-02-24 Michael Widenius - -* Only allow SHOW GRANTS if you have a privilege on the mysql - tables -* Fixed bug when storing 0 into a timestamp. - -2000-02-23 Michael Widenius - -* When doing mysqladmin shutdown on a local connection, mysqladmin now - waits until the pidfile is gone before doing an shutdown. -* Changed that the pid file is not removed until all threads have died. - -2000-02-23 Matt Wagner - -* When doing mysqladmin shutdown on a local connection, mysqladmin now - waits until the pidfile is gone before doing an shutdown. - -2000-02-23 Michael Widenius - -* Fixed problem with LEFT JOIN and key_field IS NULL. - -2000-02-23 Sasha - -* Fixed core dump with some COUNT(DISTINCT ...) queries. - -2000-02-21 Michael Widenius - -* Added options USE KEYS (key_list) and IGNORE KEYS (key_list) as - join parameters in SELECT. -* DROP of table is now done through the handler. - -2000-02-17 Michael Widenius - -* Added ANSI SQL syntax ALTER TABLE ADD (column_def1, column_def2 ...) - -2000-02-16 Michael Widenius - -* Fixed problem with optimizer that could sometimes use wrong keys - -2000-02-15 Michael Widenius - -* Fixed that GRANT/REVOKE ALL PRIVILEGES doesn't affect GRANT OPTION -* Removed extra ) from the output of SHOW GRANTS - -2000-02-13 Michael Widenius - -* Fixed problem when storing numbers in timestamps. -* Fix problem with timezones that has half hour offsets. -* Storage of numbers in timestamp columns are now faster. - -2000-02-11 Michael Widenius - -* Allow the syntax UNIQUE INDEX in CREATE statements. - -2000-02-10 Michael Widenius - -* Added options --i-am-a-dummy and --safe-updates to mysql.cc -* Added variables select_limit and max_join_size to mysql.cc -* Added sql variables: SQL_MAX_JOIN_SIZE and SQL_SAFE_UPDATES -* Added READ_LOCAL lock that doesn't lock the table for concurrent inserts -* Changed that LOCK TABLES .. READ doesn't anymore allow concurrent inserts -* Added option --skip-delay-key-write to mysqld. - -2000-02-09 Michael Widenius - -* Fixed security problem in the protocol regarding password checking. - -2000-02-03 Michael Widenius - -* Allow 'end' as a field name. -* Added _rowid as an alias for an auto_increment column. - -2000-01-28 Michael Widenius - -* Ignore empty queries in mysql when running in batch mode - (To be able to handle rows with double ';' chars). - -2000-01-27 Michael Widenius - -* Fixed problem with timestamps and INSERT DELAYED - -2000-01-26 Michael Widenius - -* Fixed problem that affected queries that did arithmetic on GROUP functions. - -2000-01-24 Michael Widenius - -* Don't give a unnecessary GRANT error when using tables from many - databases in the same query. - -2000-01-20 Michael Widenius - -* Fixed that 'date_column BETWEEN const_date AND const_date' works. - -2000-01-19 Michael Widenius - -* Fixed problem when only changing a 0 to NULL in a table with BLOB/TEXT - columns. -* Fixed bug in range optimizer when using many key parts and or on the middle - key parts: WHERE K1=1 and K3=2 and (K2=2 and K4=4 or K2=3 and K4=5) -* Added the virtual VIO interface to the mysql connection streams. - (This will make it possible to use SSL through the VIO classe interface) - -2000-01-14 Michael Widenius - -* Added command 'source' to mysql to allow reading of batch files inside - mysql. Original patch by Matthew Vanecek. - -2000-01-12 Michael Widenius - -* Fixed bug that a change of all VARCHAR columns to CHAR columns didn't change - row type from dynamic to fixed. - -2000-01-11 Michael Widenius - -* Added print of default arguments options to all clients. -* Added --log-slow-queries to mysqld to log all queries that takes a - long time to a separate log file with a time of how long the query took. -* Fixed critical problem with the WITH GRANT OPTION option. -* Added read-next-on-key to HEAP tables. This should fix all - problems with HEAP tables when using not UNIQUE keys. -* Disabled floating point exceptions for FreeBSD to fix core dump when - doing SELECT floor(pow(2,63)); - -2000-01-07 Michael Widenius - -* Fixed core dump when doing WHERE key_column=RAND(...) - (Note that this query can never use keys as the RAND() function must be - re-evaluated for each row) -2000-01-04 Michael Widenius - -* Fixed optimization bug in SELECT .. LEFT JOIN ... key_column IS NULL, when - key_column could contain NULL values. -* Fixed problem with 8 bit characters as separators in LOAD DATA INFILE. - -2000-01-02 Michael Widenius - -* Release of 3.23.8 - -1999-12-31 Michael Widenius - -* Fixed GRANT problem when doing 'CREATE TABLE ... SELECT' - -1999-12-30 Michael Widenius - -* Fixed problem with timezones that are < GMT -11 -* Fixed problem with ISAM when doing some ORDER BY .. DESC queries. - -1999-12-28 Michael Widenius - -* Fixed bug when doing a join on a text key which didn't covert the whole key. -* Option --delay-key-write didn't enable delayed key writing -* Fixed update of TEXT column which only involved case changes. - -1999-12-27 Michael Widenius - -* Fixed that INSERT DELAYED doesn't update timestamps that are given. - -1999-12-25 Michael Widenius - -* Added function yearweek() and options 'x', 'X', 'v' and 'V' to date_format() - -1999-12-22 Michael Widenius - -* Fixed problem with MAX(indexed_column) and HEAP tables. -* Fixed problem with BLOB NULL keys and LIKE "prefix%". - -1999-12-20 Michael Widenius - -* Fixed problem with MyISAM and fixed length rows < 5 bytes. - -1999-12-10 Michael Widenius - -* Added RAID support (patch from Tõnu Samuel) - -1999-12-02 Michael Widenius - -* Added -O interactive_timeout to mysqld. -* Changed the argument of mysql_data_seek to ulonglong from ulong. - -1999-11-30 Michael Widenius - -Fixed bug in replace() on Alpha. Patch by 'Tom Holroyd' -Fixed bug in LOAD DATA LOCAL INFILE on Alpha. Patch by 'Tom Holroyd' - -1999-11-29 Michael Widenius - -* Added detection of pthread_attr_stacksize() in configure. -* Added variable net_retry_count (needed for FreeBSD). - -Sun Nov 28 20:55:45 1999 Michael Widenius - -* Added option '--verbose' to mysqladmin - -1999-11-28 Michael Widenius - -* Fixed problem when converting heap to myisam. -* Fixed bug in HEAP tables when doing insert + delete + insert + scan the - table. - -1999-11-23 Michael Widenius - -* Fix core dump when releasing a lock from a non existing table -* Remove locks on tables before starting to remove duplicates. -* Added patch to make most string functions multi-byte safe (by Wei He) -* Added Bytes_recieived/Bytes_sent statistics (by Sasha Pachev) -* Added optimization of read_next() with MyISAM -* Changed MyISAM to use concurrent inserts. - -1999-11-21 Michael Widenius - -* Inverted flag 'delayed_key_write' on 'show variables' - -1999-11-20 Michael Widenius - -* Added variable max_write_lock_count - -1999-11-13 Michael Widenius - -* Release of 3.23.6 -* Made floor() overflow safe on FREEBSD. -* Allow quoting of identifers with ` -* Temporary tables now start with #sql -* Added option --quote-names to mysqldump. -* Added option --ansi to change " to a identifier delimiter and || to - string concatenation. -* Fixed INTO DUMPFILE to give better error messages. NULL is now written - as an empty string. -* Changed Field_double and double->string to use snprintf() to avoid overflows. -* Fixed bug that one could make a part of a PRIMARY KEY not null. -* Fixed encrypt() to be thread safe and not reuse buffer. - -1999-11-11 Michael Widenius - -* Changed that FLOAT(X) where X <= 24 -> FLOAT and X <= 53 -> DOUBLE. -* Changed DECIMAL(X) to be DECIMAL(X,0) and DECIMAL to be DECIMAL(10,0) - -1999-11-09 Michael Widenius - -* Added mysqld option -O lower_case_table_names=[0|1] to force table - names to lower case. -* Added mysql_odbc_escape_string() function to support big5 characters in - MyOBC. - -1999-11-08 Michael Widenius - -* Added patch by Sasha for user defined variables. -* Changed that FLOAT and DOUBLE (without any length modifiers) are - not anymore fixed decimal point numbers. - -1999-10-22 Michael Widenius - -* Added option ROW_FORMAT=[default, dynamic, static, compressed] to - CREATE_TABLE - -1999-10-20 Michael Widenius - -* 'DELETE FROM table_name' didn't work on temporary tables - -1999-10-18 Michael Widenius - -* Release of MySQL 3.23.5 -* Fixed problem with LIKE "%const" - -1999-10-17 Michael Widenius - -* Added bit function ~ (neg) - -1999-10-14 Michael Widenius - -* Added support for the GBK Chinese character set (by Wei He) - -1999-10-13 Michael Widenius - -* Storage of date results is now much faster to date and datetime columns. - -1999-10-12 Michael Widenius - -* Fixed bug when using DISTINCT + ORDER BY RAND() -* new option --relative to mysqladmin. - -1999-10-11 Michael Widenius - -* Added some error messages in mysqld.cc -* Allow use of NATIONAL and NCHAR when defining character columns. - (They don't do anything) -* Don't allow NULL columns in PRIMARY KEY:s (only in UNIQUE keys) - -1999-10-10 Michael Widenius - -* Clear LAST_INSERT_ID if in uses this in ODBC context: - WHERE auto_increment_column IS NULL; -* 'SET SQL_AUTO_IS_NULL=0|1' now turns off/on the above handling of - auto_increment columns - -1999-10-09 Michael Widenius - -* Added parameter 'concurrency' for Solaris. - -1999-10-07 Michael Widenius - -* Fixed problem when using an auto_increment column in two keys - -1999-10-06 Michael Widenius - -* AS on fieldname with CREATE TABLE table_name SELECT ... didn't work. - -1999-10-01 Michael Widenius - -* LIKE with many % ("%xxx%yy%zz%") are now much faster. - -1999-09-24 Michael Widenius - -* Fix privilege check for LOAD DATA REPLACE . - -1999-09-22 Michael Widenius - -* Added SHOW GRANT FOR user (by Sinisa) -* Added date + INTERVALL # date_interval_type - -1999-09-19 Michael Widenius - -* Fixed problem with index optimzation with 'WHERE index is not null' - -* Allow creation of temporary tables with same name as original table. -* When granting user a grant option for a database, he couldn't grant - privileges to other users. - -1999-09-17 Michael Widenius - -* Inserting a DATETIME into a TIME column will not anymore try to store 'days' - in it. -* Fixed problem with storage of float/double on low endian machines. - -1999-09-08 Michael Widenius - -* Release of 3.23.3 -* Added limit to UPDATE -* Added client library function: mysql_change_user() - -1999-09-07 Michael Widenius - -* Added character set to 'show variables' -* Added support of '--[white-space]' as comment -* Allow 'INSERT into table_name VALUES ();' - -1999-09-03 Michael Widenius - -* Add mysqld option --delay-key-write to mysqld.cc - -1999-08-30 Michael Widenius - -* Fixed problem with COUNT(DISTINCT) and GROUP BY - -1999-08-29 Michael Widenius - -* Added /*!version */ -* Fixed core dump with empty blob to reverse() -* Fixed problem with year(now()) and year(curdate()). - -1999-08-28 Michael Widenius - -* Added construct: - - CASE value WHEN [compare-value] THEN result - [WHEN [compare-value] THEN result ...] - [ELSE result] - END - - CASE WHEN [condition] THEN result - [WHEN [condition] THEN result ...] - [ELSE result] - END -1999-08-19 Michael Widenius - -* Added check of arguments to acos() and asin(). -* unique_column IS NULL only returned the first row with NULL. - -1999-08-12 Michael Widenius - -* REGEXP(...,NULL) will not return an error anymore. - -* Removed ifdef mSQL_COMPLIANT when comparing NULL to NULL - -1999-08-05 Michael Widenius - -* Fix problem with LOCK TABLES and DELETE FROM table. - -1999-08-04 Michael Widenius - -* Don't pack all keys even if one key is packed when not using PACK_KEYS=1. - -1999-08-03 Michael Widenius - -* Fixed core-dump bug when inserting table or column grant on user name "" - -1999-08-02 Michael Widenius - -* Fix problem with LOCK TABLES when no database is selected. -* New functions: MD5(), (by Tõnu Samuel) and EXPORT_SET (by Sasha Pachev) -* Changed Socket to my_socket (to avoid conflicts) - -1999-07-29 Michael Widenius - -* Fixed problem with DISTINCT on BLOB column -* new keywords: CASE, THEN, WHEN, ELSE, END -* The CASE operator (by Tõnu Samuel) (not yet working) -* set SQL_LOW_PRIORITY_UPDATES=# didn't work -* Fixed range optimizer bug in - SELECT * FROM table_name WHERE key_part1 >= const AND (key_part2 = const OR key_part2 = const) - -1999-07-26 Michael Widenius - -* One can now update indexes columns that are used in the WHERE clause. - UPDATE tbl_name SET KEY=KEY+1 WHERE KEY > 100; - -1999-07-25 Michael Widenius - -* Added get_date() function to all item and fields. This makes date handling - a lot faster! -* Added handling of fuzzy dates (dates where day or month is 0) - -1999-07-21 Michael Widenius - -* Fixed optimization of SELECT ... WHERE key_part1=const1 and key_part_2=const2 and key_part1=const4 and key_part2=const4 - (indextype should be range instead of ref) - -1999-07-20 Michael Widenius - -* Changed handling of 'const_item' to allow handling of - ORDER BY RAND(). -* MyISAM tables now allows keys on NULL and BLOB columns. -* Optimize the following LEFT JOIN: - SELECT ... FROM t1 LEFT JOIN t2 ON ... WHERE t2.not_null_column IS NULL - -1999-07-19 Michael Widenius - -* Added ORDER BY and GROUP BY with functions -* Changed all handling of tables in sql_select.cc to use table_map instead - of table_nr. -* Added use of column_name = formula to use keys -* column_name = column_name2 don't anymore have to have identical packing -* field IS NULL can now use keys - -1999-07-16 Michael Widenius - -* Changed heap tables to be stored in low_byte_first order (to make it easy - to convert to MyISAM tables) -* Automatic change of HEAP temporary tables to MYISAM tables in case of - 'table is full' errors. -* Added option --init-file=file_name to mysqld - -1999-07-15 Michael Widenius - -* Added COUNT(DISTINCT value,[value,...]) - -1999-07-14 Michael Widenius - -* changed name of temporary table to include getpid(). -* Added full support for CREATE TEMPORARY - -1999-07-04 Michael Widenius - -* Added CREATE TABLE options 'CHECKSUM' and 'PACK_KEYS' -* Added mysqld option --default-table-type -* Added column 'packed' to 'show index' -* Added pack_keys and checksum to show table status - -1999-07-01 Michael Widenius - -* Release of 3.23.0 -* Show NULL as the default value for AUTO_INCREMENT columns. -* Fixed optimizer bug with tables with only one row. -* Fixed bug when using LOCK TABLES table_name READ; FLUSH TABLES; - -1999-06-30 Michael Widenius - -* Added use of LIBWRAP (by "Henning P . Schmiedehausen" ) - -1999-06-28 Michael Widenius - -* Don't allow AUTO_INCREMENT for other than numerical columns -* Using AUTO_INCREMENT will now automaticly make the column NOT NULL. - -1999-06-22 Michael Widenius - -* Added privilege column to 'show columns' - -1999-07-13 Michael Widenius - -* Added SQL_BIG_RESULT (SQL_SMALL_RESULT is now default) -* Use the MYISAM UNIQUE constraint to solve SELECT DISTINCT faster. - -1999-06-06 Michael Widenius - -* Changed most macros in the libmysql library to functions to avoid many - versions of shared libraries. - -1999-05-16 Michael Widenius - -* Added "Row_type" to SHOW TABLE STATUS. - -1999-05-15 Michael Widenius - -* Added option IF NOT EXISTS to CREATE TABLE -* Allow creation of CHAR(0) columns. - -1999-05-14 Michael Widenius - -* Added more error checking of errors from the table handler. - -1999-05-13 Michael Widenius - -* Added the '<=>' operator which will act as '=' but will return TRUE if both - arguments are NULL. - -1999-05-12 Michael Widenius - -* The default base for the log, update-log and pid-file name is now - 'hostname' with everything after the first '.' removed. - -1999-05-11 Michael Widenius - -* Require '%' before format characters in DATE_FORMAT(). -* Add logging of GRANT and SET PASSWORD in the update log. - -1999-05-10 Michael Widenius - -* Changed LIKE compare to behave as =; This means that 'e' LIKE 'é' is now - true. - -1999-05-10 Michael Widenius - -* REPLACE now used direct read to find dupplicate row instead of key read; - This makes REPLACE a lot faster. - -1999-05-05 Michael Widenius - -* New option: CREATE TABLE SELECT .... -* Added syntax for CREATE TEMPORARY TABLE (not yet implemented) - -1999-05-03 Michael Widenius - -@code{DESCRIBE TABLE} returns a lot of information about the tables - -1999-05-02 Michael Widenius - -* Added comments to tables -* Added UNIQUE, in CREATE TABLE table_name (col int not null UNIQUE); - -1999-04-29 Michael Widenius - -* Use auto_increment value provided by MYISAM -* Use key_part statistics if available - -1999-04-28 Michael Widenius - -* null bits are now stored at start of row instead at the end. - (Now we only need one bit to mark a row deleted) - -* DELAYED is now a reserved words. (because of conflicts from yacc) - -1999-04-20 Michael Widenius - -* Added patches for DEC_3_2 by "Andrea Suatoni" - -1999-04-19 Jani Tolonen - -* Added load_file() function - -1999-04-15 Michael Widenius - -* Added option --skip-show-databases to mysqld. - -1999-04-10 Michael Widenius - -* set start time when connection. - -1999-04-03 Michael Widenius - -* Fixed problem with 'DELETE FROM TABLE' when table was locked by another - thread. - -1999-04-03 Michael Widenius - -* Check if rows has changed now also works with BLOB/TEXT. -* Added the INNER JOIN syntax; This made 'INNER' a reserved word. - -1999-04-02 Michael Widenius - -* Fixed problem with 'Host '..' is not allowed to connect to this MySQL - server' after one had inserted a new MySQL user with a GRANT command. - -1999-04-01 Michael Widenius - -* Added support for netmasks to the hostname in the MySQL tables. - -1999-03-31 Michael Widenius - -* Changed net.cc to use TCP_NODELAY also on Linux. -* If one compares a NOT NULL DATE/DATETIME column with IS NULL, this - is changed to a compare against 0 to satisfy some ODBC applications. - (By shreeve@uci.edu) - -1999-03-30 Michael Widenius - -* NULL IN (...) now returns NULL instead of 0. - This will ensure that 'null_column NOT IN (...)' doesn't match NULL values. -* Changed the mysql.db entry to char(60). - -1999-03-16 Michael Widenius - -* Fix storage of floating point values in TIME columns -* Changed parsing of TIME strings to be more strict. Now the fractional - second part is detected (and currently skipped) - The following formats are supported - [[[DAYS] [H]H:]MM:]SS[.fraction] and [[[[H]H]H]H]MM]SS[.fraction] -* Detect (and ignore) second fraction part from DATETIME - -1999-03-10 Michael Widenius - -* On Win32 detect --basedir automaticly from path to mysqld. -* Added option --skip-column-names to mysql. -* Added some memory checks in sql_string.cc - -1999-03-08 Michael Widenius - -* Added the ODBC 3.0 EXTRACT(interval FROM datetime) function -* Added lots of 'out of memory' checks for SELECT statements. - -1999-03-05 Michael Widenius - -* Fixed std() for big tables when result should be 0. - -1999-03-04 Michael Widenius - -* INSERT DELAYED had some garbage at end in the update log. - -1999-03-03 Michael Widenius - -* Added a lot of casts in filesort.cc to make it more portable. - -1999-02-28 Michael Widenius - -* Changed default size of key_buffer to 4M -* Fixed problem with queries that needed temporary tables with blobs. - -1999-02-26 Michael Widenius - -* Added LOAD DATA [LOW_PRIORITY] INFILE. -* Added option 'flush-time' to force MySQL-Win32 version to flush - the tables once in a while. -* On Linux all process didn't die on shutdown. - -1999-02-18 Michael Widenius - -* Fixed a core dump problem when using --log-update and connecting - without a default database. -* Added more error check if one get an error writing to the log files. - -1999-02-16 Michael Widenius - -* Fixed some configure errors -* If one used @code{LEFT JOIN} on tables that had circular dependencies this - caused mysqld to hang forever. - -1999-02-05 Michael Widenius - -* Release of 3.22.16 -* mysqladmin processlist could core dump mysqld if a new user logged in. -* DELETE FROM table_name WHERE key_column=column_name didn't find any matching - rows. -* The default index name is now using the same case as the used column name. - -1999-02-03 Michael Widenius - -* Added the MODIFY attribute to ALTER TABLE (to be compatible with some other - SQL databases) -* Added LIKE to 'show status' - -1999-01-31 Michael Widenius - -* DATE_ADD(column,...) didn't work. -* INSERT DELAYED could deadlock with status 'upgrading lock' - -1999-01-30 Michael Widenius - -* Extended item_encrypt() to take longer salt strings than 2 characters. - (for FreeBSD) - -1999-01-26 Michael Widenius - -* Release of 3.22.15 -* LIKE on binary strings didn't work if one used a multi-byte character set. -* mysqladmin -w will now wait for the server to come up if it's killed. - -Tue Jan 26 00:06:10 1999 Michael Widenius - -* Fixed problem with ORDER BY whith 'only index' optimzation when there - where multiple key definitions for an used column. -* GRANT with password didn't update in memory GRANT table before - 'mysqladmin flush' - -1999-01-20 Michael Widenius - -* Updating BLOB/TEXT through formulas didn't work for short (< 256 char) - strings. -* Changed option --extended_insert-insert to --extended-insert in mysqldump - -1999-01-19 Michael Widenius - -* Lots of changes to support INSERT DELAYED. - -1999-01-17 Michael Widenius - -* Changed unpacking of DATE and DATETIME; These are now about 5 times faster. - -1999-01-16 Michael Widenius - -* DATE_ADD with now() or curdate() reused the same string. -* Added BENCHMARK(loop-count,expression) function to time expressions. - -1999-01-14 Michael Widenius - -* LEFT JOIN USING (col1,col2) gave an error if one used it with tables - from 2 different databases. -* LOAD DATA LOCAL INFILE didn't work in the unix version because of a missing - file in the sql directory -* Fixed problems with VARCHAR/BLOB on very short rows (< 4 bytes); One - could get error 127 when deleting rows. - -1999-01-13 Michael Widenius - -* Nicer error messages for table types. -* Changed default number of connections to 100 - -1999-01-11 Michael Widenius - -* When one did a GRANT on a new host mysqld could die on the first connect - from this host. -* Use as default bigger buffers when using 'load data infile'. - -1999-01-06 Michael Widenius - -* All blob pointers have now reserved 8 bytes in the .frm files; This makes - the .frm files portable to 64 bit architectures. - -* DECIMAL(x,y) now works according to ANSI SQL. - -1998-12-30 Michael Widenius - -* If one used ORDER BY on column name that was the same name as an alias, - the ORDER BY was done on the alias. - -1998-12-29 Michael Widenius - -* Added aggregate UDF functions. Thanks to - Andreas F. Bobak for this ! - -1998-12-28 Michael Widenius - -* Changed sql_crypt() a bit to make it a bit more secure; This will make old - string stored with the old decrypt() function unreadable! - -1998-12-27 Michael Widenius - -* Allow empty arguments to mysqld to make it easier to start it - from shell scripts! - -1998-12-23 Michael Widenius - -* last_insert_id() is now updated for INSERT INTO ... SELECT -* Setting a TIMESTAMP column to NULL didn't record the timestamp - value in the update log. - -1998-12-21 Michael Widenius - -* Fixed lock handler bug when one did: - INSERT INTO TABLE ... SELECT ... GROUP BY. -* Added a patch for localtime_r() on Win32 that it will not crash anymore - if your date is > 2039, but instead it will return a time of all zero. -* UDF function names are not longer case sensitive. -* Added escape of '^Z' to \Z as ^Z doesn't work with pipes on Win32 -* Changed optimizer to not use 'range search' in some cases. -* Changed optimizer to use result form 'check_range' in optimization of - searching of part keys. - -1998-12-16 Michael Widenius - -* SELECT COUNT(*) didn't work on LEFT JOIN queries with only had expressions - in the ON part and there where no WHERE clause. -* Added optional support for crypted frm files. - -1998-12-13 Michael Widenius - -* Saving NOW(), CURDATE() or CURTIME() directly in a column didn't work. -* SELECT COUNT(*) didn't work on LEFT JOIN queries with only had expressions - in the ON part and no WHERE clause. - -1998-12-09 Michael Widenius - -* Fixed a bug in sql_list.h that made ALTER TABLE dump a core in some context. - -1998-12-08 Michael Widenius - -* Allow use of negative real numbers without a decimal point. -* day number is now adjusted to max days in month if the resulting month - after DATE_ADD/DATE_SUB() doesn't have enough days. - -1998-12-07 Michael Widenius - -* Fix that GRANT compares columns case insensitive. -* Add / to TMPDIR if needed. - -1998-12-06 Michael Widenius - -* Allow GLOBAL as a table or database name. - -Thu Dec 3 10:29:11 1998 Michael Widenius - -* Added option SQL_SMALL_RESULT to SELECT to force use of fast temporary - tables when one knows that the result set will be small! - -1998-11-27 Michael Widenius - -* The hostname in user@hostname can now include '.' and '-' without quotes. - -1998-11-26 Michael Widenius - -* Fixed problem when using DATE_ADD()/DATE_SUB() in a WHERE clause. -* One can now set the password for a user with the - GRANT ... user IDENTIFIED BY 'password' syntax. -* Fixed bug in GRANT checking with SELECT on many tables. -* Removed some 'no Database selected' errors. -* Release of 3.22.11 - -1998-11-21 Michael Widenius - -* Changed USER() to return user@host -* New command: FLUSH STATUS ; to reset most status variables. -* New status variables: aborted_threads and aborted_connects. - -1998-11-20 Michael Widenius - -* Fixed bug in ORDER BY on FIELD() -* New function make_set() (70% by Jani Tolonen) - -1998-11-18 Michael Widenius - -* Added functions encrypt() and decrypt(). Because of endspace stripping of - CHAR() and VARCHAR() these should only be used with fixed size strings or - with BLOB/TEXT columns. - -1998-11-17 Michael Widenius - -* Silently remove DEFAULT values from AUTO_INCREMENT columns. -* Added new variable to mysqld: connection_timeout - -1998-11-13 Michael Widenius - -* Better error message when table doesn't exists. - -1998-11-12 Michael Widenius - -* Added option SET SQL_WARNINGS=1 to get a warning count also for simple - inserts. -* IS NULL on a AUTO_INCREMENT column in a LEFT JOIN didn't work. -* MySQL now uses SIGTERM instead of SIGQUIT with shutdown to work better - on FreeBSD. -* Added option \G (print vertically) to mysql -* SELECT HIGH_PRIORITY ... killed mysqld. - -1998-11-11 Michael Widenius - -* Added grant checking to 'show tables' -* Large changes to get grants integrated with the current privilege system. - -1998-11-10 Michael Widenius - -* SELECT .. WHERE t1.id1=t2.id2 could fail if t1.id1 and t1.id2 was keys - and of radically differently types. -* Changed get_password to use getpass function. (Patch by Jaromir - Dolecek ) - -1998-11-04 Michael Widenius - -* Release of 3.22.10 -* Changed +, - (sign and minus), *, /, % and ABS() to be BIGINT aware. -* ALTER TABLE and UPDATE now writes out the values of any duplicated keys. - -1998-11-03 Michael Widenius - -* ADABASD like INSERT statement: - INSERT INTO table_name SET column=value,column=value... -* The client flag option 'CLIENT_IGNORE_SPACE' didn't work properly. -* Fixed bug in ALTER TABLE that caused a core dump. -* Added optimization of SELECT ... FROM table ORDER BY key_part1 LIMIT ... - This query will now use indexes instead of sorting the table. - -Mon Nov 2 20:52:15 1998 Jani Tolonen - -* Added more variables to SHOW STATUS and changed format of output -* Added command extended-status to mysqladmin which will show the - new status - -1998-10-30 Michael Widenius - -* columns of type date, date_time and 'set' are now stored a little - more efficient if they are 0, NULL or ''. - -1998-10-26 Michael Widenius - -* Most errors are now printed through sql_write_error() which will add - date, time and thread id to the .err log. - -1998-10-25 Michael Widenius - -* Added option MYSQL_INIT_COMMAND to mysql_options() to make a query - on connect or reconnect. -* Added option MYSQL_READ_DEFAULT_FILE and MYSQL_READ_DEFAULT_GROUP to - mysql_option() to read the following parameters from the my.cnf file: - "port", "socket", "compress", "password", "pipe", "timeout", "user", - "init-command", "host" and "database" - -* Added maybe_null to the UDF structure - -1998-10-22 Michael Widenius - -* Added IGNORE to INSERT with many rows. -* Added SQL GRANT commands -* Release of 3.22.9 - -1998-10-18 Michael Widenius - -* One can new set the last_insert_id() value in an update with - LAST_INSERT_ID(expr). This makes it possible to return a value for things - like: - UPDATE table SET COUNT=LAST_INSERT_ID(COUNT+1) WHERE primary_key_col=# -* display key name used by 'range' in the 'key' column in 'show processlist' -* new SQL command: FLUSH [ TABLES | HOSTS | LOGS | PRIVILEGES ] [, ...] -* new SQL command: KILL thread_id - -Thu Oct 15 18:57:15 1998 Michael Widenius - -* Reuse memory for identical set and enum fields. - -1998-10-14 Michael Widenius - -* Added open file information to mysqladmin debug -* Fixed conversion problem when using ALTER TABLE from a INT to a short CHAR() - column. -* Added 'SELECT HIGH_PRIORITY'; This will get a lock for the SELECT even if - there is a thread waiting another SELECT to get a WRITE LOCK. - NOTE: This makes HIGH_PRIORITY a reserved word - -1998-10-12 Michael Widenius - -* Moved wild_compare to string class to be able to use LIKE on BLOB/TEXT columns with \0 -* Added ESCAPE option to LIKE - -1998-10-08 Michael Widenius - -* Update for AIX: Added a cast to all bzero() calls and changed to use - my_gethostbyname_r instead of gethostbyname_r. - -1998-10-03 Michael Widenius - -* Release of 3.22.8 -* Added an extra thread signal loop on shutdown to avoid some error messages - from the client. -* MySQL now uses the next available number as extension for the update - log file. - -1998-09-25 Michael Widenius - -* MySQL clients on NT will now by default first try to connect with named pipes - and after this with TCP/IP. - -1998-09-24 Michael Widenius - -* Fixed problems with TIME columns and negative strings. -* Added a new column 'state' to 'mysqladmin proc' that gives some - information what the thread is doing. - -* DATE_ADD() and DATE_SUB() didn't work with group functions. - -1998-09-23 Michael Widenius - -* 'mysql' will now also try to reconnect on 'use database' commands. - -* Fix problem with ORDER BY and LEFT JOIN and const tables. - -1998-09-22 Michael Widenius - -* Fixed problem with ORDER BY if the first ORDER BY column was a key and - the rest wasn't. - -1998-09-17 Michael Widenius - -* Release of 3.22.7 -* OPTIMIZE TABLE table_name can now be used to reclaim disk space - after many deletes. This uses currently ALTER TABLE to re-generate - the table, but in the future it will use an integrated isamchk - for more speed. - -1998-09-16 Michael Widenius - -* Added functions for perfect hashing of symbols. Moved some other things - to the LEX structure for faster setup. -* Changed libmysql.dll on Win32 to use TLS to get better multi-threading - -1998-09-15 Michael Widenius -* Added --where to mysqldump (patch by Jim Faucette). -* Fixed slow UPDATE/DELETE when using DATETIME or DATE keys. - -1998-09-14 Michael Widenius - -* Changed some optimizations parameters to make better joins. -* Anyone can now use 'mysqladmin proc' to check ones own - threads. Only users with the 'Process_priv' privilege can get - information about all threads. -* Fixed very unlikely optimizer bug in the range optimizer - (bug introduced in 3.22.6) -* Added handling of formats YYMMDD, YYYYMMDD, YYMMDDHHMMSS to - DATETIME/TIMESTAMP when using numbers. (Before these formats only worked - with strings). - -1998-09-06 Michael Widenius - -* Added connect option CLIENT_IGNORE_SPACE to allow one to use - space after the function name and before '(' (Powerbuilder requires this). - This will make all function names reserved words. -* comments that start with /*! are now interpreted as commands. This feature - allows one to use MySQL extensions like: - 'SELECT /*! STRAIGHT_JOIN */ * from table1,table1' - in a portable manor. - -1998-09-04 Michael Widenius - -* Added SET OPTION INSERT_ID=# to force use of specific INSERT_ID. This is - usable with new --log-long-format option. - -1998-08-31 Michael Widenius - -* Fixed problem when INSERTING into TIME fields. - -1998-08-29 Michael Widenius - -* Added key cache and handler statistic to 'mysqladmin debug'. -* changed UPDATE and DELETE to not use 'index only' range detection. - (Fixed slow update_key in the benchmarks) -* Changed the insert benchmark because it was impossible to use it with - postgreSQL (to slow). - -Thu Aug 27 15:38:23 1998 Michael Widenius - -* mysqldump will automaticly use LOAD DATA LOCAL INFILE if one uses - an TCP/IP connection. - -1998-08-27 Michael Widenius - -* Added support of local files with LOAD DATA LOCAL INFILE .. -* Save history if one kills mysql with ^C. Save history in MYSQL_HISTFILE. - Modfied patch by Tommy Larsen - -1998-08-26 Michael Widenius - -* Fixed a possible problem with mysql_refresh(). - -Tue Aug 18 14:07:53 1998 Michael Widenius - -* Give an error for queries that mix GROUP columns and fields when there - is no GROUP BY specification. - -1998-08-17 Michael Widenius - -* Changed sql_yacc.yy to allow field attributes in any order. - -1998-08-15 Michael Widenius - -* Increased max_allowed_packed to 1M as default. -* LOAD DATA INFILE didn't copy single field separators in some case: - "Hello"Atif"!" - -1998-08-13 Michael Widenius - -* Fixed fatal bug in lpad(). - -Thu Aug 13 01:00:44 1998 Michael Widenius - -* REGEXP can now take a expression as the second argument. - -1998-08-12 Michael Widenius - -* Changed LIKE to be faster in some cases with many '%': LIKE '%c%ompiler%' - -1998-08-11 Michael Widenius - -* All table lock handing is changed to avoid some very subtitle - deadlocks when using DROP TABLE, ALTER TABLE, DELETE FROM TABLE and - mysqladmin flush-tables under heavy usage. - -1998-08-10 Michael Widenius - -* Allow one to use the syntax 'CONSTRAINT symbol' before FOREIGN KEY. -* new mysqld option '--low-priority-insert' to give inserts lower priority - than selects. -* One can now use {INSERT | REPLACE} LOW_PRIORITY INTO ... - One side effect is that LOW_PRIORITY is now a reserved word :( -* Changed locking code to get better handling of locks of different types. - -1998-08-09 Michael Widenius - -* mysqld will now ignore trailing ';' characters in queries. This is to - make it easier to emigrate from some other SQL servers that require the - end ';' -* One can now use a LIMIT value with DELETE to make it return after deleting - a given number of rows. -* Fix for corrupted output of fixed format and SELECT INTO OUTFILE: - select * from test into outfile "/tmp/test.txt" fields terminated by '' enclosed by '' - -1998-08-04 Michael Widenius - -* new mysqld option: '-O max_connect_errors=#'. - Connect errors are now reset for each correct connection. -* Add support for INSERT INTO table ... VALUES(...),(...),(...) - -1998-08-03 Michael Widenius - -* Added Oracle GREATEST() and LEAST() functions. One must now use - these instead if the MAX() and MIN() functions to get the biggest/smallest - value from a list of values. These can now handle real, bigint and - string values. -* The following query now uses indexing instead of sorting the table: - SELECT ... FROM table ORDER BY key_part1 desc,key_part2 desc,... -* Added check that the error message file has enough error messages. -* DAYOFWEEK() had offset 0 for Sunday. Changed the offset to 1. - -1998-08-02 Michael Widenius - -* new option to mysql: '--vertical' to print results in vertical mode. -* All count structures in the client (affected_rows, insert_id...) are now of - type BIGINT to allow one to use 64 bit values. - This required a minor change in the MySQL protocol which may affect - old clients when using tables with auto_increment values > 24M. -* The return type of mysql_fetch_lengths() has changed from uint * - to ulong *. This may give a warning for old clients but should work - on most machines. - -Thu Jul 30 15:29:05 1998 Michael Widenius - -* COUNT(), STD() and AVG() are extended to handle more than 4G rows. - -Wed Jul 29 10:36:05 1998 Michael Widenius - -* Added new option: - SET OPTION SQL_LOG_UPDATE=[0,1] to allow users with process_priv - privilege to bypass the update log. - (Modified patch from Sergey A Mukhin ) - -Thu Jul 23 15:58:13 1998 Michael Widenius - -* Initialize line buffer in mysql.cc to make blob readings from pipes safer. - -Tue Jul 21 22:04:43 1998 Michael Widenius - -* One can now store -838:59:59 <= x <= 838:59:59 in a TIME column. -* TIME_TO_SEC() and SEC_TO_TIME() can now handle negative times and hours - up to 32767. - -Mon Jul 20 20:34:33 1998 Michael Widenius - -* Change mysys/dbug to allocate all thread varibles in one struct. - This makes it easier to make a threaded libmysql.dll - -Sun Jul 19 12:54:45 1998 Michael Widenius - -* Changed ALTER TABLE to make it more multi-thread safe. -* normal INSERT INTO TABLE are now also cached when used with - LOCK TABLES. (previously only INSERT ... SELECT and LOAD DATA INFILE - was cached) - -Fri Jul 17 20:53:23 1998 Michael Widenius - -* Allow group functions with HAVING: - SELECT col FROM table GROUP BY col HAVING COUNT(*)>0; - -Tue Jul 14 15:11:52 1998 Michael Widenius - -* Use the result from 'gethostname' as the name for pid files - (instead of uname()). - -Sun Jul 12 12:38:45 1998 Michael Widenius - -* Index only optimization; Some queries are now resolved using - only indexes. Until MySQL 4.0 this works only for number columns. - - SELECT key_part1,key_part2 FROM table WHERE key_part1=# - SELECT COUNT(*) FROM table WHERE key_part1=# and key_part2=# - SELECT key_part2 FROM table GROUP BY key_part1; - SELECT * FROM table ORDER BY key_part2; - -1998-07-07 Michael Widenius - -* Added function DATE_ADD() and DATE_SUB() - -1998-07-06 Michael Widenius - -* Added function SUBSTRING() with 2 arguments. - -1998-07-05 Michael Widenius - -* Added optimization to remove const reference tables from ORDER BY and - GROUP BY. -* Allow '$' in table and column names. - -1998-07-04 Michael Widenius - -* new option --tmpdir for mysqld. - -1998-07-03 Michael Widenius - -* MySQL now automaticly changes a query from an ODBC client: - SELECT ... from table WHERE auto_increment_column IS NULL - to - SELECT ... from table WHERE auto_increment_column == LAST_INSERT_ID(). - This allows some ODBC programs (Delphi, Access) to retrieve the newly - inserted row to fetch the auto_increment id. -* Drop table now waits for all users to free a table before deleting it - -1998-07-02 Michael Widenius - -* New functions: BIN(), HEX() and CONV() for converting between different - number bases. - -1998-07-01 Michael Widenius - -* If one created a table with smaller record length than 5, one couldn't - delete rows from this table -* mysqld now automaticly disables system locking on Linux, Win32 and if - one uses MIT-threads. One can force the use of locking by doing: - --enable-locking. -* Added new mysqld option --console, to force a console window (for error - messages) when using Win32. -* Removed a useless check in the ISAM delete code; Delete should now be - a bit faster. - -1998-06-28 Michael Widenius - -* Release of MySQL 3.22.3 -* New flag to mysqld: --one-thread for debugging with linuxthreads (or glibc) - -1998-06-27 Michael Widenius - -* Added the LEX structure to THD to get a bit more speed. -* Added DROP TABLE IF EXISTS to not get an error if the table doesn't exists. -* IF and EXISTS are now reserved words (they would have to be sooner or later) - -1998-06-26 Michael Widenius - -* Added lots of new options to mysqldump. - -Wed Jun 24 23:33:35 1998 Michael Widenius - -* Server error messages are now in mysqld_errror.h -* Added compression server/client protocol. (By Sinisa). - -1998-06-22 Michael Widenius - -* New functions: <<, >>, rpad() and lpad(). -* Fixed a core-dump bug in the range optimizer. - -Fri Jun 19 01:51:09 1998 Michael Widenius - -* One can now save default options (like passwords) in a config file (my.cnf). - -1998-06-17 Michael Widenius - -* searching on multiple constant keys that matched > 30 % of the rows didn't - always use the best possible key. - -1998-06-16 Michael Widenius - -* Lot's of small changes to get ORDER BY to work when no records are found - when using fields that are not in GROUP BY (MySQL extension) -* Added new option --chroot to mysqld to start mysqld in a chroot environment - (by Nikki Chumakov ) - -1998-06-15 Michael Widenius - -* Add option --one-database to mysql to only update one database - from a update log. - -1998-06-13 Michael Widenius - -* end space is now ignored when comparing case sensitive strings; - This should fix some problems with ODBC! -* mysql_free_result() now automaticly handles a mysql_use_result() set that - is not completely read. - -1998-06-10 Michael Widenius - -* Release of MySQL 3.22.1 -* Fixed problems with date_format() and wrong dates. -* enum() and set() columns was compared binary; Changed to be case insensitive. - -1998-06-08 Michael Widenius - -* Added new API functions: mysql_init() and mysql_options(). - One MUST now call mysql_init() before one calls mysql_real_connect(). - One doesn't have to call mysql_init if one only calls mysql_connect(). -* LEFT JOIN core dumped if the second table is used with a constant - WHERE/ON expression with uniquely identifies one record. - -1998-06-07 Michael Widenius - -* Range optimizer is not used anymore when comparing a string column - to a number. This will make such compares slower but safer. - -Sun Jun 7 04:47:14 1998 Michael Widenius - -* UPDATE now returns a update information about how many rows was - matched, updated and if one got any 'warnings' when doing the update. - -Sat Jun 6 22:58:02 1998 Michael Widenius - -* Fixed wrong result from 'format(-100,2)'. - -1998-06-06 Michael Widenius - -* Added new C-API function: mysql_ping(). -* Added options AFTER column and FIRST to ALTER TABLE ... ADD columns. - This makes is possible to add a new column at some specific location - in an old table. -* Fixed problem with find_in_set(). - -1998-05-18 Michael Widenius - -* Added new API function: mysql_ping(). - -1998-05-15 Michael Widenius - -* WEEK() now takes an optional argument to allow handling of weeks when the - first day of the week = Sunday (default or 0) or Monday ( extra argument is - 1). WEEK() now returns the week number in the range 0-53 for the used - year. - -1998-05-13 Michael Widenius - -* Added flag -T32 to mysqld for running all queries under the main thread. - This makes it possible to debug mysqld under Linux with gdb! - (This is now called --one-thread) - -1998-05-12 Michael Widenius - -* Added optimization of 'not_null_column IS NULL' (needed for some Access - queries) -* Made all time functions 'more streamlined'. - -1998-05-09 Michael Widenius - -* Allow one to use STRAIGHT_JOIN between two tables to force the optimizer - to join them in a specific order. - -Fri May 8 02:35:00 1998 Michael Widenius - -* Added SET OPTION PASSWORD='new_crypted_password' and - SET OPTION PASSWORD= 'host' : 'user' : 'new_password'. The last version - only works for users with write access to the mysql database. - One can also use: SET OPTION PASSWORD=PASSWORD("new_password"); - -Tue May 5 14:41:47 1998 Michael Widenius - -* String functions now return VARCHAR() instead of CHAR() and - the column type is now VARCHAR() for fields saved as VARCHAR(). - This should make the MyODBC driver better, but may break some old - MySQL clients that doesn't handle FIELD_TYPE_VARCHAR identical as - FIELD_TYPE_CHAR. - -Mon May 4 00:33:27 1998 Michael Widenius - -* Added BOOL as a synonym for BIT and DISTINCTROW as a synonym for DISTINCT. -* CREATE INDEX and DROP INDEX are now implemented trough ALTER TABLE. - CREATE TABLE is still the recommended (fast) way to create indexes. -* Added option SET OPTION PASSWORD='new_password'. - mysqladmin can now be used by not anonymous users to change their - password. - -Sun May 3 18:47:24 1998 Michael Widenius - -* Added option wait_timeout to mysqld. - -Sat Apr 18 14:14:23 1998 Michael Widenius - -* Added hashing of fieldnames for tables with many fields. -* The most frequently used string functions are now in assembler (Linux-intel). - -Thu Apr 16 16:14:14 1998 Michael Widenius - -* Added quick checking if ok host. -* Changed the interface for field->val_str() to better use stack buffers. - -Thu Apr 9 20:02:26 1998 Michael Widenius - -* One can now reference to tables in different databases with: - table@database or database.table -* Added cacheing of users & access rights (for faster access rights checking) - -1998-04-08 Michael Widenius - -* Save of command line history to file in mysql client. - by Tommy Larsen - -1998-04-07 Michael Widenius - -* Added time column to 'mysqladmin processes' to show how long a query - has taken or how long a thread has sleeped. - -1998-04-06 Michael Widenius - -* 'show variables' now gives the correct path for 'datadir'. -* Added logging and update_log to "show variables" - -1998-03-29 Michael Widenius - -* Added new type: YEAR. YEAR is stored on 1 byte with range 0, 1901-2155. -* Added new DATE type that is stored on 3 bytes instead of 4. All new - tables will created with the new date type if one doesn't use - --old-protocol. -* Fixed bug in record caches; One could get 'Error from table handler: #' - on some OS from some queries. - -1998-03-27 Michael Widenius - -* mysql (the command line tool) striped start space from new rows. - -1998-03-25 Michael Widenius - -* Added user level locks: GET_LOCK(string,timeout), RELEASE_LOCK(string) -* Fixed bug in range optimizer when using: - WHERE key_part_1 >= something and key_part_2 <= something_else -* Changed connect timeout to 3 seconds to make it somewhat harder - for crackers to kill mysqld trough telnet + TCP/IP. - -1998-03-24 Michael Widenius - -* new mysqld option --big-selects: - Allow big result sets by saving all temporary sets on file. - (Solves most 'table full' errors) - -1998-03-21 Michael Widenius - -* WHERE with string-column-key = constant-string didn't always find all rows - if the column had many values differing only with characters of the same sort - value (like e and é). -* Added opened_tables to 'show status'. -* Strings keys looked up with 'ref' was not compared case sensitively. -* Added flag '--big-selects' to avoid 'Table is full' errors. - Using this will slow down some queries thought. -* Added umask() to make log_files non-readable for normal users. -* Fixed some odd cases with queries that uses group functions where - the WHERE or HAVING didn't match anything. -* Ignore users with old password (8 byte) on startup if not using - --old-protocol. -* Changed name of the sql_memory allocation system and moved this to - the mysys library. - -1998-03-17 Michael Widenius - -* Added use of current_date, current_time and current_timestamp functions - without (). This automaticly made these reservered words :( - -Tue Mar 10 12:34:50 1998 Michael Widenius - -* Changed mysql_real_connect() to include possible db for faster connection - to a new db. -* select which matched all key fields returned the values in the same - case as the matched values instead of the found values. -* Release of 3.21.26 -* In DATE_FORMAT() PM and AM was swapped for hours 00 and 12. - -Mon Mar 9 14:15:00 1998 Michael Widenius - -* Added some tests to the table order optimizer to get some cases with - 'SELECT ... FROM many_tables' much faster. -* Added a retry loop around accept() to possible fix some problems on some - Linux machines. - -Fri Mar 6 01:18:47 1998 Michael Widenius - -* from_days(0) now returns "0000-00-00" -* Enchanted mysql_connect protocol to allow one to specify database - on connection. This will make MySQL twice as fast to connect to a database - for new clients. - -Thu Mar 5 18:09:45 1998 Michael Widenius - -* Updated record_cache code to be aligned for more speed. -* New tests to crash-me -* Extended the default max key size to 256. - -Wed Mar 4 00:02:16 1998 Michael Widenius - -* Fixed bug when using BLOB/TEXT in GROUP BY with many tables. - -Mon Mar 2 18:58:10 1998 Michael Widenius - -* A enum field that is not declared NOT NULL has NULL as default value. - (Before the default value was the first enum option) - -Tue Feb 24 20:11:30 1998 Michael Widenius - -* Fixed bug in the join optimizer code when using many part keys - on the same key: INDEX (Organisation,Surname(35),Initials(35)). - -Mon Feb 23 16:15:39 1998 Michael Widenius - -* One can now kill threads that are waiting for 'disk full'. -* Fixed some problems with UDF functions. -* ALTER TABLE + IGNORE now returns right number of affected rows. -* Fixed a bug when using 8 bytes long (alpha); filesort() didn't work. - Affects DISTINCT, ORDER BY and GROUP BY on 64 bit processors. - -Sat Feb 21 15:36:48 1998 Michael Widenius - -* Changed typedef string to my_string because of C++ new string class. -* now one can kill threads that's are waiting on 'disk full'. - -Fri Feb 13 23:19:23 1998 Michael Widenius - -* Release of MySQL 3.21.24 -* Fixed problem with LEFT JOIN and constant expressions in the ON part. - -Thu Feb 12 02:54:57 1998 Michael Widenius - -* Added much more descriptive error messages to mysqladmin if connect failed. -* Dynamic loadable functions. Based on source from: - Alexis Mikhailov - -Thu Feb 5 15:19:14 1998 - -* One couldn't delete from a table if no one had done a select on the table. -* Fixed problem with range optimizer which many OR's on key parts inside - each other. - -Tue Feb 3 14:34:32 1998 - -* Changed default umask for new files from 0664 to 0660. - -Fri Jan 30 23:58:19 1998 - -* Release of MySQL 3.21.23 -* Changed ALTER TABLE to work with WIN32 (Win32 can't rename open files) - -Thu Jan 29 20:37:50 1998 - -* Fixed that the following symbols are not reserved words: - TIME DATE TIMESTAMP TEXT BIT ENUM NO ACTION CHECK YEAR MONTH DAY HOUR - MINUTE SECOND STATUS VARIABLES. -* Changed string handling in sql_yacc.yy and sql_lex.cc to be faster. -* Setting a TIMSTAMP to NULL in LOAD DATA INFILE... didn't set the current - time for the TIMESTAMP. -* Fixed that key conversions are tested in the WHERE clause -* LOAD DATA INFILE .... REPLACE INTO ... had wrong 'skipped' count - -Tue Jan 27 15:24:50 1998 - -* Added switch --skip-thread-prior for systems where mysqld's thread - scheduling doesn't work properly. At least BSDI 3.1 works better with - this! -* Added ODBC functions DAYNAME() and MONTHNAME(). -* Fixed unlikely(?) key optimizer bug when using ORs inside ANDs. - -Sat Jan 24 03:35:46 1998 - -* Release of 3.21.22 -* Added support of 'long constant strings' from ANSI SQL: - select 'first ' 'second'; -> 'first second'; - -Mon Jan 19 17:59:49 1998 - -* Fixed problem with Russian character set and LIKE. -* Fixed bug in ORDER BY on string formula with possible NULL values. -* Added functions DAYOFYEAR(), DAYOFMONTH(), MONTH(), YEAR(), WEEK(), - QUARTER(), HOUR(), MINUTE(), SECOND() and FIND_IN_SET(). -* Changed weighting, when using many key parts, in join optimizer to avoid - full joins for a couple of cases. - -Sun Jan 18 21:16:06 1998 - -* Removed that NULL = NULL is true. Now one must use IS NULL or IS NOT NULL - to test if a value is NULL. (This is according to ANSI SQL but may break - old applications that are ported from mSQL) - One can get the old behaviour by compiling with -DmSQL_COMPLIANT -* Fix of count(*) problems when the WHERE clause didn't match any records. -* Added function DAYOFMONTH() - -1998-01-14 Michael Widenius - -* Fixed mysqladmin.c to display only the used socket or TCP/IP port. - -Mon Jan 12 19:32:31 1998 - -* Changed SHOW FIELDS to return NULL as default value for TIMESTAMP - (This removes the DEFAULT "" entry for timestamps in mysqldump) -* Release of MySQL 3.21.21 -* Added commands SHOW STATUS and SHOW VARIABLES. -* Fixed optimizer bug when using - 'WHERE data_field=date_field2 and date_field2=constant' - -Sun Jan 11 05:07:59 1998 - -* Release of MySQL 3.21.20 -* Added long comments to MySQL /* */ -* Changed lex parsing to be a bit faster in some cases. - -Sat Jan 10 15:17:44 1998 - -* Fixed bug when using SELECT DISTINCT + NULL values. - -Fri Jan 9 16:45:26 1998 - -* Changed maximum table name and column name lengths from 32 to 64. -* Aliases can now be of 'any' length. - -Thu Jan 8 02:28:11 1998 - -* Now one gets an error if one tries to create an INDEX or UNIQUE - on a column that allows NULL values. (Before the column was silently - made NOT NULL). - -Wed Jan 7 23:19:11 1998 - -* Changed protocol (downward compatible) to mark if a column - is auto_increment or a timestamp. This is needed for the - new java driver. -* One can now in the clients check if a column is a automatic - TIMESTAMP or a AUTO_INCREMENT field. - -Sun Jan 4 20:10:21 1998 - -* Added update of big5 by jou@pdlc.ieo.nctu.edu.tw -* Added hebrew sorting order by Zeev Suraski. - -Thu Jan 1 12:57:04 1998 - -* Release of 3.21.19 -* unique key fields was not marked as unique keys in mysqlshow. -* Added function REVERSE() (by Zeev Suraski) -* Changed ni_range() to fixed a case of slow range searching. - -Wed Dec 31 15:46:25 1997 - -* Release of 3.21.18a -* Fixed problem with new filesort code from 3.21.18 on Linux - -Mon Dec 29 10:02:24 1997 - -* Added CROSS JOIN syntax. CROSS is now a reserved word -* USE database was not always written to output log. -* mysqladmin command 'status' doesn't increment 'Questions' anymore. - -Sun Dec 28 13:20:20 1997 - -* Recoded yacc/bison stack allocation to be even safer and allow MysQL - to handle even bigger expressions. - -Sat Dec 27 15:28:39 1997 - -* last_insert_id and used timestamp is now written to update log file. - timestamps, calculations with time and LAST_INSERT_ID() will now work - correctly when updating from the update log. - -Fri Dec 26 17:03:14 1997 - -* Give error message if client C functions are called in wrong order. -* Added automatic reconnect of clients for some cases. - -Mon Dec 22 00:25:34 1997 - -* Range optimizer didn't solve ranges of type: - key_part1= x AND key_part2 > y. This forced some ORDER BY queries to - do a full table scan when used with where like above. -* Small sort sets doesn't use temporary files anymore. - -Fri Dec 19 16:30:24 1997 - -* Release of MySQL 3.21.17a -* Fixed problem with compare of binary strings and blobs with ASCII - characters over 127. - -Thu Dec 18 00:33:25 1997 - -* Fixed core dump in first() when chaning some very specific AND and OR - key columns. -* Fixed lock problem: When freeing a read lock on a table with multiple - read locks, a thread waiting for write lock would have given the lock. - This shouldn't affect data integrity, but could possible make mysqld - to restart if one thread was reading data that another thread modified. -* LIMIT offset,count didn't work in INSERT ... SELECT. - -Wed Dec 17 12:35:11 1997 - -* optimized key block caching. This will be quicker than the old one when - using bigger key caches. - -Tue Dec 16 23:33:24 1997 - -* Changed bool to my_bool in some item structures to use less memory. -* Changed optimizer to use array references. This made the code 'nicer' - -Mon Dec 15 17:03:43 1997 - -* Release of Mysql 3.21.17 -* mysql: Added ouput of line number on errors when running batch. -* SELECT column,SUM(expr) now returns NULL for column when there is no - matching rows. - -Sun Dec 14 14:59:46 1997 - -* Fixed create problem with fixed length records of exactly 256 bytes. - (One couldn't insert more than 1 record in such a table). - -Fri Dec 12 18:31:32 1997 - -* Added ODBC and ANSI SQL style LEFT OUTER JOIN. - The following are new reserved words: LEFT, NATURAL, USING -* Changed use of table bits and key bits to use typedefs to make it easy - to extend join tables and keys to 64. -* The client library is now using the environment variable MYSQL_HOST as - the default host if it's defined. - -Wed Dec 10 01:29:11 1997 - -* Release of 3.21.16a -* Field type SET with 33-55 elements didn't work. -* Release of 3.21.16 -* Fixed bug in ALTER TABLE when copying from DATETIME to TIMESTAMP. - (All TIMESTAMP where set to current time). - -Tue Dec 9 14:53:15 1997 - -* Added function TIME_TO_SEC() - -Mon Dec 8 09:56:44 1997 - -* Allow empty strings as default values for BLOB and TEXT to be compatible with - mysqldump. -* Added ODBC 2.0 & 3.0 functions: POWER(), SPACE(), COT(), DEGREES(), RADIANS(), - ROUND(2 arg) and TRUNCATE(). -* Added optional (ignored) argument to CURRENT_TIME() and CURRENT_TIMESTAMP(). -* LOCATE() parameters where swapped according to ODBC standard. Fixed. -* Added detection of all ODBC 3.0 functions to crash-me -* In some cases default values was not used for NOT NULL fields. -* Timestamp wasn't updated in UPDATE SET... if the timestamp was used as - a value or in the WHERE clause. - -Sun Nov 30 04:06:31 1997 - -* Renamed version.h to mysql_version.h - -Sat Nov 29 10:50:28 1997 - -* Added dayofweek() for ODBC. -* Allow DATE '1997-01-01', TIME '12:10:10' and TIMESTAMP '1997-01-01 12:10:10' - formats required by ANSI SQL. - This has the unfortunate side-effect that one can't have columns named - DATE, TIME or TIMESTAMP anymore :( -* Changed net_write() to my_net_write() because of name conflict with sybase. -* Added --no-auto-rehash option to mysql. -* Added VARBINARY as synonym for VARCHAR BINARY - -Wed Nov 26 12:53:41 1997 - -* Added framework for multiple character sorting - -Tue Nov 25 04:03:29 1997 - -* Added extra client flag to mysql_real_connect to be compatible with - MyODBC. -* Zeev fixed bug in DATE_FORMAT: It forgot to reset the null marker. - -Mon Nov 24 20:19:18 1997 - -* Fixed problem with wrong result order when using all of - DISTINCT + JOIN + ORDER BY + LIMIT. - -Sun Nov 23 14:29:54 1997 - -* mysql: edit command now allows one to edit last query in a editor; - (patch by Zeev Suraski) -* Recoded all delete item to avoid use of stack space for deletes. - (For crash-me) -* Added command: SET SQL_LOG_OFF=1 to not log commands to standard log. - This will only affect users with process list privileges. - -Sat Nov 22 13:08:55 1997 - -* Added stack checking for crash-me :) - The following failed before: select 1+1+1+1+1+.... (687 times) - -Fri Nov 21 01:50:34 1997 - -* Added new patch for Chinese Big5 code. -* Change that blobs returns the max length for a blob instead of 8192 - to the client as field_length. - -Thu Nov 20 15:37:05 1997 - -* fixed bug in range-optimizer that crashed mysql on some queries. -* table and column name completion for mysql by - Zeev Suraski and Andi Gutmans -* Fixed problem with queries that didn't find any records: This happens only - when using multiple part keys where the first part is a number and some - other part is a char or varchar. -* Removed some wrong warning messages from range optimizer - -Wed Nov 19 16:41:14 1997 - -* Added new command REPLACE, which works like INSERT but replaces conflicting - records with the new record. REPLACE INTO TABLE ... SELECT ... works also. -* Added new commands: CREATE DATABASE db_name and DROP DATABASE db_name -* Added RENAME option to ALTER TABLE: ALTER TABLE name RENAME AS new_name - -Sun Nov 16 21:41:32 1997 - -* The thread stack was overwritten if one tried to create a table with too many - fields (more than 1000). -- Table scanning was a bit slower when using LOCK TABLE xxx WRITE. Fixed. - -Thu Nov 13 03:12:54 1997 - -* ALTER TABLE forgot BINARY attribute for strings and BLOBS -* Change comparision of strings to integer to compare as floats instead - of as integers. -* Added printing of Access denied errors to log. -* Fixed some not 100% portable typedefs in mysql_com.h -* Added Luuk de Boers defines for interval handling. - This isn't compleat yet. - -Wed Nov 12 00:28:58 1997 - -* Added automatic removal of 'ODBC function conversions': {fn now() } -* Added new function DATE_FORMAT(date_expr,format). The format string is the - same one that was previously integrated with from_unix_timestamp(). -* Changed from_unix_timestamp() to call function DATE_FORMAT() with format - element. - -Mon Nov 10 18:17:39 1997 - -* Added flag for stupid ODBC applications (like access) that wants found_rows - instead of affected_rows. -* Added basic functions for handling av ANSI INTERVAL. - -Sat Nov 8 01:20:03 1997 - -* compare with DATE and TIME with NULL didn't work. (IS NULL worked) -* Added many changes from the Win32 port. -* new function: DATE_ADD_MM(). - -Wed Nov 5 13:10:10 1997 Michael Widenius - -* SORTING on calculated DOUBLE values sorted on integer results instead. -* SELECT ... WHERE KEY=constant ORDER BY ... didn't use key to retrieve - records. This was slow because everything was sorted.. -* CHECK isn't a reserved word anymore. - -Mon Nov 3 07:55:47 1997 Michael Widenius - -* Allow start of mysqld.cc without a current database. -* Changed server version to include -debug and -log if compiled with debugging - and to show that one has a logging enabled. - -Sat Nov 1 13:08:00 1997 - -* Added missing expression 'NOT IN' -* Changed the place where HAVING should be. According to ANSI it should be - after GROUP BY but before ORDER BY. MySQL 3.20 had it wrongly last. -* Added Sybase command: USE DATABASE to start using another database. -* Fixed core dump when one had a wrong password in the password column. -* Added automatic adjusting of number of connections and table cache size - if the maximum number of files that can be opened are less than needed. - This should fix that mysqld doesn't crash even if one hasn't done a - ulimit -n 256 before starting mysqld. -* Added limit checks for create table. -* Added more checks of different errors from net_read for SCO port. - -Tue Oct 28 14:30:31 1997 - -* Fixed problem when using big table_caches; MySQL could previously only - open 256 files. - -Mon Oct 27 10:02:19 1997 - -* Added options LINE STARTING WITH to LOAD DATA INFILE and - SELECT ... into outfile. Now one can do: - - LOAD DATA INFILE '/tmp/syslog.sql' INTO TABLE uptime - FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED by "'" - LINES STARTING WITH 'VALUES (' LINES TERMINATED by ');\n' ignore 100 lines - -and - SELECT * from uptime into outfile '/tmp/syslog2.sql' - FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED by "'" - LINES STARTING WITH 'INSERT INTO uptime VALUES (' LINES TERMINATED by ');\n' - -* Added IGNORE # LINES to LOAD DATA INFILE. - -* Allow \N as a shorthand of NULL in SQL statements. - -Sun Oct 26 11:34:38 1997 - -* More memory checking. -* Fixed grouping of functions with many from tables. - -Sat Oct 25 01:46:27 1997 - -* New error message so one can check if the connection was lost while - the command was running or if the connection was down from the start. -* The mysql command tool now does a automatic reconnect if the connection - was lost when it does a query. -* new command: 'mysqladmin debug'. This forces the server to dump out some - useful information to stdout. Currently it prints all lock information. -* Rewrite lexer to be faster and more easy to extend. - -Fri Oct 24 13:57:06 1997 - -* Fixed bug when like on number key. -* Added --table option to mysql to print in table format. - Moved time and row information after query result. -* Added != as an alias for <>. - -Thu Oct 23 16:00:22 1997 - -* Added function VERSION() to make easier logs. - -Tue Oct 21 00:09:13 1997 - -* Relase of 3.21.12 -* Added memory checks to all string functions to return NULL if some - string gets bigger than max_allowed_packet. This is to make MySQL more - secure. -* Fixed core dump bug on range optimizer. -* In some cases doing a join + group + INTO OUTFILE, the result wasn't - grouped. -* Now SQL_BIG_TABLES + DISTINCT is also optimized. -* Changed the syntax of ALTER TABLE ... ALTER COLUMN ident SET DEFAULT ... - (The DEFAULT keyword wasn't allowed or required before). -* Added russian error messages. - -Mon Oct 20 04:10:53 1997 - -* LIKE with '_' as last character didn't work. Fixed -* Added many error checks for 'end of memory' -* Added ENCRYPT() function by Zeev Suraski. -* Fixed better FOREIGN KEY syntax skipping. - New reserved words: MATCH, FULL, PARTIAL - -Sun Oct 19 23:13:50 1997 - -* Force .log to logfile-name if one uses hostname as logfile. -* mysqld now allows ip and hostname to the --bind-address option. - -Sat Oct 18 22:02:36 1997 - -* Added "SET OPTION CHARACTER SET cp1251_koi8" to enable conversions off - data to/from different character sets. Currently cp1251_koi8 is the only - one, but it's now trivial to add others. - Conversions: strings in the query -> intern set - fields and items in result -> terminal set - One can get back to the old one with: - SET OPTION CHARACTER SET DEFAULT -* Lots of changes for Win95 port - -Fri Oct 17 15:29:44 1997 - -* Changed the create column syntax off NOT NULL to be after the DEFAULT value - as specified in the ANSI SQL standard. This will make mysqldump with - NOT NULL and default values incompatible with MySQL 3.20. -* New reserved words are: BOTH, FOR, LEADING and TRAILING -* Added a lot of function name alias so one can use the functions with - ODBC or ANSI SQL92 syntax. -* Fixed ALTER TABLE person ALTER COLUMN phone SET DEFAULT NULL syntax. -* Added CHAR and BIT as a synonyms for CHAR(1) -* Changed the name if the INTERVAL type to ENUM, because INTERVAL is used in - ANSI SQL. -* Added extended ANSI SQL TRIM() function. -* Added CURTIME(). - -Thu Oct 16 17:26:48 1997 - -* Fixed core dump when updating as user with only select privilige. - -Wed Oct 15 04:25:47 1997 - -* INSERT ... SELECT ... GROUP BY didn't work in some cases. On got - 'Invalid use of group function' -* When using LIMIT, SELECT now always uses keys instead of record scan. - This will give better performance on SELECT and a WHERE that matches many - rows. -* Added function last_insert_id() to retreive last auto_increment value. - This is for clients to ODBC that can't use the mysql_insert_id API function. -* Added option '--flush-logs' to mysqladmin. -* Added command 'status' to mysql. -* Moved some messages from libmysql.c to errmsg.c - -Mon Oct 13 18:38:01 1997 - -* Tested on BSDI 3.0 with the newest pthread library. -* Added new group functions: BIT_OR() and BIT_AND(). -* Added compatibility functions: CHECK, REFERENCES. -* Added BIT as a synonym for CHAR(1) to get better compatibility. -* Added option ALL to GRANT for better compatibility. (GRANT is still - a dummy fuction. -* CHECK is now a reserved word. - -Fri Oct 10 17:01:25 1997 - -* Added partly translated dutch messages. -* Fixed bug in ORDER BY and GROUP BY with NULL columns - -Thu Oct 9 10:26:47 1997 - -* Added test of create of table without columns. -* Release of 3.21.10 -* Fixed a couple of bugs in the range optimizer. Now test-select works. - -Tue Sep 30 02:40:42 1997 - -* Added new function: REPEAT(string,count). -* Added patch of support of Chinese(BIG5). -* Fixed awful slowdown of libmysql.c when configuring using '--with-debug=yes' - This affected all clients that got large results from the server. - (This didn't affect using --quick or mysql_use_result). - -Sun Sep 28 20:59:41 1997 - -* Made a new function: mysql_real_connect, that takes two extra arguments: - port and socket to use on connection. -* Added text types: TINYTEXT, TEXT, MIDDLETEXT and LONGTEXT. - These are actually blobs, but all searching is done text independent. - All old BLOB fields are now TEXT fields. -* LONG VARCHAR is a synonym for TEXT. LONG BINARY is a synonym for BLOB. -* 'LONG' is now a reserved word. - -Fri Sep 26 16:11:34 1997 - -* Release of 3.21.9 -* Fixed a couple of portable problems with include files. -* Fixed bug in range calculation that could return empty - set when searching on multiple key with only one entry (very rare). - -Wed Sep 24 15:51:37 1997 - -* Changed thread scope from PROCESS to SYSTEM. This should give better - scheduling (performance) on Solaris. -* Fixed duplicated free bug in sql_base with io_cache. - -Tue Sep 23 13:05:23 1997 - -* Allow also the old SELECT ... INTO OUTFILE syntax. -* Fixed bug with group by and select on key with many values. - -Mon Sep 22 14:54:00 1997 - -* mysql_fetch_lengths() returned sometimes wrong lengths when one used - mysql_use_result(). This affected at least some cases of mysqldump --quick. - -Sun Sep 21 20:50:07 1997 - -* Fixed memory leak bug in range optimizer. - -Sat Sep 20 00:03:51 1997 - -* Allow TIME, DATE and TIMESTAMP as column names. -* Fixed bug in optimization of WHERE const op field. - -Fri Sep 19 12:06:37 1997 - -* Fixed problem when sorting on NULL fields. -* Added handling of calculation of sum() functions. -* Added handling of trigometric functions: PI(), ACOS(), ASIN(), ATAN(), - COS(), SIN() and TAN(). -* Fixed sorting of big tables for 64 bit integers (Alpha). - -Fri Aug 29 13:06:32 1997 Michael Widenius - -* Added option --pid-file=# to mysqld -* Added date formating to from_unixtime(), originally by Zeev Suraski. - -Wed Aug 27 01:35:18 1997 - -* Fixed bug when using 'unsigned long' on Alpa. - -Tue Aug 26 03:23:28 1997 - -* Added option --bind-address to mysqld. -* Changed 'Access denied' to return username and password usage. -* Changed 'Access to database denied' to return username and database. - -Sun Aug 24 22:55:24 1997 Michael Widenius - -* Changed password crypt from 31 bits to 62 bits to make passwords more - secure. -* Changed protocol to allow for passing of mysql_errno to client. - -Fri Aug 22 18:14:00 1997 - -* Fixed bug in BETWEEN in range optimizer (Did only test = of the first - argument). - -Thu Aug 21 16:40:21 1997 - -* Version 3.21.6 -* Enabled range optimizer for update and delete. Now update and delete can - use keys again. -* Fixed bug when using unknown field in group clause. - -Tue Aug 19 00:49:13 1997 - -* The range optimizer is now enabled as default. Use msyqld --skip-new - to disable it. -* numerous small fixes to the range optimzer and a couple if fixes to - group and where handling. -* Added patch from JOERG_HENNE@Non-HP-Germany-om88.om.hp.com to allow - mit-threads to work on HPUX10. (This patch is regarded alpha) - -Fri Aug 15 02:29:21 1997 - -* Remove reverse lookup of hostnames because this takes 2 seconds - one some machines for every connection! - This can be enabled with the --secure option to mysqld. - -Thu Aug 14 22:40:15 1997 - -* remove HAVING -> WHERE optimization. To fix this one has to change - all Item_ref fields to Item_fields. -* Added patch for fast TCP/IP on FreeBSD. - -Wed Aug 13 17:14:50 1997 - -* Add optimizing of SELECT DISTINCT .... LIMIT # when there is no - GROUP or ORDER BY. -* Changed mysql to only print time information if not silent or if -vvv. -* Added polish error messages - -Sun Aug 10 11:31:10 1997 - -* new function: substring_index(), originally by Zeev Suraski. -* Added new option to mysqld: -O tmp_table_size=# -* Removed all use of PTHREAD_MUTEX_INIT and PTHREAD_COND_INIT for - porting to FreeBSD 3.0 and HPUX. - -Thu Aug 7 01:24:50 1997 - -* New function from_unixtime(timestamp) which returns a date string in - YYYY-MM-DD HH:MM:DD format. -* New function sec_to_time(seconds) which returns a string in H:MM:SS format. - -Sat Aug 2 17:18:22 1997 - -* Fixed some porting issues for OSF1 and for Alpha. - Now MySQL is know to configure on OSF1 with the Dec compiler, - after changeing one line in config.h: - #define SOCKET_SIZE_TYPE int - -Wed Jul 30 11:05:39 1997 - -* Added reverse check lookup of hostnames to get better security. -* Fixed some possible buffer overflows if one uses too long filenames. -* mysqld doesn't accept hostnames that starts with digits followed by a '.' - because the hostname may look like a IP. -* Added option --skip-networking to only allow socket connections. - (This will not work with MIT threads!) - -Tue Jul 29 10:38:55 1997 Michael Widenius - -* Removed wrong free() that killed the server on 'create/drop database'. -* Changed the name of some mysqld -O options to better names. -* Added option '-O join_cache_size=#'. -* Added option '-O max_join_size=#' to be able to set a limit how big queries - (in this case big = slow) one should be able to handle without specifying - 'SQL_OPTION OPTION_BIG_SELECTS=1'. - A # = is about 10 examined records. The default is 'unlimited'. -* When comparing a TIME, DATE, DATETIME or TIMESTAMP column to a - constant the constant is converted to a time value before comparing. - This will make it easier to get ODBC and particularly Access97 to work with - the above types. It should also make dates easier to use and the compares - should be quicker than before. -* added check of too long table names for alias. - -Mon Jul 21 16:09:47 1997 Michael Widenius - -* Applied patch from Jochen Wiedmann that fixes that query() in mysqlperl now - can take queries with \0 in it. - -Sat Jul 19 01:11:38 1997 Michael Widenius - -* Store of timestamp with 2 digit year YYMMDD didn't work. -* Fix that timestamp isn't automaticly updated if set in a update clause. -* Now the automatic timestamp field is the FIRST timestamp field. - -Thu Jul 3 13:34:26 1997 - -* Added check if database name is okey. -* Addded check if too long table names. -* SELECT * INTO OUTFILE, which didn't correctly if the outfile already existed. -* 'mysql' now shows thread id when starting or doing a reconnect. -* Changed the default sort buffer size from 2M to 1M. - -Mon Jun 30 10:18:39 1997 - -* mysqladmin: One can now do 'mysqladmin kill 5,6,7,8' -* Fixed 'Packets out of order' message. This error come sometimes when the - server was out of threads/memory. Now the correct message is retrieved by - the client. -* Added more checks with thread create for 'out of memory' errors. -* Added more checks if threads is killed to get faster kill. -* Changed the default record cache from 512K to 128K to get less problem on - systems with little memory. - -Sat Jun 28 00:18:02 1997 - -* When the max connection limit is reached, one extra connection by a user with - the PROCESS_ACL privilege is granted. - -Fri Jun 27 22:03:24 1997 - -* Added new mysqld option: -O backlog=# - -Tue Jun 24 22:08:58 1997 - -* Fixed SELECT DISTINCT when using 'hidden group'. For example: - SELECT DISTINCT MOD(some_field,10) FROM test GROUP BY some_field; -* Increased max packet size from 512K to 1024K for client. -* Removed a lot of unused functions - -Mon Jun 23 22:58:07 1997 - -* Changed key_parts to have own field for shortened keys. This gives much - nicer code in select. - -Thu Jun 19 13:09:14 1997 - -* ALTER TABLE now returns warnings from field conversions. - Changed all numerical fields to check for correct number and - increment warning counts if the value is wrong. - -Wed Jun 18 22:14:36 1997 - -* Fixed buffer overflow when retrieving big packets. - -Tue Jun 17 03:26:27 1997 - -* Port changed to 3306 (got it reserved from ISI). - -Mon Jun 16 15:46:42 1997 - -* All double are now rounded before storad as integer values. -* Fixed bug when using: SELECT WHERE A=const1 OR A=const2 OR A=const3, - and const1 = const3. In this case a key over A=const1 was wrongly used and - A=const2 wasn't used. -* Added a fix for Visual Fox Base so that any schema name from a table - specification is automaticly removed. - -Sun Jun 15 12:47:23 1997 - -* The thr_alarm array is now initialized based on number of connections -* Changed some memcpy() to bmove() to get rid of some warnings from purify. -* Changed the sql_yacc.c to drop schema name from table name. This is a crude - patch to get VFP - -Sat Jun 14 12:04:59 1997 - -* fixed missed ptr variable in filesort. -* Fixed wrong tablename and record count EXPLAIN. -* Changed the 'key use' test to prefere keys even more over full join. -* Fixed LIKE to work for binary strings. - -Fri Jun 13 13:38:14 1997 - -* New function char(num,....). - -Wed Jun 11 14:53:17 1997 - -* All field types tested with extrema values. date_time and timestamp - now require at least year, month and day on insert. - -Mon Jun 9 01:23:36 1997 - -* Added French error messages (by Therrien, Gilbert). English is still default. -* Added option '--skip-name-resolve' to get mysqld to use only IP's to - autenticate a host. 'localhost' will still be used for local UNIX sockets. -* Removed the between() function. On should use the 'col BETWEEN a AND b' - syntax instead. - -Sun Jun 8 11:05:46 1997 - -* New function ASCII. - -Sat May 31 01:00:18 1997 - -* host names are now compared case insensitive. - -Wed May 28 13:04:00 1997 - -* HAVING is added to WHERE if there is no grouping. -* MySQL now doesn't anymore have to use a extra temporary table when sorting - on functions or SUM functions. - -Tue May 27 00:54:51 1997 - -* Added function to print a item for debugging purposes. -* Fixed bug that one couldn't use 'table_name.field_name' in UPDATE. -* Removed init code with reset some of the mysqld -O variables to default after - they where set by start options. - -Thu May 22 14:52:26 1997 - -* Added varbinary syntax: 0x###### which can be used as a string (default) or a - number. - -Sun May 18 22:00:58 1997 - -* mysqldump: added options to lock tables and specify many tables to dump -* Add support of NULL fields in filesort -* SELECT with COUNT(),MIN() .... with no matching rows now returns 1 row. - -Sat May 17 22:06:29 1997 - -* New operator IN. This uses a binary search to find a match. -* Added 'SET OPTION SQL_BIG_TABLES= (0 | 1). Setting this to 1 will force - all temporary tables to disk. This will allow one to do big selects that - ordinary would give a 'table full' error. - -Fri May 16 18:53:21 1997 - -* New command LOCK TABLES table_name [alias] (READ | WRITE), .... - -Wed May 14 14:33:07 1997 - -* Renamed FIELD_TYPE_CHAR to FIELD_TYPE_TINY - -Mon May 12 09:54:24 1997 - -* Added command --log-update to get a update log for incremental backups. -* log file rotation for mysqld. -* log file for incremental backups -* new command: DESCRIBE SELECT .... -* Removed mysql_reload() and added mysql_refresh() instead. - Left a define to get old source to compile. - -Fri May 9 10:41:36 1997 - -* All functions now regards a binary type as 'sticky'. -* The time is now only requested once at start of each query. -* Splitted item_func.cc in two tables to get around that gcc uses too - much memory compiling it. -* Changed MIN() and MAX() to return the original type. -* Fixed bug in acl with anonymous user: Now if one gets accepted by the user - table as a empty user name, the user name is set to '' when checking against - the 'db' and 'host' tables. -* calculate all const expressions in the first optimizer pass. - -Tue May 6 19:16:56 1997 - -* Fixed ORDER BY bug when selecting on very small tables that made the - optimizer use a full join. - -Mon May 5 00:15:52 1997 - -* Added use of table alias in insert, delete and update. -* Removed FIELD_TYPE_TINY_BLOB, FIELD_TYPE_MEDIUM_BLOB, FIELD_TYPE_LONG_BLOB, - FIELD_TYPE_VAR_STRING from client code. -* Change syntax of SELECT .. WHERE ... INTO OUTFILE .. to the more standard - SELECT .. INTO OUTFILE 'name' WHERE ... - -Thu May 1 23:16:14 1997 - -* Added new API functions: - mysql_row_seek(),mysql_row_tell() and mysql_field_tell(). - mysql_field_seek() now returns old offset. -* Added expr BETWEEN expr2 AND expr3. - -Sun Apr 27 16:16:17 1997 - -* Changed range() detection to get queries on prefix to works faster. - Now SELECT name FROM table WHERE name="prefix" is quick even if there - are lots of rows where name starts with prefix. -* Fixed crash with shutdown and --log-isam -* Added group function STD() (standard derivation). -* mysql.cc: Fixed that NULL columns are always at least 4 wide for nicer output - of NULL values. -* Fixed that calculations that are not in GROUP BY works as expected. - (ANSI SQL extension) - Example: SELECT id,id+1 FROM table GROUP BY id - -Thu Apr 24 13:41:01 1997 Michael Widenius TcX DataKonsulter AB - -* Fixed convert bug which got mysqld to core dump with Aritmetic error on - Sparc-386 - -Wed Apr 23 12:11:05 1997 Michael Widenius TcX DataKonsulter AB - -* Added tty password to mysqlshow.c - -Tue Apr 22 15:44:11 1997 Michael Widenius TcX DataKonsulter AB - -* The test of using MYSQL_PWD was reversed. Now MYSQL_PWD is enabled as default - in the default release - -Sun Apr 20 14:36:39 1997 - -* Now one usually only have to give --basedir to mysqld. All other paths - are relative in a normal installation. -* BLOBs contained sometimes garbage when used with a SELECT on more than - one table and ORDER BY. -* Added option --unbuffered to mysql. (For new mysqlaccess) -* 'select *' without tables crashed server. -* When using overlapping (unnecessary keys) and join over many tables - the optimizer could get confused and return 0 records. -* Changed safe_mysqld to allow one to move installed releases. - -Sun Apr 13 10:40:50 1997 - -* Release 3.20.17 -* Added new function unix_timestamp([timestamp_column]) - -Sat Apr 12 11:27:57 1997 - -* Fixed memory over run bug when using selects with many brace levels. -* Change from_days() and weekday() to also take a full timestamp or - a datetime as argument. Before they only took a number of type YYYYMMDD or - YYMMDD. - -Wed Apr 9 13:22:24 1997 Michael Widenius - -* Changed stack usage to use less memory. -* All communication packages and row buffers are now alloced on demand. - The default communication buffers are now smaller than before. -* count(field) where field could have a NULL value didn't work. -* IS NULL and IS NOT NULL now work in the WHERE. -* BLOBs now work in the WHERE. -* Remove pre-space from numbers when writing decimal() coulmns to file. -* INSERT INTO ... SELECT .. WHERE could give the error 'Dupplicated field' - -Tue Apr 8 16:14:54 1997 Michael Widenius - -* Added commands SET OPTION SQL_SELECT_LIMIT=# to provide framework - for options and to get some ODBC things to work. -* Fixed bug in SELECT ... two tables ... GROUP BY -* Fixed bug in INSERT ... SELECT ... GROUP BY -* Fixed bug in acl: To use FILE_PRIV one also had to have SELECT PRIV - in the user grant table. -* Fixed fatal bug in ranged querie with OR when one part of the query didn't - have any matching records. - -Mon Apr 7 16:03:00 1997 Michael Widenius - -* Now connections are allowed even if hostname isn't found. - In this case all hostname checks are done on IP. -* When doing insert on timestamps, the timestamp was set to the - current time even if updated by a value. -* Fixed LOAD DATA.. that if one has COLUMN TERMINATED BY to be same as - LINE TERMINATED BY, then LINE TERMINATED BY is set to a empty string. - This wasn't a bug, but a common mistake when reading columns separated - with newlines. - -Sun Apr 6 22:37:53 1997 Michael Widenius - -* Changed definition of function ELT as it should have been: - ELT(index,element,element,element....) now returns the index:s - element in the list. The first element has index 1. - FIELD(find,string,string,string) searches after the 'find' string - in the string list and returns a index to the found string. - The strings are compared case insensitive. -* Added some tests to safe_mysqld to make it 'safer' - -Fri Apr 4 02:17:40 1997 Michael Widenius - -* When sorting the db grant table, host wasn't sorted. - -Wed Apr 2 03:00:14 1997 Michael Widenius - -* Fixed case 'WHERE key_num_column = "string"' -* LIKE was case sensitive in some places and case insensitive in other. - Now LIKE is always case insensitive. -* Fixed bug in select optimizer when using many tables with the same - column used as key to different tables. - -Sun Mar 30 21:22:39 1997 Michael Widenius - -* mysql.cc; Allow '#' anywhere on the line. - -Thu Mar 27 02:42:12 1997 Michael Widenius - -* Added new latin2 and Russian KOI8 character tables. -* Added support for a dummy GRANT command satisfy Powerbuilder. - -Wed Mar 26 03:03:07 1997 Michael Widenius - -* Release of 3.20.15 -* Removed possible loop when thread waits for command from client - and fcntl() fails. Thanks to Mike Bretz for finding this bug - -Tue Mar 25 18:03:15 1997 Michael Widenius - -* Changed alarm loop in mysqld.cc because shutdown didn't always - succeed in Linux. -* Removed use of termbits from mysql.cc This conflicted with glibc 2.0 -* Fixed syntax error in get_password.c (for BSD). Added flush of line. -* Added test if 'linux' style gethostbyaddr_r in mysqld.cc -* Fixed bug when doing a select as superuser without a database. -* Fixed bug when doing SELECT with group calculation to outfile. - -Mon Mar 24 16:03:01 1997 Michael Widenius - -* Release of 3.20.14 -* Added new function SOUNDEX() -* If one gives '-p' or -password to mysql or mysqladmin without an argument, - the password will be asked from the tty. - -Sun Mar 23 00:19:42 1997 Michael Widenius - -* Sometimes when doing a reconnect on a down connection this succeded - first on second try. Fixed by removing handling of SIGPIPE in client. -* When adding a auto_increment key with ALTER_TABLE on got the error: - 'Can't write, duplicate key'. - -Sat Mar 22 22:55:12 1997 Michael Widenius - -* AVG() gave too small value on some selects with GROUP BY and ORDER BY. - -Fri Mar 21 12:27:32 1997 Michael Widenius - -* Added new DATETIME type (by Giovanni Maruzzelli ) -* Fixed that define 'DONT_USE_DEFAULT_FIELDS' works -* Added default password from MYSQL_PWD. (by Elmar Haneke) -* Changed C++ code to be compatible with Sun Workshop - -Thu Mar 20 12:28:06 1997 Michael Widenius TcX DataKonsulter AB - -* Changed to use a thread to handle alarms instead of signals on Solaris to - avoid race conditions. -* Fixed default length of signed numbers. (George Harvey ) -* Added commando 'kill' to mysqladmin to kill a specific mysql thread. - -Wed Mar 19 12:21:33 1997 Michael Widenius TcX DataKonsulter AB - -* sql_base.cc: Allow anything for CREATE INDEX. - -Mon Mar 17 19:54:11 1997 Michael Widenius TcX DataKonsulter AB - -* Add prezeros when packing numbers to DATE, TIME and TIMESTAMP. -* Fixed the OR bug for good. - -Fri Mar 14 11:46:54 1997 Michael Widenius - -* Release 3.20.13 -* Added changes by bonis@kiss.de to allow WHERE const op field -* Fixed bug in mysql.c when reading long commands from batch. -* mysqldump.c - Changed newlines, return and ASCII 0 to "\n", "\r" and "\0", - to allow restoring of columns with these. - -Thu Mar 13 20:02:53 1997 Michael Widenius - -* Fixed bug in select with and-or levels. - -Mon Mar 10 04:04:03 1997 Michael Widenius - -* Added support for Slovenian characters. -* Fixed bug with limit and order by. -* Allow order and group on items that isn't in the select list. - -Sun Mar 9 00:21:36 1997 Michael Widenius - -* Added ANSISQL94 DATE and TIME types. Changed TIMESTAMP fields to work better - when updateing it with a number. - -Sat Mar 8 20:19:21 1997 Michael Widenius - -* Allow setting of timestamp values in INSERT. -* Fixed bug with SELECT ... WHERE ... = NULL. -* Added changes for glibc 2.0 - -Fri Mar 7 07:53:01 1997 Michael Widenius - -* Fixed bug in alter table when changeing a not null field to allow NULLs. -* Added HAVE_READDIR_R as a define which can be removed if one has - a broken readdir_r implementation (Sparc/Linux). - -Thu Mar 6 21:06:02 1997 Michael Widenius - -* Added some ANS92 synonyms as field types to CREATE TABLE. - CREATE TABLE now allows FLOAT(4) and FLOAT(8) to mean FLOAT and DOUBLE. - -Wed Mar 5 00:41:29 1997 Michael Widenius - -* Release 3.20.11 -* Added sync of records count in sql_update. This fixed slow updates on first - connection. (Thanks to Vaclav Bittner for the test) -* Changed temporary file prefix from UN to MY. -* When using SELECT .... INTO OUTFILE all temporary tables are ISAM instead of - HEAP to allow big dumps. -* Changed date functions to be 'string functions'. This fixed some 'funny' - side effects when sorting on dates. - -Tue Mar 4 23:07:03 1997 Michael Widenius - -* Changed FOREIGN KEY to not create a key. Now it's only for compability. -* Extended ALTER TABLE according to SQL92. -* Some minor compability changes. -* Added --port and --socket to all utility programs and mysqld. - -Sat Feb 15 01:27:51 1997 Michael Widenius - -* Added Oracle command DESCRIBE (DESC) as a synomym for some SHOW commands: - DESC table_name <==> SHOW FIELDS FROM table_name - DESC table_name column <==> SHOW FIELDS FROM table_name LIKE 'column' - DESC table_name 'column' <==> SHOW FIELDS FROM table_name LIKE 'column' - mysql.cc thought that tinyblob, mediumblob and longblob was numerical. - (Was right adjusted) - -Thu Feb 13 00:49:29 1997 Michael Widenius - -* mediumblob didn't work. -* Fixed safe_mysqld and make_binary_distribution to work better. -* ALTER TABLE and changeing a BLOB to a CHAR() added some garabage at - string end. - -Wed Feb 12 16:10:49 1997 Michael Widenius - -* new insert type: INSERT INTO ... SELECT ....; - -Tue Feb 11 12:58:36 1997 Michael Widenius - -* Fixed some defines to get mysql to compile on freebsd 2.0 (intel) -* Removed all _A() from prototype declaration. -* Removed use of ulong in mysql.h and mysql_com.h -* Changed mysqldump to dump keynames. -* SELECT ... INTO OUTFILE 'test' create the file in the base directory - instead in database directory (if one didn't give a full path) -* A primary key is now defined as a key with name PRIMARY or the first - unique key if there doesn't exist a key with name PRIMARY. - -Mon Feb 10 00:40:48 1997 Michael Widenius - -* Fixed leak bug when using LOAD DATA into a blob with is sometimes NULL. -* DROP TABLE can now take a list of tables. -* If a databas was crashed, in some cases a read of the wrong record - was used as a 'end of file', instead of returning an error. - -Sat Feb 8 00:16:07 1997 Michael Widenius - -* merged structs field_t and FIELD to FIELD. - -Fri Feb 7 12:49:01 1997 Michael Widenius - -* version 3.20.9 -* Alter table didn't copy null bit. This resulted that NULL fields where - always NULL. -* CREATE didn't take numbers as DEFAULT. - -Wed Feb 5 13:28:19 1997 Michael Widenius - -* New scripts 'add_file_priv' which add the new field 'file_priv' - to the user table. This scripts must be executed if one wants to - use the new SELECT ... INTO and LOAD DATA INFILE... commands - with a version of mysql less than 3.20.7. -* Found bug in locking code when another thread got a table opened - by another thread. This could make a thread block forever wating - for a write lock. - -Tue Feb 4 00:57:24 1997 Michael Widenius - -* Changed select_test.c and insert_test.c to include config.h - -Mon Feb 3 00:42:08 1997 Michael Widenius - -* Add an optional keyname for all key declarators. - -Sat Feb 1 19:02:43 1997 Michael Widenius - -* Added command 'status' to mysqladmin for short logging. -* Increased max keys to 16 and max key parts to 15. - -Fri Jan 31 00:05:23 1997 Michael Widenius - -* Added ANSI92 extended ALTER TABLE statement. -* Changed all locking code to detect ALTER table after one got a lock. - Tables are automaticly reopened if ALTERed. -* Changed some structs to classes to get better code when using CREATE TABLE. - -Thu Jan 30 01:12:13 1997 Michael Widenius - -* Added new privilege to the user grant table: file_priv -* Added some compitibility changes to mysql.cc -* Added new syntax for creating keys with is a sub part of some field. -* Did a lot of changes to get around bug when comparing fields of - different lengths. Hope I didn't break something else :) -* Added long options to mysqldump. -* Added new function NOW(). - -Wed Jan 29 15:51:22 1997 Michael Widenius - -* Added option -k for mysqlshow to get key info for table. -* Changed some definitions from int to uint in mysql.h to get fewer warning - with prolint. - -Mon Jan 27 02:01:29 1997 Michael Widenius - -* Added sql command 'load data infile...' for export from textfiles. -* Added new API function mysql->info to pass info to client. -* Added INTO OUTFILE as option to select to get result to file. - -Fri Jan 24 14:56:19 1997 Michael Widenius - -* Relase 3.20.5-beta -* Got first version to work which MIT-threads. -* Added long options to mysqld -* mysqld now starts without system locking if compiled with MIT threads. -* Added new sql function RAND([init]) -* Changed sql_lex to handle \0 unquoted, but the client can't send - the query through the C api, because it takes a str pointer. - one have to use mysql_real_query() to send the query. - -Thu Jan 23 00:33:26 1997 Michael Widenius - -* Added API function: mysql_get_client_info -* mysqld now uses the N_MAX_KEY_LENGTH from nisam.h as the max allowed key - length. -* The following now works: "select filter_nr,filter_nr from filter order by - filter_nr" - Before you got the error: "Column: 'filter_nr' in order clause is ambiguous" - -Wed Jan 22 14:48:58 1997 Michael Widenius - -* Changed fctnl flag O_NDELAY to O_NONBLOCK (Posix, and to get MIT threads - to work) - -Tue Jan 21 12:31:17 1997 Michael Widenius - -* mysql now outputs \0 \t \n and \\ when writing tab separated output. - when encountering ascii 0, tab, newline or \. This is to allow printing of - binary data in a portable format. - To get old behavior use -r (or --raw). -* Added long options to mysqladmin, mysql and mysqlshow. -* Added german error messages (60 of 80 error messages translated) -* Added new api function: mysql_fetch_lengths(MYSQL_RES *) which - returns a array of of column lengths (of type uint). - -Sat Jan 18 23:59:53 1997 Michael Widenius - -* Fixed bug with IS NULL in where clause. - -Fri Jan 17 12:14:38 1997 Michael Widenius - -* Changed the optimizer a little to get better results when searching on a key - part. -* Added select option STRAIGHT_JOIN to tell the optimizer that it should join - tables in the given order. - -Thu Jan 16 00:55:41 1997 Michael Widenius - -* Added support of comment starting with '--' in mysql.cc (Postgres syntax) -* You can now have select_expressions and table columns in a select which - are not used in the group part. This makes it efficient to implement lookups. - If the not used column is not a constant for the group the column value - is unspecified. - Example: SELECT id,lookup.text,sum(*) FROM test,lookup - WHERE test.id=lookup.id group by id; - -* Fixed bug in sum(function) (Could make core dump) -* Changed auto_increment according to SQL_SYNTAX: - INSERT into table (auto_field) values (0) inserted 0, but the SQL_SYNTAX - statied it should insert a auto_incremnt value. - -Wed Jan 15 10:42:09 1997 Michael Widenius - -* mysqlshow.c: Added number of records in table. Had to change the client code a - little to fix this. -* mysql now allows double '' or "" in strings for embedded ' or ". -* Changed copyright text in mysqlshow and mysqladmin. - -Mon Jan 13 02:33:09 1997 Michael Widenius - -* Relase 3.20.3 -* Using the new readline library from bash. -* Updated a lot of text files. -* safe_mysqld and mysql.server changed to be more compatible between the - source and the binary releases. - -Sun Jan 12 18:23:30 1997 Michael Widenius - -* LIMIT takes now one or two numerical arguments. - If one argument the argument indicates the maximum number of rows in a result. - If two arguments the first arguments says the offset to the first row to return, - the second is the maximum number of rows. - With this it's easy to do a poor mans next page/previous page www application. -* Changed name of SQL function FIELDS to ELT. -* Made SHOW COLUMNS a synonym for SHOW FIELDS. - Added compatibility syntax FRIEND KEY to create table. This creates in mysql - a non unique key on the given columns. -* Added CREATE INDEX and DROP INDEX as compatibility functions. In mysql - CREATE INDEX only checks if the index exists and gives an error if it doesn't - exists. DROP INDEX always succeeds. - -Sat Jan 11 00:44:29 1997 Michael Widenius - -* mysqladmin.c: Added client version to version info. - -Fri Jan 10 20:30:04 1997 Michael Widenius - -* Fixed core dump bug in sql_acl (core on new connection). -* Removed host,user and db tables from database test in the distribution. -* FIELD_TYPE_CHAR can now be signed (-128 - 127) or unsigned (0 - 255) - Before it was always unsigned. - -Thu Jan 9 00:02:03 1997 Michael Widenius - -* Changed name from mysqllib to mysqlclient for mysql client lib. -* The following failed: concat(1,concat(2),2). - Could not call a variable argument function in a variable argument count - function. Fixed. - -Wed Jan 8 15:58:49 1997 Michael Widenius - -* weekday() returned wrong day 6 of 7 times. - -Mon Jan 6 23:49:31 1997 Michael Widenius - -* changed a lot of source to get mysqld to be compiled with SUNPRO compiler. -* sql functions must now have a '(' directly after the function name. - user '(' is now regarders as an identifier and a '(' - -Fri Jan 3 12:18:14 1997 Michael Widenius - -* Fixed possible bug when sorting with float and double. - Changed static sort_length to thread variable. This may have caused some - big sorts to fail when running two simultaneous sorts. -* Changed sql function INTERVALL() to INTERVAL(). - -Wed Jan 1 16:18:30 1997 Michael Widenius - -* Added some portability files for testing with RTS threads. -* Lot of changes for configure. - -Sun Dec 29 13:26:52 1996 Michael Widenius - -* Remove Makefile-linux-pl and Makefile-solaris-pl from the binary distribution. - Now only Makefile.PL is needed. - -Sat Dec 28 22:41:09 1996 Michael Widenius - -* Fixed that insert with a timestamp set to NULL works. (This is for a cleaner - syntax) - -Fri Dec 27 01:28:02 1996 Michael Widenius - -* mysqld now has english & swedish error messages. -* unireg files moved to sql directory changed to c++. - -Thu Dec 26 11:57:57 1996 Michael Widenius - -* mysqld: Added option 'b' for mysql basedir. All given directories is - prefixed with this if not given with hard path. - added option '-L' (language). Default is 'english/' - Moved all unireg files to sql directory. - -Fri Dec 20 11:05:37 1996 Michael Widenius TcX DataKonsulter AB - -* Changed lex to allow a database name, table name and field name to start with - number or '_'. - -* mysqldump should now be able to dump all field types. - Changed 'show fields from table' to be fully compatible with create. -* Some bugs when parsing 'create table' fixed. (Blobs and timestamps was effected) -* Fixed one possible dead lock bug when using many tables. -* Changed a lot for configure - -Sun Dec 15 02:29:53 1996 Michael Widenius - -* Added new functions: INSERT(),RTRIM(),LTRIM(),FORMAT(). - -* New relase 3.19.5 -* Added functions DATABASE(),USER(),POW(),LOG10() (needed for ODBC). - -Sat Dec 14 10:10:42 1996 Michael Widenius - -* In a WHERE with a ORDER BY on fields from only one table the table is - now preferred as first table in a multi-join. -* HAVING and IS NULL or IS NOT NULL now works. -* a group on one column and a sort on a group function (SUM,AVG...) didn't - work together. Fixed. - -Fri Dec 13 07:20:47 1996 Michael Widenius - -* mysqldump: Didn't send password to server. - -* New relase 3.19.4 -* Fixed horrible locking bug when inserting in one thread and reading - on another thread. -* Fixed one-off decimal bug. 1.00 was outputed as 1.0 -* Added attribute 'Locked' to process list as info if a query is - locked by another query. -* Fixed full magic timestamp. Timestamp length may now be 14,12,10,8,6,4 or 2. - -Thu Dec 12 18:14:57 1996 Michael Widenius - -* sort on some number functions could be sorted wrong on last number. -* if(arg,syntax_error,syntax_error) crashed. -* added functions ceiling() and round(), exp(), log() and sqrt() -* enchanted BETWEEN to handle strings. - -Wed Dec 11 09:09:02 1996 Michael Widenius - -* MYODBC: Sometimes password test failed because of faulty charactermap in - windows. - -Mon Dec 9 12:50:56 1996 Michael Widenius - -* new relase 3.19.3 -* Fixed that select with grouping on blob's doesn't return wrong blob info. - grouping, sorting and distinct on blobs will not yet work as expected - (Probably it will group/sort by the first 7 characters in the blob) - Groping on formulas with a fixed string size (use mid on blob) should work. -* When doing a full join (no direct keys) on multiple tables with blob fields, - the blob was garbage on output. -* Fixed distinct with calculated columns. - -Sun Dec 8 19:53:24 1996 Michael Widenius - -* Fixed bug when allocation string for group -* new release 3.19.2 -* mysqldump.c: Didn't output ' around blobs. - -Sat Dec 7 13:00:43 1996 Michael Widenius - -* Added user flag to mysqldump & mysqlshow. -* ODBC: Added full support of SQLGetInfo(). Fixed limit bug (from 1.0.3). - myodbc-1.0.4 released - -Fri Dec 6 01:35:22 1996 Michael Widenius - -* ODBC: Added more support SetStmtOptions(). Added more debugging code - myodbc-1.0.3 released - -Tue Dec 3 22:12:30 1996 Michael Widenius - -* Added 'max_connections' and 'table_cache' as start variables to mysqld. -* Changed weights in join optimizer: Now prefers to use keys even more: - Before the optimizer would prefer to do a full join on small tables - (< 300 records), even if there was a usable key. - -Mon Dec 2 00:17:42 1996 Michael Widenius - -* new release 3.19.1 -* Fixed bug when joining tables without keys and null fields and varchars. - (mysqld hang) -* Fixed output of 'mysql show'. All fields was 'unsigned zerofill'. - -* new release 3.19.0 -* Added new column specifier AUTO_INCREMENT. -* Changed format of sql command 'show fields'. -* Changed mysqlshow to use sql command 'show fields' to get more info. -* Added synonym RLIKE for REGEXP to be compatible with mSQL - -Sun Dec 1 12:53:05 1996 Michael Widenius - -* item_func.cc (fix_fields): Fixed new bug when calculation and levels. - Crashed stack when optimizing where! (fatal bug in 3.18.1) - -Fri Nov 29 00:32:09 1996 Michael Widenius - -* Distribution 3.18.1 -* Fixed optimizeing bug. -* New ODBC version with traceing in all functions with isn't supported yet - for easier debugging. Added NO WARRANTY info. - Released as 1.0.2 - -Wed Nov 27 17:18:51 1996 Michael Widenius TcX DataKonsulter AB - -* Added Henry Spencer's regexp in 'field REGEXP string'. Can only be used - in select_expression or HAVING until I fix the where clause. - -Mon Nov 25 20:01:05 1996 Michael Widenius TcX DataKonsulter AB - -* Created files: CREDITS, PUBLIC. Updated FAQ, README, TODO, SQL_SYNTAX... -* Done a lot of testing on HAVING. - -Sun Nov 24 00:45:07 1996 Michael Widenius - -* mysql didn't stop on error in batch mode even if -f wasn't used. -* Fixed DBD Makefile.PL for linux -* Added a function.tst & function.res (test and result file of mysql functions) -* libmysql.c: Added some checking for calls after connection has gone done. -* Implemented HAVING with full expr syntax -* Changed operators '=, - -Sat Nov 23 20:52:42 1996 Michael Widenius - -* SQL_SYNTAX added 'like' as a boolean expression in select. -* mysqladmin.c: 'mysqladmin garbage' didn't give an error. -* sql_insert.cc: If one read a deleted record and did a insert with all fields - then the new record was marked deleted. -* perl DBI interface ported. - -Thu Nov 21 00:58:44 1996 Michael Widenius - -* mysql only used the TCP connection, no socket was ever created -* There was a bug in when reading from getenv(MYSQL_TCP_PORT) -* Added some more start-logging to check for port & socket. -* If something got wrong at startup some threads was kept alive in Linux -* If argument -h to mysqld is a relative path, change it to './' -* Search after the 'unireg' directory from: current dir, - mysqld program dir/.. and in env(MY_BASEDIR_VERSION) -* Added longlong support to Linux -* Added copyright notices to all files. Everything should be ready for - distribution. - -Wed Nov 20 19:03:02 1996 Michael Widenius - -* Added function IF. -* Added select without FROM clause (for easy test of functions) - -Tue Nov 19 11:48:55 1996 Michael Widenius - -* mysql.c: Sometimes 'in-string' was not initialized. -* linux distribution - -Mon Nov 18 13:47:09 1996 Michael Widenius - -* Fixed blob:s to work (as varchar) in ODBC (myodbc-1.0.1.zip) -* Added option -O to set buffer sizes to mysqld - -Wed Nov 13 15:21:14 1996 Michael Widenius - -* New sql functions: REPLACE, LCASE and UCASE -* hacked search on '%xxx' to work. - -Tue Nov 12 00:52:35 1996 Michael Widenius - -* mysql.cc: Fixed problems with strings containing not backslashed ' or ". - -Mon Nov 11 14:52:30 1996 Michael Widenius - -* added braces to where clause. Change where to use items. - -Wed Nov 6 00:17:37 1996 Michael Widenius - -* added PRIMARY KEY, KEY and UNIQUE to sql create. diff --git a/sql/des_key_file.cc b/sql/des_key_file.cc index d9c924b5a3c..891cf18ee53 100644 --- a/sql/des_key_file.cc +++ b/sql/des_key_file.cc @@ -104,4 +104,15 @@ error: VOID(pthread_mutex_unlock(&LOCK_des_key_file)); DBUG_RETURN(result); } + + +void free_des_key_file() +{ + if (initialized) + { + initialized= 01; + pthread_mutex_destroy(&LOCK_des_key_file); + } +} + #endif /* HAVE_OPENSSL */ diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index b1cb45be6b3..a25aedaa89f 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -830,6 +830,7 @@ innobase_end(void) err = innobase_shutdown_for_mysql(); hash_free(&innobase_open_tables); my_free(internal_innobase_data_file_path,MYF(MY_ALLOW_ZERO_PTR)); + pthread_mutex_destroy(&innobase_mutex); if (err != DB_SUCCESS) { diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 0a419879e3a..19e97c60dd3 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -497,7 +497,7 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt) (uint) (T_RETRY_WITHOUT_QUICK | T_QUICK))) { param.testflag&= ~T_RETRY_WITHOUT_QUICK; - sql_print_error("Warning: Retrying repair of: '%s' without quick", + sql_print_error("Note: Retrying repair of: '%s' without quick", table->path); continue; } @@ -505,7 +505,7 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt) if ((param.testflag & T_REP_BY_SORT)) { param.testflag= (param.testflag & ~T_REP_BY_SORT) | T_REP; - sql_print_error("Warning: Retrying repair of: '%s' with keycache", + sql_print_error("Note: Retrying repair of: '%s' with keycache", table->path); continue; } @@ -515,7 +515,7 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt) !(check_opt->flags & T_VERY_SILENT)) { char llbuff[22],llbuff2[22]; - sql_print_error("Warning: Found %s of %s rows when repairing '%s'", + sql_print_error("Note: Found %s of %s rows when repairing '%s'", llstr(file->state->records, llbuff), llstr(start_records, llbuff2), table->path); diff --git a/sql/hostname.cc b/sql/hostname.cc index be035e52ac1..ed56e199c3c 100644 --- a/sql/hostname.cc +++ b/sql/hostname.cc @@ -27,7 +27,9 @@ extern "C" { // Because of SCO 3.2V4.2 #endif #if !defined( __WIN__) && !defined(OS2) +#if !defined(__NETWARE__) #include +#endif /* __NETWARE__ */ #ifdef HAVE_SYS_UN_H #include #endif diff --git a/sql/item.h b/sql/item.h index 67dcc8ad7b8..b690807691f 100644 --- a/sql/item.h +++ b/sql/item.h @@ -86,6 +86,9 @@ public: virtual bool is_null() { return 0; } virtual unsigned int size_of()= 0; virtual void top_level_item() {} + virtual void set_result_field(Field *field) {} + virtual bool is_result_field() { return 0; } + virtual void save_in_result_field(bool no_conversions) {} }; @@ -356,12 +359,19 @@ public: table_map used_tables() const { return 1; } virtual void fix_length_and_dec()=0; unsigned int size_of() { return sizeof(*this);} + void set_result_field(Field *field) { result_field= field; } + bool is_result_field() { return 1; } + void save_in_result_field(bool no_conversions) + { + save_in_field(result_field, no_conversions); + } }; class Item_ref :public Item_ident { public: + Field *result_field; /* Save result here */ Item **ref; Item_ref(char *db_par,char *table_name_par,char *field_name_par) :Item_ident(db_par,table_name_par,field_name_par),ref(0) {} @@ -407,6 +417,12 @@ public: enum Item_result result_type () const { return (*ref)->result_type(); } table_map used_tables() const { return (*ref)->used_tables(); } unsigned int size_of() { return sizeof(*this);} + void set_result_field(Field *field) { result_field= field; } + bool is_result_field() { return 1; } + void save_in_result_field(bool no_conversions) + { + (*ref)->save_in_field(result_field, no_conversions); + } }; diff --git a/sql/item_func.cc b/sql/item_func.cc index 78885038654..02ae03b217f 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1509,6 +1509,7 @@ void item_user_lock_init(void) void item_user_lock_free(void) { hash_free(&hash_user_locks); + pthread_mutex_destroy(&LOCK_user_locks); } void item_user_lock_release(ULL *ull) diff --git a/sql/item_sum.cc b/sql/item_sum.cc index bdf48b3ac54..222dd0a3a25 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1089,7 +1089,7 @@ bool Item_sum_count_distinct::add() if (always_null) return 0; copy_fields(tmp_table_param); - copy_funcs(tmp_table_param->funcs); + copy_funcs(tmp_table_param->items_to_copy); for (Field **field=table->field ; *field ; field++) if ((*field)->is_real_null(0)) diff --git a/sql/log.cc b/sql/log.cc index 58f5298dad0..01bd08956fb 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -96,9 +96,16 @@ MYSQL_LOG::MYSQL_LOG() MYSQL_LOG::~MYSQL_LOG() +{ + cleanup(); +} + +void MYSQL_LOG::cleanup() { if (inited) { + close(1); + inited= 0; (void) pthread_mutex_destroy(&LOCK_log); (void) pthread_mutex_destroy(&LOCK_index); (void) pthread_cond_destroy(&update_cond); @@ -1430,6 +1437,10 @@ void MYSQL_LOG:: wait_for_update(THD* thd) at once after close, in which case we don't want to close the index file. We only write a 'stop' event to the log if exiting is set + + NOTES + One can do an open on the object at once after doing a close. + The internal structures are not freed until cleanup() is called */ void MYSQL_LOG::close(bool exiting) diff --git a/sql/my_lock.c b/sql/my_lock.c index 4d451fcff22..7f47256703a 100644 --- a/sql/my_lock.c +++ b/sql/my_lock.c @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __EMX__ +#if defined(__EMX__) || defined(__NETWARE__) #include "../mysys/my_lock.c" #else diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 75bf4e97634..4076008cd04 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -397,7 +397,7 @@ int mysql_select(THD *thd,TABLE_LIST *tables,List &list,COND *conds, ulong select_type,select_result *result); int mysql_union(THD *thd,LEX *lex,select_result *result); Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, - Item_result_field ***copy_func, Field **from_field, + Item ***copy_func, Field **from_field, bool group,bool modify_item); int mysql_create_table(THD *thd,const char *db, const char *table_name, HA_CREATE_INFO *create_info, @@ -474,6 +474,7 @@ extern struct st_des_keyschedule des_keyschedule[10]; extern uint des_default_key; extern pthread_mutex_t LOCK_des_key_file; bool load_des_key_file(const char *file_name); +void free_des_key_file(); #endif /* HAVE_OPENSSL */ /* sql_do.cc */ @@ -700,6 +701,7 @@ extern struct rand_struct sql_rand; extern SHOW_COMP_OPTION have_isam, have_innodb, have_berkeley_db; extern SHOW_COMP_OPTION have_raid, have_openssl, have_symlink; extern SHOW_COMP_OPTION have_query_cache, have_berkeley_db, have_innodb; +extern SHOW_COMP_OPTION have_crypt; #ifndef __WIN__ extern pthread_t signal_thread; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index ee3eb13d833..18e44eff2a8 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB +/* Copyright (C) 2000-2003 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -79,7 +79,9 @@ extern "C" { // Because of SCO 3.2V4.2 #if defined(OS2) # include #elif !defined( __WIN__) +# ifndef __NETWARE__ #include +# endif /* __NETWARE__ */ #ifdef HAVE_SYS_UN_H # include #endif @@ -117,6 +119,15 @@ int deny_severity = LOG_WARNING; #include #endif +#ifdef __NETWARE__ +#include +#include +#include + +event_handle_t eh; +Report_t ref; +#endif /* __NETWARE__ */ + #ifdef _AIX41 int initgroups(const char *,unsigned int); #endif @@ -240,6 +251,11 @@ SHOW_COMP_OPTION have_query_cache=SHOW_OPTION_YES; #else SHOW_COMP_OPTION have_query_cache=SHOW_OPTION_NO; #endif +#ifdef HAVE_CRYPT +SHOW_COMP_OPTION have_crypt=SHOW_OPTION_YES; +#else +SHOW_COMP_OPTION have_crypt=SHOW_OPTION_NO; +#endif bool opt_large_files= sizeof(my_off_t) > 4; #if SIZEOF_OFF_T > 4 && defined(BIG_TABLES) @@ -361,8 +377,8 @@ ulong bytes_sent = 0L, bytes_received = 0L; bool opt_endinfo,using_udf_functions, locked_in_memory; bool opt_using_transactions, using_update_log; -bool volatile abort_loop,select_thread_in_use,grant_option; -bool volatile ready_to_exit,shutdown_in_progress; +bool volatile abort_loop, select_thread_in_use, signal_thread_in_use; +bool volatile ready_to_exit, shutdown_in_progress, grant_option; ulong refresh_version=1L,flush_version=1L; /* Increments on each reload */ ulong query_id=1L,long_query_count,aborted_threads, aborted_connects,delayed_insert_timeout,delayed_insert_limit, @@ -471,6 +487,7 @@ static uint set_maximum_open_files(uint max_file_limit); #endif static ulong find_bit_type(const char *x, TYPELIB *bit_lib); static void clean_up(bool print_message); +static void clean_up_mutexes(void); /**************************************************************************** ** Code to end mysqld @@ -498,7 +515,7 @@ static void close_connections(void) (void) pthread_mutex_unlock(&LOCK_manager); /* kill connection thread */ -#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) +#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) && !defined(__NETWARE__) DBUG_PRINT("quit",("waiting for select thread: %lx",select_thread)); (void) pthread_mutex_lock(&LOCK_thread_count); @@ -640,14 +657,11 @@ static void close_connections(void) } (void) pthread_mutex_unlock(&LOCK_thread_count); - mysql_log.close(1); - mysql_slow_log.close(1); - mysql_update_log.close(1); - mysql_bin_log.close(1); DBUG_PRINT("quit",("close_connections thread")); DBUG_VOID_RETURN; } + static void close_server_sock() { #ifdef HAVE_CLOSE_SERVER_SOCK @@ -659,10 +673,10 @@ static void close_server_sock() ip_sock=INVALID_SOCKET; DBUG_PRINT("info",("calling shutdown on TCP/IP socket")); VOID(shutdown(tmp_sock,2)); -#ifdef NOT_USED +#if defined(__NETWARE__) /* - The following code is disabled as it causes MySQL to hang on - AIX 4.3 during shutdown + The following code is disabled for normal systems as it causes MySQL + to hang on AIX 4.3 during shutdown */ DBUG_PRINT("info",("calling closesocket on TCP/IP socket")); VOID(closesocket(tmp_sock)); @@ -674,9 +688,9 @@ static void close_server_sock() unix_sock=INVALID_SOCKET; DBUG_PRINT("info",("calling shutdown on unix socket")); VOID(shutdown(tmp_sock,2)); -#ifdef NOT_USED +#if defined(__NETWARE__) /* - The following code is disabled as it may cause MySQL to hang on + The following code is disabled for normal systems as it causes MySQL AIX 4.3 during shutdown (not tested, but likely) */ DBUG_PRINT("info",("calling closesocket on unix/IP socket")); @@ -741,7 +755,7 @@ void kill_mysql(void) /* Force server down. kill all connections and threads and exit */ -#if defined(OS2) +#if defined(OS2) || defined(__NETWARE__) extern "C" void kill_server(int sig_ptr) #define RETURN_FROM_KILL_SERVER DBUG_RETURN #elif !defined(__WIN__) @@ -760,13 +774,16 @@ static void __cdecl kill_server(int sig_ptr) RETURN_FROM_KILL_SERVER; kill_in_progress=TRUE; abort_loop=1; // This should be set +#ifdef __NETWARE__ + ActivateScreen(getscreenhandle()); // Show the screen going down +#endif signal(sig,SIG_IGN); if (sig == MYSQL_KILL_SIGNAL || sig == 0) sql_print_error(ER(ER_NORMAL_SHUTDOWN),my_progname); else sql_print_error(ER(ER_GOT_SIGNAL),my_progname,sig); /* purecov: inspected */ -#if defined(USE_ONE_SIGNAL_HAND) && !defined(__WIN__) && !defined(OS2) +#if defined(__NETWARE__) || (defined(USE_ONE_SIGNAL_HAND) && !defined(__WIN__) && !defined(OS2)) my_thread_init(); // If this is a new thread #endif close_connections(); @@ -774,12 +791,18 @@ static void __cdecl kill_server(int sig_ptr) unireg_abort(1); /* purecov: inspected */ else unireg_end(); + +#ifdef __NETWARE__ + pthread_join(select_thread, NULL); // wait for main thread +#else pthread_exit(0); /* purecov: deadcode */ +#endif /* __NETWARE__ */ + RETURN_FROM_KILL_SERVER; } -#ifdef USE_ONE_SIGNAL_HAND +#if defined(USE_ONE_SIGNAL_HAND) || (defined(__NETWARE__) && defined(SIGNALS_DONT_BREAK_READ)) extern "C" pthread_handler_decl(kill_server_thread,arg __attribute__((unused))) { SHUTDOWN_THD; @@ -806,7 +829,7 @@ extern "C" sig_handler print_signal_warning(int sig) #ifdef DONT_REMEMBER_SIGNAL sigset(sig,print_signal_warning); /* int. thread system calls */ #endif -#if !defined(__WIN__) && !defined(OS2) +#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__) if (sig == SIGALRM) alarm(2); /* reschedule alarm */ #endif @@ -830,11 +853,13 @@ void unireg_end(void) { clean_up(1); my_thread_end(); +#ifndef __NETWARE__ #ifdef SIGNALS_DONT_BREAK_READ exit(0); #else pthread_exit(0); // Exit is in main thread #endif +#endif /* __NETWARE__ */ } @@ -846,6 +871,8 @@ extern "C" void unireg_abort(int exit_code) clean_up(1); /* purecov: inspected */ DBUG_PRINT("quit",("done with cleanup in unireg_abort")); my_thread_end(); + clean_up_mutexes(); + my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0); exit(exit_code); /* purecov: inspected */ } @@ -855,6 +882,12 @@ void clean_up(bool print_message) DBUG_PRINT("exit",("clean_up")); if (cleanup_done++) return; /* purecov: inspected */ + + mysql_log.cleanup(); + mysql_slow_log.cleanup(); + mysql_update_log.cleanup(); + mysql_bin_log.cleanup(); + if (use_slave_mask) bitmap_free(&slave_error_mask); acl_free(1); @@ -884,6 +917,9 @@ void clean_up(bool print_message) bitmap_free(&temp_pool); free_max_user_conn(); end_slave_list(); +#ifdef HAVE_OPENSSL + free_des_key_file(); +#endif /* HAVE_OPENSSL */ #ifdef USE_REGEX regex_end(); #endif @@ -911,6 +947,35 @@ void clean_up(bool print_message) } /* clean_up */ +static void clean_up_mutexes() +{ + (void) pthread_mutex_destroy(&LOCK_mysql_create_db); + (void) pthread_mutex_destroy(&LOCK_Acl); + (void) pthread_mutex_destroy(&LOCK_grant); + (void) pthread_mutex_destroy(&LOCK_open); + (void) pthread_mutex_destroy(&LOCK_thread_count); + (void) pthread_mutex_destroy(&LOCK_mapped_file); + (void) pthread_mutex_destroy(&LOCK_status); + (void) pthread_mutex_destroy(&LOCK_error_log); + (void) pthread_mutex_destroy(&LOCK_delayed_insert); + (void) pthread_mutex_destroy(&LOCK_delayed_status); + (void) pthread_mutex_destroy(&LOCK_delayed_create); + (void) pthread_mutex_destroy(&LOCK_manager); + (void) pthread_mutex_destroy(&LOCK_crypt); + (void) pthread_mutex_destroy(&LOCK_bytes_sent); + (void) pthread_mutex_destroy(&LOCK_bytes_received); + (void) pthread_mutex_destroy(&LOCK_timezone); + (void) pthread_mutex_destroy(&LOCK_user_conn); + (void) pthread_mutex_destroy(&LOCK_rpl_status); + (void) pthread_mutex_destroy(&LOCK_active_mi); + (void) pthread_mutex_destroy(&LOCK_global_system_variables); + (void) pthread_cond_destroy(&COND_thread_count); + (void) pthread_cond_destroy(&COND_refresh); + (void) pthread_cond_destroy(&COND_thread_cache); + (void) pthread_cond_destroy(&COND_flush_thread_cache); + (void) pthread_cond_destroy(&COND_manager); + (void) pthread_cond_destroy(&COND_rpl_status); +} /**************************************************************************** ** Init IP and UNIX socket @@ -944,7 +1009,7 @@ static void set_ports() static void set_user(const char *user) { -#if !defined(__WIN__) && !defined(OS2) +#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__) struct passwd *ent; // don't bother if we aren't superuser @@ -1005,7 +1070,7 @@ static void set_user(const char *user) static void set_root(const char *path) { -#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) +#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) && !defined(__NETWARE__) if (chroot(path) == -1) { sql_perror("chroot"); @@ -1317,6 +1382,89 @@ static void start_signal_handler(void) { } +#elif defined(__NETWARE__) + +// down server event callback +void mysql_down_server_cb(void *, void *) +{ + setscreenmode(SCR_AUTOCLOSE_ON_EXIT); // auto close the screen + kill_server(0); +} + +// destroy callback resources +void mysql_cb_destroy(void *) +{ + UnRegisterEventNotification(eh); // cleanup down event notification + NX_UNWRAP_INTERFACE(ref); +} + +// initialize callbacks +void mysql_cb_init() +{ + // register for down server event + void *handle = getnlmhandle(); + rtag_t rt = AllocateResourceTag(handle, "MySQL Down Server Callback", + EventSignature); + NX_WRAP_INTERFACE((void *)mysql_down_server_cb, 2, (void **)&ref); + eh = RegisterForEventNotification(rt, EVENT_DOWN_SERVER, + EVENT_PRIORITY_APPLICATION, + NULL, ref, NULL); + NXVmRegisterExitHandler(mysql_cb_destroy, NULL); // clean-up +} + +static void init_signals(void) +{ + int signals[] = {SIGINT,SIGILL,SIGFPE,SIGSEGV,SIGTERM,SIGABRT}; + + for (uint i=0 ; i < sizeof(signals)/sizeof(int) ; i++) + signal(signals[i], kill_server); + mysql_cb_init(); // initialize callbacks +} + +static void start_signal_handler(void) +{ + // Save vm id of this process + if (!opt_bootstrap) + { + File pidFile; + if ((pidFile = my_create(pidfile_name,0664, O_WRONLY, MYF(MY_WME))) >= 0) + { + char buff[21]; + sprintf(buff,"%lu",(ulong) getpid()); + (void) my_write(pidFile, buff,strlen(buff),MYF(MY_WME)); + (void) my_close(pidFile,MYF(0)); + } + } + // no signal handler +} + + +/* Warn if the data is on a Traditional volume */ + +static void check_data_home(const char *path) +{ + struct volume_info vol; + char buff[PATH_MAX], *pos; + + bzero((char*) &vol, sizeof(vol)); // clear struct + + // find volume name + if ((pos= strchr(path, ':'))) + { + uint length= (uint) (pos-path); + strmake(buff, path, min(length, sizeof(buff)-1)); + } + else + strmov(buff, "SYS"); // assume SYS volume + + netware_vol_info_from_name(&vol, buff); // retrieve information + if ((vol.flags & VOL_NSS_PRESENT) == 0) + { + sql_print_error("Error: %s is not on an NSS volume!", path); + unireg_abort(-1); + } +} + #elif defined(__EMX__) static void sig_reload(int signo) { @@ -1352,6 +1500,10 @@ static void start_signal_handler(void) { } +static void check_data_home(const char *path) +{ +} + #else /* if ! __WIN__ && ! __EMX__ */ #ifdef HAVE_LINUXTHREADS @@ -1554,7 +1706,8 @@ extern "C" void *signal_hand(void *arg __attribute__((unused))) int sig; my_thread_init(); // Init new thread DBUG_ENTER("signal_hand"); - SIGNAL_THD; + signal_thread_in_use= 1; + /* Setup alarm handler The two extra handlers are for slave threads @@ -1621,6 +1774,7 @@ extern "C" void *signal_hand(void *arg __attribute__((unused))) if (cleanup_done) { my_thread_end(); + signal_thread_in_use= 0; pthread_exit(0); // Safety } switch (sig) { @@ -1672,6 +1826,10 @@ extern "C" void *signal_hand(void *arg __attribute__((unused))) return(0); /* purecov: deadcode */ } +static void check_data_home(const char *path) +{ +} + #endif /* __WIN__*/ @@ -1844,6 +2002,12 @@ int main(int argc, char **argv) tzset(); // Set tzname start_time=time((time_t*) 0); + +#ifdef __NETWARE__ + printf("MySQL Server %s, for %s (%s)\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE); + fflush(stdout); +#endif /* __NETWARE__ */ + #ifdef OS2 { // fix timezone for daylight saving @@ -2006,6 +2170,7 @@ int main(int argc, char **argv) We have enough space for fiddling with the argv, continue */ umask(((~my_umask) & 0666)); + check_data_home(mysql_real_data_home); if (my_setwd(mysql_real_data_home,MYF(MY_WME))) { unireg_abort(1); /* purecov: inspected */ @@ -2054,7 +2219,7 @@ int main(int argc, char **argv) sql_print_error("Can't init databases"); if (unix_sock != INVALID_SOCKET) unlink(mysql_unix_port); - exit(1); + unireg_abort(1); } ha_key_cache(); #if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT) @@ -2091,21 +2256,23 @@ int main(int argc, char **argv) sql_print_error("Can't create thread-keys"); if (unix_sock != INVALID_SOCKET) unlink(mysql_unix_port); - exit(1); + unireg_abort(1); } start_signal_handler(); // Creates pidfile if (acl_init((THD*) 0, opt_noacl)) { abort_loop=1; select_thread_in_use=0; - (void) pthread_kill(signal_thread,MYSQL_KILL_SIGNAL); +#ifndef __NETWARE__ + (void) pthread_kill(signal_thread, MYSQL_KILL_SIGNAL); +#endif /* __NETWARE__ */ #ifndef __WIN__ if (!opt_bootstrap) (void) my_delete(pidfile_name,MYF(MY_WME)); // Not needed anymore #endif if (unix_sock != INVALID_SOCKET) unlink(mysql_unix_port); - exit(1); + unireg_abort(1); } if (!opt_noacl) (void) grant_init((THD*) 0); @@ -2194,7 +2361,9 @@ The server will not act as a slave."); sql_print_error("Warning: Can't create thread to manage maintenance"); } - printf(ER(ER_READY),my_progname,server_version,""); + if (unix_sock == INVALID_SOCKET) + mysql_unix_port[0]= 0; + printf(ER(ER_READY),my_progname,server_version, mysql_unix_port, mysql_port); fflush(stdout); #ifdef __NT__ @@ -2277,6 +2446,22 @@ The server will not act as a slave."); CloseHandle(hEventShutdown); } #endif +#ifndef __NETWARE__ + { + uint i; + /* + Wait up to 10 seconds for signal thread to die. We use this mainly to + avoid getting warnings that my_thread_end has not been called + */ + for (i= 0 ; i < 100 && signal_thread_in_use; i++) + { + if (pthread_kill(signal_thread, MYSQL_KILL_SIGNAL)) + break; + my_sleep(100); // Give it time to die + } + } +#endif + clean_up_mutexes(); my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0); exit(0); return(0); /* purecov: deadcode */ @@ -2552,7 +2737,10 @@ static void create_new_thread(THD *thd) inline void kill_broken_server() { /* hack to get around signals ignored in syscalls for problem OS's */ - if (unix_sock == INVALID_SOCKET || + if ( +#if !defined(__NETWARE__) + unix_sock == INVALID_SOCKET || +#endif (!opt_disable_networking && ip_sock == INVALID_SOCKET)) { select_thread_in_use = 0; @@ -2566,7 +2754,8 @@ inline void kill_broken_server() /* Handle new connections and spawn new process to handle them */ -extern "C" pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused))) +extern "C" pthread_handler_decl(handle_connections_sockets, + arg __attribute__((unused))) { my_socket sock,new_sock; uint error_count=0; @@ -2652,6 +2841,13 @@ extern "C" pthread_handler_decl(handle_connections_sockets,arg __attribute__((un size_socket length=sizeof(struct sockaddr_in); new_sock = accept(sock, my_reinterpret_cast(struct sockaddr *) (&cAddr), &length); +#ifdef __NETWARE__ + // TODO: temporary fix, waiting for TCP/IP fix - DEFECT000303149 + if ((new_sock == INVALID_SOCKET) && (socket_errno == EINVAL)) + { + kill_server(SIGTERM); + } +#endif if (new_sock != INVALID_SOCKET || (socket_errno != SOCKET_EINTR && socket_errno != SOCKET_EAGAIN)) break; @@ -2880,7 +3076,7 @@ enum options { OPT_BDB_HOME, OPT_BDB_LOG, OPT_BDB_TMP, OPT_BDB_NOSYNC, OPT_BDB_LOCK, OPT_BDB_SKIP, - OPT_BDB_NO_RECOVER, OPT_BDB_SHARED, + OPT_BDB_NO_RECOVER, OPT_BDB_SHARED, OPT_MASTER_HOST, OPT_MASTER_USER, OPT_MASTER_PASSWORD, OPT_MASTER_PORT, OPT_MASTER_INFO_FILE, OPT_MASTER_CONNECT_RETRY, @@ -2964,7 +3160,8 @@ enum options { OPT_INNODB_FORCE_RECOVERY, OPT_BDB_CACHE_SIZE, OPT_BDB_LOG_BUFFER_SIZE, - OPT_BDB_MAX_LOCK + OPT_BDB_MAX_LOCK, + OPT_AUTOCLOSE }; @@ -2974,6 +3171,9 @@ struct my_option my_long_options[] = { {"ansi", 'a', "Use ANSI SQL syntax instead of MySQL syntax", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, +#ifdef __NETWARE__ + {"autoclose", OPT_AUTOCLOSE, "Auto close screen. (NetWare only)", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, +#endif /* __NETWARE__ */ {"basedir", 'b', "Path to installation directory. All paths are usually resolved relative to this.", (gptr*) &mysql_home_ptr, (gptr*) &mysql_home_ptr, 0, GET_STR, REQUIRED_ARG, @@ -3971,8 +4171,8 @@ static void set_options(void) global_system_variables.max_join_size= HA_POS_ERROR; max_system_variables.max_join_size= HA_POS_ERROR; -#ifdef __WIN__ - /* Allow Win32 users to move MySQL anywhere */ +#if defined(__WIN__) || defined(__NETWARE__) + /* Allow Win32 and NetWare users to move MySQL anywhere */ { char prg_dev[LIBLEN]; my_path(prg_dev,my_progname,"mysql/bin"); @@ -4290,6 +4490,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), #ifdef __WIN__ case (int) OPT_STANDALONE: /* Dummy option for NT */ break; +#endif +#ifdef __NETWARE__ + case (int) OPT_AUTOCLOSE: + setscreenmode(SCR_AUTOCLOSE_ON_EXIT); + break; #endif case (int) OPT_FLUSH: #ifdef HAVE_ISAM @@ -4462,7 +4667,7 @@ static void get_options(int argc,char **argv) if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) exit(ho_error); -#ifdef HAVE_BROKEN_REALPATH +#if defined(HAVE_BROKEN_REALPATH) my_use_symdir=0; my_disable_symlinks=1; have_symlink=SHOW_OPTION_NO; diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index 471fd62ecb2..cbb30cafdc4 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -75,7 +75,7 @@ static int init_failsafe_rpl_thread(THD* thd) DBUG_RETURN(-1); } -#if !defined(__WIN__) && !defined(OS2) +#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__) sigset_t set; VOID(sigemptyset(&set)); // Get mask in use VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals)); diff --git a/sql/set_var.cc b/sql/set_var.cc index 8e0baa234da..1a9f6626c64 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -416,6 +416,7 @@ struct show_var_st init_vars[]= { {"ft_max_word_len_for_sort",(char*) &ft_max_word_len_for_sort, SHOW_LONG}, {"ft_boolean_syntax", (char*) ft_boolean_syntax, SHOW_CHAR}, {"have_bdb", (char*) &have_berkeley_db, SHOW_HAVE}, + {"have_crypt", (char*) &have_crypt, SHOW_HAVE}, {"have_innodb", (char*) &have_innodb, SHOW_HAVE}, {"have_isam", (char*) &have_isam, SHOW_HAVE}, {"have_raid", (char*) &have_raid, SHOW_HAVE}, diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index 93a1b66816a..a11be9b0e7f 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -77,7 +77,7 @@ "BLOB column '%-.64s' can't be used in key specification with the used table type", "Too big column length for column '%-.64s' (max = %d). Use BLOB instead", "Incorrect table definition; There can only be one auto column and it must be defined as a key", -"%s: ready for connections\n", +"%s: ready for connections.\nVersion: '%s' socket: '%s' port: %d\n", "%s: Normal shutdown\n", "%s: Got signal %d. Aborting!\n", "%s: Shutdown Complete\n", diff --git a/sql/slave.cc b/sql/slave.cc index 839189956a1..164b8ba458f 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -33,8 +33,7 @@ typedef bool (*CHECK_KILLED_FUNC)(THD*,void*); volatile bool slave_sql_running = 0, slave_io_running = 0; char* slave_load_tmpdir = 0; -MASTER_INFO main_mi; -MASTER_INFO* active_mi; +MASTER_INFO *active_mi; volatile int active_mi_in_use = 0; HASH replicate_do_table, replicate_ignore_table; DYNAMIC_ARRAY replicate_wild_do_table, replicate_wild_ignore_table; @@ -120,18 +119,19 @@ int init_slave() TODO: re-write this to interate through the list of files for multi-master */ - active_mi = &main_mi; + active_mi= new MASTER_INFO; /* If master_host is not specified, try to read it from the master_info file. If master_host is specified, create the master_info file if it doesn't exists. */ - if (init_master_info(active_mi,master_info_file,relay_log_info_file, + if (!active_mi || + init_master_info(active_mi,master_info_file,relay_log_info_file, !master_host)) { - sql_print_error("Warning: failed to initialized master info"); - DBUG_RETURN(0); + sql_print_error("Note: Failed to initialized master info"); + goto err; } /* @@ -149,9 +149,15 @@ int init_slave() master_info_file, relay_log_info_file, SLAVE_IO | SLAVE_SQL)) + { sql_print_error("Warning: Can't create threads to handle slave"); + goto err; + } } DBUG_RETURN(0); + +err: + DBUG_RETURN(1); } @@ -755,23 +761,29 @@ static int end_slave_on_walk(MASTER_INFO* mi, gptr /*unused*/) } #endif + void end_slave() { - /* - TODO: replace the line below with - list_walk(&master_list, (list_walk_action)end_slave_on_walk,0); - once multi-master code is ready. - */ - terminate_slave_threads(active_mi,SLAVE_FORCE_ALL); - end_master_info(active_mi); - if (do_table_inited) - hash_free(&replicate_do_table); - if (ignore_table_inited) - hash_free(&replicate_ignore_table); - if (wild_do_table_inited) - free_string_array(&replicate_wild_do_table); - if (wild_ignore_table_inited) - free_string_array(&replicate_wild_ignore_table); + if (active_mi) + { + /* + TODO: replace the line below with + list_walk(&master_list, (list_walk_action)end_slave_on_walk,0); + once multi-master code is ready. + */ + terminate_slave_threads(active_mi,SLAVE_FORCE_ALL); + end_master_info(active_mi); + if (do_table_inited) + hash_free(&replicate_do_table); + if (ignore_table_inited) + hash_free(&replicate_ignore_table); + if (wild_do_table_inited) + free_string_array(&replicate_wild_do_table); + if (wild_ignore_table_inited) + free_string_array(&replicate_wild_ignore_table); + delete active_mi; + active_mi= 0; + } } @@ -1563,6 +1575,42 @@ bool flush_master_info(MASTER_INFO* mi) DBUG_RETURN(0); } + +st_relay_log_info::st_relay_log_info() + :info_fd(-1), cur_log_fd(-1), master_log_pos(0), save_temporary_tables(0), + cur_log_old_open_count(0), log_space_total(0), + slave_skip_counter(0), abort_pos_wait(0), slave_run_id(0), + sql_thd(0), last_slave_errno(0), inited(0), abort_slave(0), + slave_running(0), log_pos_current(0), skip_log_purge(0), + inside_transaction(0) /* the default is autocommit=1 */ +{ + relay_log_name[0] = master_log_name[0] = 0; + last_slave_error[0]=0; + + + bzero(&info_file,sizeof(info_file)); + bzero(&cache_buf, sizeof(cache_buf)); + pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST); + pthread_mutex_init(&data_lock, MY_MUTEX_INIT_FAST); + pthread_mutex_init(&log_space_lock, MY_MUTEX_INIT_FAST); + pthread_cond_init(&data_cond, NULL); + pthread_cond_init(&start_cond, NULL); + pthread_cond_init(&stop_cond, NULL); + pthread_cond_init(&log_space_cond, NULL); +} + + +st_relay_log_info::~st_relay_log_info() +{ + pthread_mutex_destroy(&run_lock); + pthread_mutex_destroy(&data_lock); + pthread_mutex_destroy(&log_space_lock); + pthread_cond_destroy(&data_cond); + pthread_cond_destroy(&start_cond); + pthread_cond_destroy(&stop_cond); + pthread_cond_destroy(&log_space_cond); +} + /* Waits until the SQL thread reaches (has executed up to) the log/position or timed out. @@ -1755,7 +1803,7 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type) DBUG_RETURN(-1); } -#if !defined(__WIN__) && !defined(OS2) +#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__) sigset_t set; VOID(sigemptyset(&set)); // Get mask in use VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals)); @@ -2281,14 +2329,16 @@ err: THD_CHECK_SENTRY(thd); delete thd; pthread_mutex_unlock(&LOCK_thread_count); - my_thread_end(); // clean-up before broadcast pthread_cond_broadcast(&mi->stop_cond); // tell the world we are done pthread_mutex_unlock(&mi->run_lock); #ifndef DBUG_OFF if (abort_slave_event_count && !events_till_abort) goto slave_begin; #endif + my_thread_end(); +#ifndef __NETWARE__ pthread_exit(0); +#endif /* __NETWARE__ */ DBUG_RETURN(0); // Can't return anything here } @@ -2420,7 +2470,6 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \ THD_CHECK_SENTRY(thd); delete thd; pthread_mutex_unlock(&LOCK_thread_count); - my_thread_end(); // clean-up before broadcasting termination pthread_cond_broadcast(&rli->stop_cond); // tell the world we are done pthread_mutex_unlock(&rli->run_lock); @@ -2428,10 +2477,14 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \ if (abort_slave_event_count && !rli->events_till_abort) goto slave_begin; #endif + my_thread_end(); // clean-up before broadcasting termination +#ifndef __NETWARE__ pthread_exit(0); +#endif /* __NETWARE__ */ DBUG_RETURN(0); // Can't return anything here } + static int process_io_create_file(MASTER_INFO* mi, Create_file_log_event* cev) { int error = 1; @@ -2464,9 +2517,10 @@ static int process_io_create_file(MASTER_INFO* mi, Create_file_log_event* cev) goto err; } - /* this dummy block is so we could instantiate Append_block_log_event - once and then modify it slightly instead of doing it multiple times - in the loop + /* + This dummy block is so we could instantiate Append_block_log_event + once and then modify it slightly instead of doing it multiple times + in the loop */ { Append_block_log_event aev(thd,0,0,0); diff --git a/sql/slave.h b/sql/slave.h index 72ddcd8b471..ea7e2b4ef16 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -103,7 +103,7 @@ typedef struct st_relay_log_info created temporary tables. Modified only on init/end and by the SQL thread, read only by SQL thread. */ - TABLE* save_temporary_tables; + TABLE *save_temporary_tables; /* standard lock acquistion order to avoid deadlocks: @@ -171,33 +171,8 @@ typedef struct st_relay_log_info bool skip_log_purge; bool inside_transaction; - st_relay_log_info() - :info_fd(-1),cur_log_fd(-1), cur_log_old_open_count(0), abort_pos_wait(0), - slave_run_id(0), inited(0), abort_slave(0), slave_running(0), - log_pos_current(0), skip_log_purge(0), - inside_transaction(0) /* the default is autocommit=1 */ - { - relay_log_name[0] = master_log_name[0] = 0; - bzero(&info_file,sizeof(info_file)); - bzero(&cache_buf, sizeof(cache_buf)); - pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST); - pthread_mutex_init(&data_lock, MY_MUTEX_INIT_FAST); - pthread_mutex_init(&log_space_lock, MY_MUTEX_INIT_FAST); - pthread_cond_init(&data_cond, NULL); - pthread_cond_init(&start_cond, NULL); - pthread_cond_init(&stop_cond, NULL); - pthread_cond_init(&log_space_cond, NULL); - } - ~st_relay_log_info() - { - pthread_mutex_destroy(&run_lock); - pthread_mutex_destroy(&data_lock); - pthread_mutex_destroy(&log_space_lock); - pthread_cond_destroy(&data_cond); - pthread_cond_destroy(&start_cond); - pthread_cond_destroy(&stop_cond); - pthread_cond_destroy(&log_space_cond); - } + st_relay_log_info(); + ~st_relay_log_info(); inline void inc_pending(ulonglong val) { pending += val; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 54c3e40244a..b53c05c0357 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -549,7 +549,7 @@ void close_temporary_tables(THD *thd) query_buf_size= 50; // Enough for DROP ... TABLE for (table=thd->temporary_tables ; table ; table=table->next) - query_buf_size += table->key_length; + query_buf_size+= table->key_length+1; if ((query = alloc_root(&thd->mem_root, query_buf_size))) end=strmov(query, "DROP /*!40005 TEMPORARY */ TABLE "); diff --git a/sql/sql_class.h b/sql/sql_class.h index af80c3e31ac..802052d553a 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -111,6 +111,7 @@ public: void init(enum_log_type log_type_arg, enum cache_type io_cache_type_arg = WRITE_CACHE, bool no_auto_events_arg = 0); + void cleanup(); bool open(const char *log_name,enum_log_type log_type, const char *new_name, const char *index_file_name_arg, enum cache_type io_cache_type_arg, @@ -320,7 +321,8 @@ struct system_variables a thread/connection descriptor */ -class THD :public ilink { +class THD :public ilink +{ public: NET net; // client connection descriptor LEX lex; // parse tree descriptor @@ -478,7 +480,7 @@ public: active_vio = 0; pthread_mutex_unlock(&LOCK_delete); } - void THD::close_active_vio(); + void close_active_vio(); #endif void awake(bool prepare_to_die); inline const char* enter_cond(pthread_cond_t *cond, pthread_mutex_t* mutex, @@ -796,12 +798,7 @@ public: class multi_delete : public select_result { TABLE_LIST *delete_tables, *table_being_deleted; -#ifdef SINISAS_STRIP - IO_CACHE **tempfiles; - byte *memory_lane; -#else Unique **tempfiles; -#endif THD *thd; ha_rows deleted; uint num_of_tables; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 56a89e0bd1c..23563239558 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -939,7 +939,7 @@ extern "C" pthread_handler_decl(handle_delayed_insert,arg) strmov(thd->net.last_error,ER(thd->net.last_errno=ER_OUT_OF_RESOURCES)); goto end; } -#if !defined(__WIN__) && !defined(OS2) +#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__) sigset_t set; VOID(sigemptyset(&set)); // Get mask in use VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals)); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 0a5ebc585b2..9946c9961b1 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -652,7 +652,7 @@ pthread_handler_decl(handle_one_connection,arg) #if defined(__WIN__) init_signals(); // IRENA; testing ? -#elif !defined(OS2) +#elif !defined(OS2) && !defined(__NETWARE__) sigset_t set; VOID(sigemptyset(&set)); // Get mask in use VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals)); @@ -682,7 +682,9 @@ pthread_handler_decl(handle_one_connection,arg) statistic_increment(aborted_connects,&LOCK_status); goto end_thread; } - +#ifdef __NETWARE__ + netware_reg_user(thd->ip, thd->user, "MySQL"); +#endif if (thd->variables.max_join_size == HA_POS_ERROR) thd->options |= OPTION_BIG_SELECTS; if (thd->client_capabilities & CLIENT_COMPRESS) @@ -751,12 +753,10 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg) pthread_detach_this_thread(); thd->thread_stack= (char*) &thd; -#if !defined(__WIN__) && !defined(OS2) +#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__) sigset_t set; VOID(sigemptyset(&set)); // Get mask in use VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals)); - - #endif if (thd->variables.max_join_size == HA_POS_ERROR) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index e811c55ed1b..6996bba8798 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -506,7 +506,16 @@ mysql_select(THD *thd,TABLE_LIST *tables,List &fields,COND *conds, error= -1; /* if goto err */ /* Optimize distinct away if possible */ - order=remove_const(&join,order,conds,&simple_order); + { + ORDER *org_order= order; + order=remove_const(&join,order,conds,&simple_order); + /* + If we are using ORDER BY NULL or ORDER BY const_expression, + return result in any order (even if we are using a GROUP BY) + */ + if (!order && org_order) + skip_sort_order= 1; + } if (group || join.tmp_table_param.sum_func_count) { if (! hidden_group_fields) @@ -776,7 +785,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List &fields,COND *conds, procedure->update_refs(); if (tmp_table->group) { // Already grouped - if (!order && !no_order) + if (!order && !no_order && !skip_sort_order) order=group; /* order by group */ group=0; } @@ -3529,7 +3538,7 @@ const_expression_in_where(COND *cond, Item *comp_item, Item **const_item) */ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, - Item_result_field ***copy_func, Field **from_field, + Item ***copy_func, Field **from_field, bool group, bool modify_item) { switch (type) { @@ -3590,12 +3599,12 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, } return new_field; } - case Item::PROC_ITEM: case Item::FUNC_ITEM: case Item::COND_ITEM: case Item::FIELD_AVG_ITEM: case Item::FIELD_STD_ITEM: /* The following can only happen with 'CREATE TABLE ... SELECT' */ + case Item::PROC_ITEM: case Item::INT_ITEM: case Item::REAL_ITEM: case Item::STRING_ITEM: @@ -3624,10 +3633,10 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, item->name,table,item->binary); break; } - if (copy_func) - *((*copy_func)++) = (Item_result_field*) item; // Save for copy_funcs + if (copy_func && item->is_result_field()) + *((*copy_func)++) = item; // Save for copy_funcs if (modify_item) - ((Item_result_field*) item)->result_field=new_field; + item->set_result_field(new_field); return new_field; } default: // Dosen't have to be stored @@ -3661,7 +3670,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, Copy_field *copy=0; KEY *keyinfo; KEY_PART_INFO *key_part_info; - Item_result_field **copy_func; + Item **copy_func; MI_COLUMNDEF *recinfo; uint temp_pool_slot=MY_BIT_NONE; @@ -3725,7 +3734,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, my_free((gptr) table,MYF(0)); /* purecov: inspected */ DBUG_RETURN(NULL); /* purecov: inspected */ } - param->funcs=copy_func; + param->items_to_copy= copy_func; strmov(tmpname,path); /* make table according to fields */ @@ -5257,7 +5266,7 @@ end_write(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), if (!end_of_records) { copy_fields(&join->tmp_table_param); - copy_funcs(join->tmp_table_param.funcs); + copy_funcs(join->tmp_table_param.items_to_copy); #ifdef TO_BE_DELETED if (!table->uniques) // If not unique handling @@ -5357,7 +5366,7 @@ end_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), memcpy(table->record[0]+key_part->offset, group->buff, key_part->length); init_tmptable_sum_functions(join->sum_funcs); - copy_funcs(join->tmp_table_param.funcs); + copy_funcs(join->tmp_table_param.items_to_copy); if ((error=table->file->write_row(table->record[0]))) { if (create_myisam_from_heap(table, &join->tmp_table_param, error, 0)) @@ -5390,7 +5399,7 @@ end_unique_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), init_tmptable_sum_functions(join->sum_funcs); copy_fields(&join->tmp_table_param); // Groups are copied twice. - copy_funcs(join->tmp_table_param.funcs); + copy_funcs(join->tmp_table_param.items_to_copy); if (!(error=table->file->write_row(table->record[0]))) join->send_records++; // New group @@ -5475,7 +5484,7 @@ end_write_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), if (idx < (int) join->send_group_parts) { copy_fields(&join->tmp_table_param); - copy_funcs(join->tmp_table_param.funcs); + copy_funcs(join->tmp_table_param.items_to_copy); init_sum_functions(join->sum_funcs); if (join->procedure) join->procedure->add(); @@ -7144,7 +7153,7 @@ copy_sum_funcs(Item_sum **func_ptr) { Item_sum *func; for (; (func = *func_ptr) ; func_ptr++) - (void) func->save_in_field(func->result_field, 1); + (void) func->save_in_result_field(1); return; } @@ -7171,12 +7180,11 @@ update_sum_func(Item_sum **func_ptr) /* Copy result of functions to record in tmp_table */ void -copy_funcs(Item_result_field **func_ptr) +copy_funcs(Item **func_ptr) { - Item_result_field *func; + Item *func; for (; (func = *func_ptr) ; func_ptr++) - (void) func->save_in_field(func->result_field, 1); - return; + func->save_in_result_field(1); } diff --git a/sql/sql_select.h b/sql/sql_select.h index 40eb4d8ef51..332778aafe6 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -122,7 +122,7 @@ class TMP_TABLE_PARAM :public Sql_alloc List_iterator_fast copy_funcs_it; Copy_field *copy_field, *copy_field_end; byte *group_buff; - Item_result_field **funcs; + Item **items_to_copy; /* Fields in tmp table */ MI_COLUMNDEF *recinfo,*start_recinfo; KEY *keyinfo; ha_rows end_write_records; @@ -194,7 +194,7 @@ void count_field_types(TMP_TABLE_PARAM *param, List &fields, bool reset_with_sum_func); bool setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,List &fields); void copy_fields(TMP_TABLE_PARAM *param); -void copy_funcs(Item_result_field **func_ptr); +void copy_funcs(Item **func_ptr); bool create_myisam_from_heap(TABLE *table, TMP_TABLE_PARAM *param, int error, bool ignore_last_dupp_error); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index a763d6b6b91..4c0ab15edf7 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -800,7 +800,7 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info, field=item->tmp_table_field(&tmp_table); else field=create_tmp_field(thd, &tmp_table, item, item->type(), - (Item_result_field***) 0, &tmp_field,0,0); + (Item ***) 0, &tmp_field,0,0); if (!field || !(cr_field=new create_field(field,(item->type() == Item::FIELD_ITEM ? ((Item_field *)item)->field : diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index 937d1e52656..8ac313e1127 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -229,6 +229,11 @@ void udf_free() } hash_free(&udf_hash); free_root(&mem,MYF(0)); + if (initialized) + { + initialized= 0; + pthread_mutex_destroy(&THR_LOCK_udf); + } DBUG_VOID_RETURN; } -- cgit v1.2.1 From 4fb3244014418bd76e8cf755275798a166d980d7 Mon Sep 17 00:00:00 2001 From: "serg@serg.mysql.com" <> Date: Tue, 28 Jan 2003 14:36:22 +0100 Subject: fixed "DROP table_open_in_handler" hang --- sql/mysql_priv.h | 1 + sql/sql_handler.cc | 37 ++++++++++++++++++++++--------------- sql/sql_table.cc | 3 ++- 3 files changed, 25 insertions(+), 16 deletions(-) (limited to 'sql') diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 5a957514d28..f858251db94 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -501,6 +501,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables, /* sql_handler.cc */ int mysql_ha_open(THD *thd, TABLE_LIST *tables); int mysql_ha_close(THD *thd, TABLE_LIST *tables, bool dont_send_ok=0); +int mysql_ha_closeall(THD *thd, TABLE_LIST *tables, bool dont_send_ok=0); int mysql_ha_read(THD *, TABLE_LIST *,enum enum_ha_read_modes,char *, List *,enum ha_rkey_function,Item *,ha_rows,ha_rows); diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index 66dcf37d07f..eeaa574c69d 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -43,8 +43,8 @@ thd->open_tables=thd->handler_tables; \ thd->handler_tables=tmp; } -static TABLE **find_table_ptr_by_name(THD *thd, const char *db, - const char *table_name); +static TABLE **find_table_ptr_by_name(THD *thd,const char *db, + const char *table_name, bool is_alias); int mysql_ha_open(THD *thd, TABLE_LIST *tables) { @@ -68,7 +68,7 @@ int mysql_ha_open(THD *thd, TABLE_LIST *tables) int mysql_ha_close(THD *thd, TABLE_LIST *tables, bool dont_send_ok) { - TABLE **ptr=find_table_ptr_by_name(thd, tables->db, tables->alias); + TABLE **ptr=find_table_ptr_by_name(thd, tables->db, tables->alias, 1); if (*ptr) { @@ -87,6 +87,21 @@ int mysql_ha_close(THD *thd, TABLE_LIST *tables, bool dont_send_ok) return 0; } +int mysql_ha_closeall(THD *thd, TABLE_LIST *tables, bool dont_send_ok) +{ + TABLE **ptr=find_table_ptr_by_name(thd, tables->db, tables->real_name, 0); + + DBUG_ASSERT(dont_send_ok); + if (*ptr) + { +// if (!dont_send_ok) VOID(pthread_mutex_lock(&LOCK_open)); + close_thread_table(thd, ptr); +// if (!dont_send_ok) VOID(pthread_mutex_unlock(&LOCK_open)); + } +// if (!dont_send_ok) send_ok(&thd->net); + return 0; +} + static enum enum_ha_read_modes rkey_to_rnext[]= { RNEXT, RNEXT, RPREV, RNEXT, RPREV, RNEXT, RPREV }; @@ -97,7 +112,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, ha_rows select_limit,ha_rows offset_limit) { int err, keyno=-1; - TABLE *table=*find_table_ptr_by_name(thd, tables->db, tables->alias); + TABLE *table=*find_table_ptr_by_name(thd, tables->db, tables->alias, 1); if (!table) { my_printf_error(ER_UNKNOWN_TABLE,ER(ER_UNKNOWN_TABLE),MYF(0), @@ -250,17 +265,8 @@ err0: return -1; } -/************************************************************************** - 2Monty: It could easily happen, that the following service functions are - already defined somewhere in the code, but I failed to find them. - If this is the case, just say a word and I'll use old functions here. -**************************************************************************/ - -/* Note: this function differs from find_locked_table() because we're looking - here for alias, not real table name - */ static TABLE **find_table_ptr_by_name(THD *thd, const char *db, - const char *alias) + const char *table_name, bool is_alias) { int dblen; TABLE **ptr; @@ -273,9 +279,10 @@ static TABLE **find_table_ptr_by_name(THD *thd, const char *db, for (TABLE *table=*ptr; table ; table=*ptr) { if (!memcmp(table->table_cache_key, db, dblen) && - !my_strcasecmp(table->table_name,alias)) + !my_strcasecmp((is_alias ? table->table_name : table->real_name),table_name)) break; ptr=&(table->next); } return ptr; } + diff --git a/sql/sql_table.cc b/sql/sql_table.cc index a763d6b6b91..a9edfc1ec1f 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -74,7 +74,7 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists) } error=mysql_rm_table_part2(thd,tables,if_exists,0); - err: + err: pthread_mutex_unlock(&LOCK_open); VOID(pthread_cond_broadcast(&COND_refresh)); // Signal to refresh @@ -136,6 +136,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, for (table=tables ; table ; table=table->next) { char *db=table->db ? table->db : thd->db; + mysql_ha_closeall(thd, table, 1); if (!close_temporary_table(thd, db, table->real_name)) { tmp_table_deleted=1; -- cgit v1.2.1 From ce37b7aac434f7f2c17498bec68f2f813cfd46e0 Mon Sep 17 00:00:00 2001 From: "miguel@hegel.local" <> Date: Tue, 28 Jan 2003 13:50:36 -0200 Subject: Use on Unix hostname.err only when --log-error=path. Asked by Heikki and Peter. --- sql/mysqld.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sql') diff --git a/sql/mysqld.cc b/sql/mysqld.cc index f6878febc0f..f58e3c6157c 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2214,6 +2214,7 @@ int main(int argc, char **argv) { if (log_error_file_ptr != log_error_file) strmake(log_error_file, log_error_file_ptr, sizeof(log_error_file)); +#ifdef __WIN__ else { char *end; @@ -2224,6 +2225,7 @@ int main(int argc, char **argv) *strxnmov(end, sizeof(log_error_file)-length-1, glob_hostname, ".err", NullS)= 0; } +#endif if (log_error_file[0] != 0) if (freopen(log_error_file, "a+", stdout)) freopen(log_error_file, "a+", stderr); -- cgit v1.2.1 From 1ced5948f0c4fd4ab57fe97b1d3b6161038c7070 Mon Sep 17 00:00:00 2001 From: "serg@serg.mysql.com" <> Date: Tue, 28 Jan 2003 17:42:08 +0100 Subject: low-level error messages cleanup --- sql/ha_innodb.cc | 2 +- sql/ha_isam.cc | 2 +- sql/ha_myisam.cc | 2 +- sql/ha_myisammrg.cc | 2 +- sql/handler.cc | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'sql') diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index a25aedaa89f..58a6faa7ef8 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -231,7 +231,7 @@ convert_error_code_to_mysql( } else if (error == (int) DB_COL_APPEARS_TWICE_IN_INDEX) { - return(HA_ERR_WRONG_TABLE_DEF); + return(HA_ERR_CRASHED); } else if (error == (int) DB_OUT_OF_FILE_SPACE) { diff --git a/sql/ha_isam.cc b/sql/ha_isam.cc index 6fa54d18aac..7371628890f 100644 --- a/sql/ha_isam.cc +++ b/sql/ha_isam.cc @@ -35,7 +35,7 @@ *****************************************************************************/ const char **ha_isam::bas_ext() const -{ static const char *ext[]= { ".ISD",".ISM", NullS }; return ext; } +{ static const char *ext[]= { ".ISM",".ISD", NullS }; return ext; } int ha_isam::open(const char *name, int mode, uint test_if_locked) diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 19e97c60dd3..81b04cf5ba7 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -117,7 +117,7 @@ void mi_check_print_warning(MI_CHECK *param, const char *fmt,...) } const char **ha_myisam::bas_ext() const -{ static const char *ext[]= { ".MYD",".MYI", NullS }; return ext; } +{ static const char *ext[]= { ".MYI",".MYD", NullS }; return ext; } const char *ha_myisam::index_type(uint key_number) diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc index a93d2e5ed43..616248b2cf3 100644 --- a/sql/ha_myisammrg.cc +++ b/sql/ha_myisammrg.cc @@ -69,7 +69,7 @@ int ha_myisammrg::open(const char *name, int mode, uint test_if_locked) err: myrg_close(file); file=0; - return (my_errno= HA_ERR_WRONG_TABLE_DEF); + return (my_errno= HA_ERR_WRONG_MRG_TABLE_DEF); } int ha_myisammrg::close(void) diff --git a/sql/handler.cc b/sql/handler.cc index d4fd45613d4..fb33888e91e 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -679,7 +679,7 @@ void handler::print_error(int error, myf errflag) case HA_ERR_END_OF_FILE: textno=ER_KEY_NOT_FOUND; break; - case HA_ERR_WRONG_TABLE_DEF: + case HA_ERR_WRONG_MRG_TABLE_DEF: textno=ER_WRONG_MRG_TABLE; break; case HA_ERR_FOUND_DUPP_KEY: -- cgit v1.2.1 From 682cca2e75687a307f65b47abe2553adbe98cf95 Mon Sep 17 00:00:00 2001 From: "peter@mysql.com" <> Date: Tue, 28 Jan 2003 20:33:47 +0300 Subject: Fix predicted first rand() call --- sql/sql_class.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 5f73c6fa64e..727807415da 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -156,7 +156,7 @@ THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0), */ { pthread_mutex_lock(&LOCK_thread_count); - ulong tmp=(ulong) (rnd(&sql_rand) * 3000000); + ulong tmp=(ulong) (rnd(&sql_rand) * 0xffffffff); /* make all bits random */ pthread_mutex_unlock(&LOCK_thread_count); randominit(&rand, tmp + (ulong) &rand, tmp + (ulong) ::query_id); } -- cgit v1.2.1 From 3d289137408af20fb18a0606ee562ded1bb984d9 Mon Sep 17 00:00:00 2001 From: "monty@mashka.mysql.fi" <> Date: Tue, 28 Jan 2003 20:56:35 +0200 Subject: Only write to the error log if --log-error is specified and --console is not specified (On Windows --log-error is enabled by default) --- sql/log.cc | 2 +- sql/mysql_priv.h | 2 +- sql/mysqld.cc | 46 ++++++++++++++++++++++++---------------------- sql/sql_udf.cc | 2 +- 4 files changed, 27 insertions(+), 25 deletions(-) (limited to 'sql') diff --git a/sql/log.cc b/sql/log.cc index 4da850a0a7f..073b7f691e8 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1583,7 +1583,7 @@ void sql_perror(const char *message) bool flush_error_log() { bool result=0; - if (log_error_file[0] != '\0') /* --log-error="" */ + if (opt_error_log) { char err_renamed[FN_REFLEN], *end; end= strmake(err_renamed,log_error_file,FN_REFLEN-4); diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 5d8afbc6149..26ac705a5bd 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -666,7 +666,7 @@ extern uint delay_key_write_options; extern bool opt_endinfo, using_udf_functions, locked_in_memory; extern bool opt_using_transactions, mysql_embedded; extern bool using_update_log, opt_large_files; -extern bool opt_log, opt_update_log, opt_bin_log, opt_slow_log; +extern bool opt_log, opt_update_log, opt_bin_log, opt_slow_log, opt_error_log; extern bool opt_disable_networking, opt_skip_show_db; extern bool volatile abort_loop, shutdown_in_progress, grant_option; extern uint volatile thread_count, thread_running, global_read_lock; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index f6878febc0f..416a5eeb76f 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -195,7 +195,7 @@ static pthread_cond_t COND_handler_count; static uint handler_count; #endif #ifdef __WIN__ -static bool opt_console=0, start_mode=0, use_opt_args; +static bool start_mode=0, use_opt_args; static int opt_argc; static char **opt_argv; #endif @@ -280,6 +280,7 @@ ulong back_log, connect_timeout, concurrency; char mysql_home[FN_REFLEN], pidfile_name[FN_REFLEN], time_zone[30]; char log_error_file[FN_REFLEN]; bool opt_log, opt_update_log, opt_bin_log, opt_slow_log; +bool opt_error_log= IF_WIN(1,0); bool opt_disable_networking=0, opt_skip_show_db=0; my_bool opt_enable_named_pipe= 0; my_bool opt_local_infile, opt_external_locking, opt_slave_compressed_protocol; @@ -301,7 +302,7 @@ static my_bool opt_noacl=0, opt_bootstrap=0, opt_myisam_log=0; my_bool opt_safe_user_create = 0, opt_no_mix_types = 0; my_bool lower_case_table_names, opt_old_rpl_compat; my_bool opt_show_slave_auth_info, opt_sql_bin_update = 0; -my_bool opt_log_slave_updates= 0; +my_bool opt_log_slave_updates= 0, opt_console= 0; volatile bool mqh_used = 0; FILE *bootstrap_file=0; @@ -2208,27 +2209,22 @@ int main(int argc, char **argv) if (opt_slow_log) open_log(&mysql_slow_log, glob_hostname, opt_slow_logname, "-slow.log", NullS, LOG_NORMAL); -#ifdef __WIN__ - if (!opt_console) -#endif + + if (opt_error_log) { - if (log_error_file_ptr != log_error_file) - strmake(log_error_file, log_error_file_ptr, sizeof(log_error_file)); + if (!log_error_file_ptr[0]) + fn_format(log_error_file, glob_hostname, mysql_data_home, ".err", 0); + else + fn_format(log_error_file, log_error_file_ptr, mysql_data_home, ".err", + MY_UNPACK_FILENAME | MY_SAFE_PATH); + if (!log_error_file[0]) + opt_error_log= 1; // Too long file name else { - char *end; - uint length= ((end=strmake(log_error_file, - mysql_real_data_home, - FN_REFLEN-5)) - - log_error_file); - *strxnmov(end, sizeof(log_error_file)-length-1, - glob_hostname, ".err", NullS)= 0; - } - if (log_error_file[0] != 0) if (freopen(log_error_file, "a+", stdout)) - freopen(log_error_file, "a+", stderr); + freopen(log_error_file, "a+", stderr); + } } - if (ha_init()) { sql_print_error("Can't init databases"); @@ -3231,10 +3227,10 @@ struct my_option my_long_options[] = REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"bootstrap", OPT_BOOTSTRAP, "Used by mysql installation scripts", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef __WIN__ - {"console", OPT_CONSOLE, "Don't remove the console window", + {"console", OPT_CONSOLE, "Write error output on screen; Don't remove the console window on windows", (gptr*) &opt_console, (gptr*) &opt_console, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, +#ifdef __WIN__ {"standalone", OPT_STANDALONE, "Dummy option to start as a standalone program (NT)", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -3471,7 +3467,7 @@ struct my_option my_long_options[] = REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"log-error", OPT_ERROR_LOG_FILE, "Log error file", (gptr*) &log_error_file_ptr, (gptr*) &log_error_file_ptr, 0, GET_STR, - REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + OPT_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection.", (gptr*) &mysql_port, (gptr*) &mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"reckless-slave", OPT_RECKLESS_SLAVE, "For debugging", 0, 0, 0, GET_NO_ARG, @@ -4150,7 +4146,6 @@ Starts the MySQL server\n"); printf("Usage: %s [OPTIONS]\n", my_progname); #ifdef __WIN__ puts("NT and Win32 specific options:\n\ - --console Don't remove the console window\n\ --install Install the default service (NT)\n\ --install-manual Install the default service started manually (NT)\n\ --install service_name Install an optional service (NT)\n\ @@ -4295,6 +4290,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), case (int) OPT_BIN_LOG: opt_bin_log=1; break; + case (int) OPT_ERROR_LOG_FILE: + opt_error_log= 1; + break; case (int) OPT_INIT_RPL_ROLE: { int role; @@ -4515,6 +4513,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), case (int) OPT_STANDALONE: /* Dummy option for NT */ break; #endif + case OPT_CONSOLE: + if (opt_console) + opt_error_log= 0; // Force logs to stdout + break; #ifdef __NETWARE__ case (int) OPT_AUTOCLOSE: setscreenmode(SCR_AUTOCLOSE_ON_EXIT); diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index 8ac313e1127..8a1c19568ae 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -145,7 +145,7 @@ void udf_init() tables.lock_type = TL_READ; tables.db=new_thd->db; - if (open_tables(new_thd, &tables)) + if (open_and_lock_tables(new_thd, &tables)) { DBUG_PRINT("error",("Can't open udf table")); sql_print_error("Can't open mysql/func table"); -- cgit v1.2.1 From 2db574ea199cd363c688ec1792ea03b5f2f2f110 Mon Sep 17 00:00:00 2001 From: "heikki@hundin.mysql.fi" <> Date: Wed, 29 Jan 2003 00:31:56 +0200 Subject: ha_innodb.cc: Fix a bug REPLACE INTO t SELECT ... did not work if t has an auto-inc column --- sql/ha_innodb.cc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'sql') diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index a25aedaa89f..fb1f99f2160 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -1733,6 +1733,7 @@ ha_innobase::write_row( ibool incremented_auto_inc_for_stat = FALSE; ibool incremented_auto_inc_counter = FALSE; ibool skip_auto_inc_decr; + ibool success; DBUG_ENTER("ha_innobase::write_row"); @@ -1908,9 +1909,18 @@ ha_innobase::write_row( the counter here. */ skip_auto_inc_decr = FALSE; - if (error == DB_DUPLICATE_KEY && - user_thd->lex.sql_command == SQLCOM_REPLACE) - skip_auto_inc_decr= TRUE; + + /* Note that MySQL classifies in lex.sql_command a query + of type REPLACE INTO ... SELECT as simply SQLCOM_QUERY. + We have to scan the query string if the query is actually + a REPLACE. */ + + dict_accept(user_thd->query, "REPLACE", &success); + + if (error == DB_DUPLICATE_KEY && success) { + + skip_auto_inc_decr= TRUE; + } if (!skip_auto_inc_decr && incremented_auto_inc_counter && prebuilt->trx->auto_inc_lock) { -- cgit v1.2.1 From d2328365e0a0db890608630aa2e7a56572acedfe Mon Sep 17 00:00:00 2001 From: "heikki@hundin.mysql.fi" <> Date: Wed, 29 Jan 2003 02:19:00 +0200 Subject: ha_innodb.cc: Cleanup of the previous bug fix: replace code is either SQLCOM_REPLACE or SQLCOM_REPLACE_SELECT --- sql/ha_innodb.cc | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'sql') diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index fb1f99f2160..caddd77fab8 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -1733,7 +1733,6 @@ ha_innobase::write_row( ibool incremented_auto_inc_for_stat = FALSE; ibool incremented_auto_inc_counter = FALSE; ibool skip_auto_inc_decr; - ibool success; DBUG_ENTER("ha_innobase::write_row"); @@ -1910,14 +1909,10 @@ ha_innobase::write_row( skip_auto_inc_decr = FALSE; - /* Note that MySQL classifies in lex.sql_command a query - of type REPLACE INTO ... SELECT as simply SQLCOM_QUERY. - We have to scan the query string if the query is actually - a REPLACE. */ - - dict_accept(user_thd->query, "REPLACE", &success); - - if (error == DB_DUPLICATE_KEY && success) { + if (error == DB_DUPLICATE_KEY + && (user_thd->lex.sql_command == SQLCOM_REPLACE + || user_thd->lex.sql_command + == SQLCOM_REPLACE_SELECT)) { skip_auto_inc_decr= TRUE; } -- cgit v1.2.1 From c6beb583f6f251ccd86651f7063aaee431463755 Mon Sep 17 00:00:00 2001 From: "bell@sanja.is.com.ua" <> Date: Wed, 29 Jan 2003 10:38:56 +0200 Subject: fixed functions to be able work with group function as argument made bisone 1.75 compatible code --- sql/item_cmpfunc.cc | 43 +++++++- sql/item_cmpfunc.h | 2 + sql/item_func.cc | 11 ++ sql/item_func.h | 1 + sql/item_strfunc.cc | 39 +++++++ sql/item_strfunc.h | 5 +- sql/sql_yacc.yy | 311 ++++++++++++++++++++++++++++++++++++++++++++++------ 7 files changed, 374 insertions(+), 38 deletions(-) (limited to 'sql') diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index c3381eb76ea..e82dc3f90ce 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -287,6 +287,19 @@ void Item_func_interval::fix_length_and_dec() } maybe_null=0; max_length=2; used_tables_cache|=item->used_tables(); + with_sum_func= with_sum_func || item->with_sum_func; +} + +void Item_func_interval::split_sum_func(List &fields) +{ + if (item->with_sum_func && item->type() != SUM_FUNC_ITEM) + item->split_sum_func(fields); + else if (item->used_tables() || item->type() == SUM_FUNC_ITEM) + { + fields.push_front(item); + item= new Item_ref((Item**) fields.head_ref(), 0, item->name); + } + Item_int_func::split_sum_func(fields); } /* @@ -739,17 +752,45 @@ Item_func_case::fix_fields(THD *thd,TABLE_LIST *tables) { used_tables_cache|=(first_expr)->used_tables(); const_item_cache&= (first_expr)->const_item(); + with_sum_func= with_sum_func || (first_expr)->with_sum_func; } if (else_expr) { used_tables_cache|=(else_expr)->used_tables(); const_item_cache&= (else_expr)->const_item(); + with_sum_func= with_sum_func || (else_expr)->with_sum_func; } if (!else_expr || else_expr->maybe_null) maybe_null=1; // The result may be NULL return 0; } +void Item_func_case::split_sum_func(List &fields) +{ + if (first_expr) + { + if (first_expr->with_sum_func && first_expr->type() != SUM_FUNC_ITEM) + first_expr->split_sum_func(fields); + else if (first_expr->used_tables() || first_expr->type() == SUM_FUNC_ITEM) + { + fields.push_front(first_expr); + first_expr= new Item_ref((Item**) fields.head_ref(), 0, + first_expr->name); + } + } + if (else_expr) + { + if (else_expr->with_sum_func && else_expr->type() != SUM_FUNC_ITEM) + else_expr->split_sum_func(fields); + else if (else_expr->used_tables() || else_expr->type() == SUM_FUNC_ITEM) + { + fields.push_front(else_expr); + else_expr= new Item_ref((Item**) fields.head_ref(), 0, else_expr->name); + } + } + Item_func::split_sum_func(fields); +} + void Item_func_case::update_used_tables() { Item_func::update_used_tables(); @@ -1038,7 +1079,7 @@ void Item_func_in::split_sum_func(List &fields) else if (item->used_tables() || item->type() == SUM_FUNC_ITEM) { fields.push_front(item); - item=new Item_ref((Item**) fields.head_ref(),0,item->name); + item= new Item_ref((Item**) fields.head_ref(), 0, item->name); } Item_func::split_sum_func(fields); } diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index b82f4eade73..5105eb9279d 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -180,6 +180,7 @@ public: { return (item->fix_fields(thd,tlist) || Item_func::fix_fields(thd,tlist)); } + void split_sum_func(List &fields); void fix_length_and_dec(); ~Item_func_interval() { delete item; } const char *func_name() const { return "interval"; } @@ -259,6 +260,7 @@ public: const char *func_name() const { return "case"; } void print(String *str); bool fix_fields(THD *thd,struct st_table_list *tlist); + void split_sum_func(List &fields); Item *find_item(String *str); }; diff --git a/sql/item_func.cc b/sql/item_func.cc index b73436afbcf..723585be0b1 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -864,6 +864,17 @@ longlong Item_func_field::val_int() return 0; } +void Item_func_field::split_sum_func(List &fields) +{ + if (item->with_sum_func && item->type() != SUM_FUNC_ITEM) + item->split_sum_func(fields); + else if (item->used_tables() || item->type() == SUM_FUNC_ITEM) + { + fields.push_front(item); + item= new Item_ref((Item**) fields.head_ref(), 0, item->name); + } + Item_func::split_sum_func(fields); +} longlong Item_func_ascii::val_int() { diff --git a/sql/item_func.h b/sql/item_func.h index 1d85973055b..853995a7c92 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -517,6 +517,7 @@ public: { return (item->fix_fields(thd,tlist) || Item_func::fix_fields(thd,tlist)); } + void split_sum_func(List &fields); void update_used_tables() { item->update_used_tables() ; Item_func::update_used_tables(); diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 54fc427edf0..323810398ec 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -310,6 +310,17 @@ null: return 0; } +void Item_func_concat_ws::split_sum_func(List &fields) +{ + if (separator->with_sum_func && separator->type() != SUM_FUNC_ITEM) + separator->split_sum_func(fields); + else if (separator->used_tables() || separator->type() == SUM_FUNC_ITEM) + { + fields.push_front(separator); + separator= new Item_ref((Item**) fields.head_ref(), 0, separator->name); + } + Item_str_func::split_sum_func(fields); +} void Item_func_concat_ws::fix_length_and_dec() { @@ -323,6 +334,7 @@ void Item_func_concat_ws::fix_length_and_dec() } used_tables_cache|=separator->used_tables(); const_item_cache&=separator->const_item(); + with_sum_func= with_sum_func || separator->with_sum_func; } void Item_func_concat_ws::update_used_tables() @@ -1221,6 +1233,19 @@ void Item_func_elt::fix_length_and_dec() } +void Item_func_elt::split_sum_func(List &fields) +{ + if (item->with_sum_func && item->type() != SUM_FUNC_ITEM) + item->split_sum_func(fields); + else if (item->used_tables() || item->type() == SUM_FUNC_ITEM) + { + fields.push_front(item); + item= new Item_ref((Item**) fields.head_ref(), 0, item->name); + } + Item_str_func::split_sum_func(fields); +} + + void Item_func_elt::update_used_tables() { Item_func::update_used_tables(); @@ -1267,6 +1292,19 @@ String *Item_func_elt::val_str(String *str) } +void Item_func_make_set::split_sum_func(List &fields) +{ + if (item->with_sum_func && item->type() != SUM_FUNC_ITEM) + item->split_sum_func(fields); + else if (item->used_tables() || item->type() == SUM_FUNC_ITEM) + { + fields.push_front(item); + item= new Item_ref((Item**) fields.head_ref(), 0, item->name); + } + Item_str_func::split_sum_func(fields); +} + + void Item_func_make_set::fix_length_and_dec() { max_length=arg_count-1; @@ -1274,6 +1312,7 @@ void Item_func_make_set::fix_length_and_dec() max_length+=args[i]->max_length; used_tables_cache|=item->used_tables(); const_item_cache&=item->const_item(); + with_sum_func= with_sum_func || item->with_sum_func; } diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 8f7049cd8f6..a955c0ed4f3 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -75,7 +75,8 @@ public: return (separator->fix_fields(thd,tlist) || Item_func::fix_fields(thd,tlist)); } - const char *func_name() const { return "concat_ws"; } + void split_sum_func(List &fields); + const char *func_name() const { return "concat_ws"; } }; class Item_func_reverse :public Item_str_func @@ -296,6 +297,7 @@ public: { return (item->fix_fields(thd,tlist) || Item_func::fix_fields(thd,tlist)); } + void split_sum_func(List &fields); void fix_length_and_dec(); void update_used_tables(); const char *func_name() const { return "elt"; } @@ -315,6 +317,7 @@ public: { return (item->fix_fields(thd,tlist) || Item_func::fix_fields(thd,tlist)); } + void split_sum_func(List &fields); void fix_length_and_dec(); void update_used_tables(); const char *func_name() const { return "make_set"; } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index a9c1121adaa..d751dcd0927 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -559,6 +559,7 @@ query: } } | verb_clause END_OF_INPUT {} + ; verb_clause: alter @@ -596,6 +597,7 @@ verb_clause: | unlock | update | use + ; /* change master */ @@ -606,11 +608,14 @@ change: lex->sql_command = SQLCOM_CHANGE_MASTER; memset(&lex->mi, 0, sizeof(lex->mi)); } master_defs + {} + ; master_defs: - master_def - | - master_defs ',' master_def + master_def + | + master_defs ',' master_def + ; master_def: MASTER_HOST_SYM EQ TEXT_STRING @@ -647,7 +652,7 @@ master_def: { Lex->mi.connect_retry = $3; } - + ; /* create a table */ @@ -670,7 +675,7 @@ create: lex->create_info.db_type= default_table_type; } create2 - + {} | CREATE opt_unique_or_fulltext INDEX ident ON table_ident { Lex->sql_command= SQLCOM_CREATE_INDEX; @@ -704,10 +709,12 @@ create: Lex->udf.returns=(Item_result) $7; Lex->udf.dl=$9.str; } + ; create2: '(' field_list ')' opt_create_table_options create3 {} | opt_create_table_options create3 {} + ; create3: /* empty */ {} @@ -717,33 +724,41 @@ create3: mysql_init_select(Lex); } select_options select_item_list opt_select_from {} + ; opt_as: /* empty */ {} | AS {} + ; opt_table_options: /* empty */ { $$= 0; } | table_options { $$= $1;} + ; table_options: table_option { $$=$1; } | table_option table_options { $$= $1 | $2; } + ; table_option: TEMPORARY { $$=HA_LEX_CREATE_TMP_TABLE; } + ; opt_if_not_exists: /* empty */ { $$= 0; } | IF NOT EXISTS { $$=HA_LEX_CREATE_IF_NOT_EXISTS; } + ; opt_create_table_options: /* empty */ | create_table_options + ; create_table_options: create_table_option | create_table_option create_table_options + ; create_table_option: TYPE_SYM EQ table_types { Lex->create_info.db_type= $3; } @@ -773,6 +788,7 @@ create_table_option: table_list->next=0; lex->create_info.used_fields|= HA_CREATE_USED_UNION; } + ; table_types: ISAM_SYM { $$= DB_TYPE_ISAM; } @@ -782,35 +798,41 @@ table_types: | BERKELEY_DB_SYM { $$= DB_TYPE_BERKELEY_DB; } | INNOBASE_SYM { $$= DB_TYPE_INNOBASE; } | GEMINI_SYM { $$= DB_TYPE_GEMINI; } + ; row_types: DEFAULT { $$= ROW_TYPE_DEFAULT; } | FIXED_SYM { $$= ROW_TYPE_FIXED; } | DYNAMIC_SYM { $$= ROW_TYPE_DYNAMIC; } | COMPRESSED_SYM { $$= ROW_TYPE_COMPRESSED; } + ; raid_types: RAID_STRIPED_SYM { $$= RAID_TYPE_0; } | RAID_0_SYM { $$= RAID_TYPE_0; } | ULONG_NUM { $$=$1;} + ; opt_select_from: /* empty */ | select_from select_lock_type + ; udf_func_type: /* empty */ { $$ = UDFTYPE_FUNCTION; } | AGGREGATE_SYM { $$ = UDFTYPE_AGGREGATE; } + ; udf_type: STRING_SYM {$$ = (int) STRING_RESULT; } | REAL {$$ = (int) REAL_RESULT; } | INT_SYM {$$ = (int) INT_RESULT; } + ; field_list: field_list_item | field_list ',' field_list_item - + ; field_list_item: field_spec @@ -831,10 +853,12 @@ field_list_item: { Lex->col_list.empty(); /* Alloced by sql_alloc */ } + ; opt_constraint: /* empty */ | CONSTRAINT opt_ident + ; field_spec: field_ident @@ -851,6 +875,7 @@ field_spec: Lex->interval)) YYABORT; } + ; type: int_type opt_len field_options { Lex->length=$2; $$=$1; } @@ -908,17 +933,20 @@ type: Lex->interval=typelib(Lex->interval_list); $$=FIELD_TYPE_SET; } + ; char: CHAR_SYM {} | NCHAR_SYM {} | NATIONAL_SYM CHAR_SYM {} + ; varchar: char VARYING {} | VARCHAR {} | NATIONAL_SYM VARCHAR {} | NCHAR_SYM VARCHAR {} + ; int_type: INT_SYM { $$=FIELD_TYPE_LONG; } @@ -926,46 +954,55 @@ int_type: | SMALLINT { $$=FIELD_TYPE_SHORT; } | MEDIUMINT { $$=FIELD_TYPE_INT24; } | BIGINT { $$=FIELD_TYPE_LONGLONG; } + ; real_type: REAL { $$= current_thd->sql_mode & MODE_REAL_AS_FLOAT ? FIELD_TYPE_FLOAT : FIELD_TYPE_DOUBLE; } | DOUBLE_SYM { $$=FIELD_TYPE_DOUBLE; } | DOUBLE_SYM PRECISION { $$=FIELD_TYPE_DOUBLE; } - + ; float_options: /* empty */ {} | '(' NUM ')' { Lex->length=$2.str; } | '(' NUM ',' NUM ')' { Lex->length=$2.str; Lex->dec=$4.str; } + ; field_options: /* empty */ {} | field_opt_list {} + ; field_opt_list: field_opt_list field_option {} | field_option {} + ; field_option: UNSIGNED { Lex->type|= UNSIGNED_FLAG;} | ZEROFILL { Lex->type|= UNSIGNED_FLAG | ZEROFILL_FLAG; } + ; opt_len: /* empty */ { $$=(char*) 0; } /* use default length */ | '(' NUM ')' { $$=$2.str; } + ; opt_precision: /* empty */ {} | '(' NUM ',' NUM ')' { Lex->length=$2.str; Lex->dec=$4.str; } + ; opt_attribute: /* empty */ {} | opt_attribute_list {} + ; opt_attribute_list: opt_attribute_list attribute {} | attribute + ; attribute: NULL_SYM { Lex->type&= ~ NOT_NULL_FLAG; } @@ -975,10 +1012,12 @@ attribute: | 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; } + ; opt_binary: /* empty */ {} | BINARY { Lex->type|=BINARY_FLAG; } + ; references: REFERENCES table_ident opt_on_delete {} @@ -986,21 +1025,24 @@ references: { Lex->col_list.empty(); /* Alloced by sql_alloc */ } + ; opt_on_delete: /* empty */ {} | opt_on_delete_list {} + ; opt_on_delete_list: opt_on_delete_list opt_on_delete_item {} | opt_on_delete_item {} - + ; opt_on_delete_item: ON DELETE_SYM delete_option {} | ON UPDATE_SYM delete_option {} | MATCH FULL {} | MATCH PARTIAL {} + ; delete_option: RESTRICT {} @@ -1008,6 +1050,7 @@ delete_option: | SET NULL_SYM {} | NO_SYM ACTION {} | SET DEFAULT {} + ; key_type: opt_constraint PRIMARY_SYM KEY_SYM { $$= Key::PRIMARY; } @@ -1016,35 +1059,43 @@ key_type: | FULLTEXT_SYM key_or_index { $$= Key::FULLTEXT; } | opt_constraint UNIQUE_SYM { $$= Key::UNIQUE; } | opt_constraint UNIQUE_SYM key_or_index { $$= Key::UNIQUE; } + ; key_or_index: KEY_SYM {} | INDEX {} + ; keys_or_index: KEYS {} | INDEX {} + ; opt_unique_or_fulltext: /* empty */ { $$= Key::MULTIPLE; } | UNIQUE_SYM { $$= Key::UNIQUE; } | FULLTEXT_SYM { $$= Key::FULLTEXT; } + ; key_list: key_list ',' key_part order_dir { Lex->col_list.push_back($3); } | key_part order_dir { Lex->col_list.push_back($1); } + ; key_part: ident { $$=new key_part_spec($1.str); } | ident '(' NUM ')' { $$=new key_part_spec($1.str,(uint) atoi($3.str)); } + ; opt_ident: /* empty */ { $$=(char*) 0; } /* Defaultlength */ | field_ident { $$=$1.str; } + ; string_list: text_string { Lex->interval_list.push_back($1); } | string_list ',' text_string { Lex->interval_list.push_back($3); } + ; /* ** Alter table @@ -1072,13 +1123,17 @@ alter: lex->create_info.db_type= DB_TYPE_DEFAULT; } alter_list + {} + ; alter_list: | alter_list_item | alter_list ',' alter_list_item + ; add_column: ADD opt_column { Lex->change=0;} + ; alter_list_item: add_column field_list_item opt_place @@ -1114,29 +1169,35 @@ alter_list_item: { Lex->db=$4->db.str ; Lex->name= $4->table.str; } | create_table_options | order_clause + ; opt_column: /* empty */ {} | COLUMN_SYM {} + ; opt_ignore: /* empty */ { Lex->duplicates=DUP_ERROR; } | IGNORE_SYM { Lex->duplicates=DUP_IGNORE; } + ; opt_restrict: /* empty */ {} | RESTRICT {} | CASCADE {} + ; opt_place: /* empty */ {} | AFTER_SYM ident { store_position_for_column($2.str); } | FIRST_SYM { store_position_for_column(first_keyword); } + ; opt_to: /* empty */ {} | TO_SYM {} | AS {} + ; slave: SLAVE START_SYM @@ -1149,7 +1210,8 @@ slave: { Lex->sql_command = SQLCOM_SLAVE_STOP; Lex->type = 0; - }; + } + ; restore: RESTORE_SYM table_or_tables @@ -1160,6 +1222,8 @@ restore: { Lex->backup_dir = $6.str; } + ; + backup: BACKUP_SYM table_or_tables { @@ -1169,7 +1233,7 @@ backup: { Lex->backup_dir = $6.str; } - + ; repair: REPAIR table_or_tables @@ -1178,16 +1242,19 @@ repair: Lex->check_opt.init(); } table_list opt_mi_check_type - + {} + ; opt_mi_check_type: /* empty */ { Lex->check_opt.flags = T_MEDIUM; } | TYPE_SYM EQ mi_check_types {} | mi_check_types {} + ; mi_check_types: mi_check_type {} | mi_check_type mi_check_types {} + ; mi_check_type: QUICK { Lex->check_opt.quick = 1; } @@ -1195,6 +1262,7 @@ mi_check_type: | MEDIUM_SYM { Lex->check_opt.flags|= T_MEDIUM; } | EXTENDED_SYM { Lex->check_opt.flags|= T_EXTEND; } | CHANGED { Lex->check_opt.flags|= T_CHECK_ONLY_CHANGED; } + ; analyze: ANALYZE_SYM table_or_tables @@ -1203,6 +1271,8 @@ analyze: Lex->check_opt.init(); } table_list opt_mi_check_type + {} + ; check: CHECK_SYM table_or_tables @@ -1211,6 +1281,8 @@ check: Lex->check_opt.init(); } table_list opt_mi_check_type + {} + ; optimize: OPTIMIZE table_or_tables @@ -1219,6 +1291,8 @@ optimize: Lex->check_opt.init(); } table_list opt_mi_check_type + {} + ; rename: RENAME table_or_tables @@ -1226,10 +1300,14 @@ rename: Lex->sql_command=SQLCOM_RENAME_TABLE; } table_to_table_list + {} + ; table_to_table_list: table_to_table | table_to_table_list ',' table_to_table + {} + ; table_to_table: table_ident TO_SYM table_ident @@ -1237,6 +1315,7 @@ table_to_table: !add_table_to_list($3,NULL,1,TL_IGNORE)) YYABORT; } + ; /* Select : retrieve data from table @@ -1252,24 +1331,29 @@ select: mysql_init_select(lex); } select_options select_item_list select_into select_lock_type + {} + ; select_into: /* empty */ | select_from | opt_into select_from | select_from opt_into + ; select_from: FROM join_table_list where_clause group_clause having_clause opt_order_clause limit_clause procedure_clause - + ; select_options: /* empty*/ | select_option_list + ; select_option_list: select_option_list select_option | select_option + ; select_option: STRAIGHT_JOIN { Lex->options|= SELECT_STRAIGHT_JOIN; } @@ -1279,6 +1363,7 @@ select_option: | SQL_BIG_RESULT { Lex->options|= SELECT_BIG_RESULT; } | SQL_BUFFER_RESULT { Lex->options|= OPTION_BUFFER_RESULT; } | ALL {} + ; select_lock_type: /* empty */ @@ -1286,6 +1371,7 @@ select_lock_type: { Lex->lock_option= TL_WRITE; } | LOCK_SYM IN_SYM SHARE_SYM MODE_SYM { Lex->lock_option= TL_READ_WITH_SHARED_LOCKS; } + ; select_item_list: select_item_list ',' select_item @@ -1295,7 +1381,7 @@ select_item_list: if (add_item_to_list(new Item_field(NULL,NULL,"*"))) YYABORT; } - + ; select_item: remember_name select_item2 remember_end select_alias @@ -1307,16 +1393,20 @@ select_item: else if (!$2->name) $2->set_name($1,(uint) ($3 - $1)); } + ; remember_name: { $$=(char*) Lex->tok_start; } + ; remember_end: { $$=(char*) Lex->tok_end; } + ; select_item2: table_wild { $$=$1; } /* table.* */ | expr { $$=$1; } + ; select_alias: { $$.str=0;} @@ -1324,14 +1414,17 @@ select_alias: | AS TEXT_STRING { $$=$2; } | ident { $$=$1; } | TEXT_STRING { $$=$1; } + ; optional_braces: /* empty */ {} | '(' ')' {} + ; /* all possible expressions */ expr: expr_expr {$$ = $1; } | simple_expr {$$ = $1; } + ; /* expressions that begin with 'expr' */ expr_expr: @@ -1372,6 +1465,7 @@ expr_expr: { $$= new Item_date_add_interval($1,$4,$5,0); } | expr '-' INTERVAL_SYM expr interval { $$= new Item_date_add_interval($1,$4,$5,1); } + ; /* expressions that begin with 'expr' that do NOT follow IN_SYM */ no_in_expr: @@ -1409,6 +1503,7 @@ no_in_expr: | no_in_expr '-' INTERVAL_SYM expr interval { $$= new Item_date_add_interval($1,$4,$5,1); } | simple_expr + ; /* expressions that begin with 'expr' that does NOT follow AND */ no_and_expr: @@ -1449,6 +1544,7 @@ no_and_expr: | no_and_expr '-' INTERVAL_SYM expr interval { $$= new Item_date_add_interval($1,$4,$5,1); } | simple_expr + ; simple_expr: simple_ident @@ -1668,10 +1764,12 @@ simple_expr: { $$=new Item_func_benchmark($3,$5); } | EXTRACT_SYM '(' interval FROM expr ')' { $$=new Item_extract( $3, $5); } + ; udf_expr_list: /* empty */ { $$= NULL; } | expr_list { $$= $1;} + ; sum_expr: AVG_SYM '(' in_sum_expr ')' @@ -1696,6 +1794,7 @@ sum_expr: { $$=new Item_sum_std($3); } | SUM_SYM '(' in_sum_expr ')' { $$=new Item_sum_sum($3); } + ; in_sum_expr: { Lex->in_sum_expr++; } @@ -1704,37 +1803,45 @@ in_sum_expr: Lex->in_sum_expr--; $$=$2; } + ; expr_list: { Lex->expr_list.push_front(new List); } expr_list2 { $$= Lex->expr_list.pop(); } + ; expr_list2: expr { Lex->expr_list.head()->push_back($1); } | expr_list2 ',' expr { Lex->expr_list.head()->push_back($3); } + ; ident_list: { Lex->expr_list.push_front(new List); } ident_list2 { $$= Lex->expr_list.pop(); } + ; ident_list2: simple_ident { Lex->expr_list.head()->push_back($1); } | ident_list2 ',' simple_ident { Lex->expr_list.head()->push_back($3); } + ; opt_expr: /* empty */ { $$= NULL; } | expr { $$= $1; } + ; opt_else: /* empty */ { $$= NULL; } | ELSE expr { $$= $2; } + ; when_list: { Lex->when_list.push_front(new List); } when_list2 { $$= Lex->when_list.pop(); } + ; when_list2: expr THEN_SYM expr @@ -1747,10 +1854,12 @@ when_list2: Lex->when_list.head()->push_back($3); Lex->when_list.head()->push_back($5); } + ; opt_pad: /* empty */ { $$=new Item_string(" ",1); } | expr { $$=$1; } + ; join_table_list: '(' join_table_list ')' { $$=$2; } @@ -1784,11 +1893,13 @@ join_table_list: { add_join_natural($6,$1); $1->outer_join|=JOIN_TYPE_RIGHT; $$=$1; } | join_table_list NATURAL JOIN_SYM join_table { add_join_natural($1,$4); $$=$4; } + ; normal_join: ',' {} | JOIN_SYM {} | CROSS JOIN_SYM {} + ; join_table: { Lex->use_index_ptr=Lex->ignore_index_ptr=0; } @@ -1797,10 +1908,12 @@ join_table: Lex->ignore_index_ptr))) YYABORT; } | '{' ident join_table LEFT OUTER JOIN_SYM join_table ON expr '}' { add_join_on($7,$9); $7->outer_join|=JOIN_TYPE_LEFT; $$=$7; } + ; opt_outer: /* empty */ {} | OUTER {} + ; opt_key_definition: /* empty */ {} @@ -1808,10 +1921,12 @@ opt_key_definition: { Lex->use_index= *$2; Lex->use_index_ptr= &Lex->use_index; } | IGNORE_SYM key_usage_list { Lex->ignore_index= *$2; Lex->ignore_index_ptr= &Lex->ignore_index;} + ; key_usage_list: key_or_index { Lex->interval_list.empty(); } '(' key_usage_list2 ')' { $$= &Lex->interval_list; } + ; key_usage_list2: key_usage_list2 ',' ident @@ -1820,6 +1935,7 @@ key_usage_list2: { Lex->interval_list.push_back(new String((const char*) $1.str,$1.length)); } | PRIMARY_SYM { Lex->interval_list.push_back(new String("PRIMARY",7)); } + ; using_list: ident @@ -1831,6 +1947,7 @@ using_list: if (!($$= new Item_cond_and(new Item_func_eq(new Item_field(Lex->db1,Lex->table1,$3.str), new Item_field(Lex->db2,Lex->table2,$3.str)), $1))) YYABORT; } + ; interval: DAY_HOUR_SYM { $$=INTERVAL_DAY_HOUR; } @@ -1846,31 +1963,35 @@ interval: | SECOND_SYM { $$=INTERVAL_SECOND; } | YEAR_MONTH_SYM { $$=INTERVAL_YEAR_MONTH; } | YEAR_SYM { $$=INTERVAL_YEAR; } + ; table_alias: /* empty */ | AS | EQ + ; opt_table_alias: /* empty */ { $$=0; } | table_alias ident { $$= (LEX_STRING*) sql_memdup(&$2,sizeof(LEX_STRING)); } - + ; where_clause: /* empty */ { Lex->where= 0; } | WHERE expr { Lex->where= $2; } + ; having_clause: /* empty */ | HAVING { Lex->create_refs=1; } expr { Lex->having= $3; Lex->create_refs=0; } + ; opt_escape: ESCAPE_SYM TEXT_STRING { $$= $2.str; } | /* empty */ { $$= (char*) "\\"; } - + ; /* group by statement in select @@ -1879,12 +2000,14 @@ opt_escape: group_clause: /* empty */ | GROUP BY group_list + ; group_list: group_list ',' order_ident order_dir { if (add_group_to_list($3,(bool) $4)) YYABORT; } | order_ident order_dir { if (add_group_to_list($1,(bool) $2)) YYABORT; } + ; /* Order by statement in select @@ -1893,21 +2016,24 @@ group_list: opt_order_clause: /* empty */ | order_clause + ; order_clause: ORDER_SYM BY order_list + ; order_list: order_list ',' order_ident order_dir { if (add_order_to_list($3,(bool) $4)) YYABORT; } | order_ident order_dir { if (add_order_to_list($1,(bool) $2)) YYABORT; } + ; order_dir: /* empty */ { $$ = 1; } | ASC { $$ =1; } | DESC { $$ =0; } - + ; limit_clause: /* empty */ @@ -1919,6 +2045,7 @@ limit_clause: { Lex->select_limit= $2; Lex->offset_limit=0L; } | LIMIT ULONG_NUM ',' ULONG_NUM { Lex->select_limit= $4; Lex->offset_limit=$2; } + ; delete_limit_clause: /* empty */ @@ -1927,17 +2054,20 @@ delete_limit_clause: } | LIMIT ULONGLONG_NUM { Lex->select_limit= (ha_rows) $2; } + ; ULONG_NUM: NUM { $$= strtoul($1.str,NULL,10); } | REAL_NUM { $$= strtoul($1.str,NULL,10); } | FLOAT_NUM { $$= strtoul($1.str,NULL,10); } + ; ULONGLONG_NUM: NUM { $$= (ulonglong) strtoul($1.str,NULL,10); } | LONG_NUM { $$= strtoull($1.str,NULL,10); } | REAL_NUM { $$= strtoull($1.str,NULL,10); } | FLOAT_NUM { $$= strtoull($1.str,NULL,10); } + ; procedure_clause: /* empty */ @@ -1951,15 +2081,17 @@ procedure_clause: YYABORT; } '(' procedure_list ')' - + ; procedure_list: /* empty */ {} | procedure_list2 {} + ; procedure_list2: procedure_list2 ',' procedure_item | procedure_item + ; procedure_item: remember_name expr @@ -1969,6 +2101,7 @@ procedure_item: if (!$2->name) $2->set_name($1,(uint) ((char*) Lex->tok_end - $1)); } + ; opt_into: INTO OUTFILE TEXT_STRING @@ -1982,6 +2115,7 @@ opt_into: if (!(Lex->exchange= new sql_exchange($3.str,1))) YYABORT; } + ; /* DO statement @@ -1995,6 +2129,9 @@ do: DO_SYM YYABORT; } values + {} + ; + /* Drop : delete tables or index */ @@ -2025,19 +2162,22 @@ drop: Lex->sql_command = SQLCOM_DROP_FUNCTION; Lex->udf.name=$3.str; } - + ; table_list: table | table_list ',' table + ; table: table_ident { if (!add_table_to_list($1,NULL,1)) YYABORT; } + ; if_exists: /* empty */ { $$=0; } | IF EXISTS { $$= 1; } + ; /* ** Insert : add new data to table @@ -2045,23 +2185,30 @@ if_exists: insert: INSERT { Lex->sql_command = SQLCOM_INSERT; } insert_lock_option opt_ignore insert2 insert_field_spec + {} + ; replace: REPLACE { Lex->sql_command = SQLCOM_REPLACE; } replace_lock_option insert2 insert_field_spec + {} + ; insert_lock_option: /* empty */ { Lex->lock_option= TL_WRITE_CONCURRENT_INSERT; } | LOW_PRIORITY { Lex->lock_option= TL_WRITE_LOW_PRIORITY; } | DELAYED_SYM { Lex->lock_option= TL_WRITE_DELAYED; } | HIGH_PRIORITY { Lex->lock_option= TL_WRITE; } + ; replace_lock_option: opt_low_priority {} | DELAYED_SYM { Lex->lock_option= TL_WRITE_DELAYED; } + ; insert2: INTO insert_table {} | insert_table {} + ; insert_table: table @@ -2070,6 +2217,7 @@ insert_table: Lex->many_values.empty(); Lex->insert_list=0; } + ; insert_field_spec: opt_field_spec insert_values {} @@ -2080,15 +2228,18 @@ insert_field_spec: YYABORT; } ident_eq_list + ; opt_field_spec: /* empty */ { } | '(' fields ')' { } | '(' ')' { } + ; fields: fields ',' insert_ident { Lex->field_list.push_back($3); } | insert_ident { Lex->field_list.push_back($1); } + ; insert_values: VALUES values_list {} @@ -2101,15 +2252,18 @@ insert_values: mysql_init_select(lex); } select_options select_item_list select_from select_lock_type {} + ; values_list: values_list ',' no_braces | no_braces + ; ident_eq_list: ident_eq_list ',' ident_eq_value | ident_eq_value + ; ident_eq_value: simple_ident equal expr @@ -2118,9 +2272,11 @@ ident_eq_value: Lex->insert_list->push_back($3)) YYABORT; } + ; equal: EQ {} | SET_VAR {} + ; no_braces: '(' @@ -2133,10 +2289,12 @@ no_braces: if (Lex->many_values.push_back(Lex->insert_list)) YYABORT; } + ; opt_values: /* empty */ {} | values + ; values: values ',' expr @@ -2149,12 +2307,14 @@ values: if (Lex->insert_list->push_back($1)) YYABORT; } + ; /* Update rows in a table */ update: UPDATE_SYM opt_low_priority opt_ignore table SET update_list where_clause delete_limit_clause { Lex->sql_command = SQLCOM_UPDATE; } + ; update_list: update_list ',' simple_ident equal expr @@ -2167,10 +2327,12 @@ update_list: if (add_item_to_list($1) || add_value_to_list($3)) YYABORT; } + ; opt_low_priority: /* empty */ { Lex->lock_option= current_thd->update_lock_default; } | LOW_PRIORITY { Lex->lock_option= TL_WRITE_LOW_PRIORITY; } + ; /* Delete rows from a table */ @@ -2182,28 +2344,35 @@ delete: } opt_delete_options FROM table where_clause delete_limit_clause - + {} + ; opt_delete_options: /* empty */ {} | opt_delete_option opt_delete_options {} + ; opt_delete_option: QUICK { Lex->options|= OPTION_QUICK; } | LOW_PRIORITY { Lex->lock_option= TL_WRITE_LOW_PRIORITY; } + ; truncate: TRUNCATE_SYM opt_table_sym table { Lex->sql_command= SQLCOM_TRUNCATE; Lex->options=0; Lex->lock_option= current_thd->update_lock_default; } + ; opt_table_sym: /* empty */ | TABLE_SYM + ; /* Show things */ show: SHOW { Lex->wild=0;} show_param + {} + ; show_param: DATABASES wild @@ -2267,18 +2436,22 @@ show_param: { Lex->sql_command = SQLCOM_SHOW_SLAVE_STAT; } + ; opt_db: /* empty */ { $$= 0; } | FROM ident { $$= $2.str; } + ; wild: /* empty */ | LIKE text_string { Lex->wild= $2; } + ; opt_full: /* empty */ { Lex->verbose=0; } | FULL { Lex->verbose=1; } + ; /* A Oracle compatible synonym for show */ describe: @@ -2290,31 +2463,35 @@ describe: if (!add_table_to_list($2, NULL,0)) YYABORT; } - opt_describe_column - | describe_command select { Lex->options|= SELECT_DESCRIBE; }; - + opt_describe_column {} + | describe_command select { Lex->options|= SELECT_DESCRIBE; } + ; describe_command: DESC | DESCRIBE + ; opt_describe_column: /* empty */ {} | text_string { Lex->wild= $1; } | ident { Lex->wild= new String((const char*) $1.str,$1.length); } - + ; /* flush things */ flush: FLUSH_SYM {Lex->sql_command= SQLCOM_FLUSH; Lex->type=0; } flush_options + {} + ; flush_options: flush_options ',' flush_option | flush_option + ; flush_option: - table_or_tables { Lex->type|= REFRESH_TABLES; } opt_table_list + table_or_tables { Lex->type|= REFRESH_TABLES; } opt_table_list {} | TABLES WITH READ_SYM LOCK_SYM { Lex->type|= REFRESH_TABLES | REFRESH_READ_LOCK; } | HOSTS_SYM { Lex->type|= REFRESH_HOSTS; } | PRIVILEGES { Lex->type|= REFRESH_GRANT; } @@ -2322,21 +2499,27 @@ flush_option: | STATUS_SYM { Lex->type|= REFRESH_STATUS; } | SLAVE { Lex->type|= REFRESH_SLAVE; } | MASTER_SYM { Lex->type|= REFRESH_MASTER; } + ; opt_table_list: /* empty */ {} | table_list {} + ; reset: RESET_SYM {Lex->sql_command= SQLCOM_RESET; Lex->type=0; } reset_options + {} + ; reset_options: reset_options ',' reset_option | reset_option + ; reset_option: SLAVE { Lex->type|= REFRESH_SLAVE; } | MASTER_SYM { Lex->type|= REFRESH_MASTER; } + ; purge: PURGE { Lex->sql_command = SQLCOM_PURGE; Lex->type=0;} @@ -2344,6 +2527,7 @@ purge: { Lex->to_log = $6.str; } + ; /* kill threads */ @@ -2358,11 +2542,13 @@ kill: Lex->sql_command=SQLCOM_KILL; Lex->thread_id= (ulong) $2->val_int(); } + ; /* change database */ use: USE_SYM ident { Lex->sql_command=SQLCOM_CHANGE_DB; Lex->db= $2.str; } + ; /* import, export of files */ @@ -2389,29 +2575,34 @@ load: LOAD DATA_SYM load_data_lock opt_local INFILE TEXT_STRING YYABORT; } + ; opt_local: /* empty */ { $$=0;} | LOCAL_SYM { $$=1;} + ; load_data_lock: /* empty */ { Lex->lock_option= current_thd->update_lock_default; } | CONCURRENT { Lex->lock_option= TL_WRITE_CONCURRENT_INSERT ; } | LOW_PRIORITY { Lex->lock_option= TL_WRITE_LOW_PRIORITY; } - + ; opt_duplicate: /* empty */ { Lex->duplicates=DUP_ERROR; } | REPLACE { Lex->duplicates=DUP_REPLACE; } | IGNORE_SYM { Lex->duplicates=DUP_IGNORE; } + ; opt_field_term: /* empty */ | COLUMNS field_term_list + ; field_term_list: field_term_list field_term | field_term + ; field_term: TERMINATED BY text_string { Lex->exchange->field_term= $3;} @@ -2419,23 +2610,28 @@ field_term: { Lex->exchange->enclosed= $4; Lex->exchange->opt_enclosed=1;} | ENCLOSED BY text_string { Lex->exchange->enclosed= $3;} | ESCAPED BY text_string { Lex->exchange->escaped= $3;} + ; opt_line_term: /* empty */ | LINES line_term_list + ; line_term_list: line_term_list line_term | line_term + ; line_term: TERMINATED BY text_string { Lex->exchange->line_term= $3;} | STARTING BY text_string { Lex->exchange->line_start= $3;} + ; opt_ignore_lines: /* empty */ | IGNORE_SYM NUM LINES { Lex->exchange->skip_lines=atol($2.str); } + ; /* Common definitions */ @@ -2443,6 +2639,7 @@ text_literal: TEXT_STRING { $$ = new Item_string($1.str,$1.length); } | text_literal TEXT_STRING { ((Item_string*) $1)->append($2.str,$2.length); } + ; text_string: TEXT_STRING { $$= new String($1.str,$1.length); } @@ -2451,6 +2648,7 @@ text_string: Item *tmp = new Item_varbinary($1.str,$1.length); $$= tmp ? tmp->val_str((String*) 0) : (String*) 0; } + ; literal: text_literal { $$ = $1; } @@ -2464,6 +2662,7 @@ literal: | DATE_SYM text_literal { $$ = $2; } | TIME_SYM text_literal { $$ = $2; } | TIMESTAMP text_literal { $$ = $2; } + ; /********************************************************************** ** Createing different items. @@ -2472,14 +2671,17 @@ literal: insert_ident: simple_ident { $$=$1; } | table_wild { $$=$1; } + ; table_wild: ident '.' '*' { $$ = new Item_field(NullS,$1.str,"*"); } | ident '.' ident '.' '*' { $$ = new Item_field((current_thd->client_capabilities & CLIENT_NO_SCHEMA ? NullS : $1.str),$3.str,"*"); } + ; order_ident: expr { $$=$1; } + ; simple_ident: ident @@ -2490,17 +2692,19 @@ simple_ident: { $$ = !Lex->create_refs || Lex->in_sum_expr > 0 ? (Item*) new Item_field(NullS,$2.str,$4.str) : (Item*) new Item_ref(NullS,$2.str,$4.str); } | ident '.' ident '.' ident { $$ = !Lex->create_refs || Lex->in_sum_expr > 0 ? (Item*) new Item_field((current_thd->client_capabilities & CLIENT_NO_SCHEMA ? NullS :$1.str),$3.str,$5.str) : (Item*) new Item_ref((current_thd->client_capabilities & CLIENT_NO_SCHEMA ? NullS :$1.str),$3.str,$5.str); } - + ; field_ident: ident { $$=$1;} | ident '.' ident { $$=$3;} /* Skipp schema name in create*/ | '.' ident { $$=$2;} /* For Delphi */ + ; table_ident: ident { $$=new Table_ident($1); } | ident '.' ident { $$=new Table_ident($1,$3,0);} | '.' ident { $$=new Table_ident($2);} /* For Delphi */ + ; ident: IDENT { $$=$1; } @@ -2511,11 +2715,13 @@ ident: if (Lex->next_state != STATE_END) Lex->next_state=STATE_OPERATOR_OR_IDENT; } + ; ident_or_text: ident { $$=$1;} | TEXT_STRING { $$=$1;} | LEX_HOSTNAME { $$=$1;} + ; user: ident_or_text @@ -2530,6 +2736,7 @@ user: YYABORT; $$->user = $1; $$->host=$3; } + ; /* Keyword that we allow for identifiers */ @@ -2651,6 +2858,7 @@ keyword: | WORK_SYM {} | YEAR_SYM {} | SLAVE {} + ; /* Option functions */ @@ -2666,14 +2874,18 @@ set: lex->tx_isolation=thd->tx_isolation; } option_value_list + {} + ; opt_option: /* empty */ {} | OPTION {} + ; option_value_list: option_value | option_value_list ',' option_value + ; option_value: set_option equal NUM @@ -2791,6 +3003,7 @@ option_value: else Lex->options&= ~(OPTION_RELAXED_UNIQUE_CHECKS); } + ; text_or_password: TEXT_STRING { $$=$1.str;} @@ -2805,6 +3018,7 @@ text_or_password: $$=buff; } } + ; set_option: SQL_BIG_TABLES { $$= OPTION_BIG_TABLES; } @@ -2828,7 +3042,7 @@ set_option: | SQL_SAFE_UPDATES { $$= OPTION_SAFE_UPDATES; } | SQL_BUFFER_RESULT { $$= OPTION_BUFFER_RESULT; } | SQL_QUOTE_SHOW_CREATE { $$= OPTION_QUOTE_SHOW_CREATE; } - + ; set_isolation: GLOBAL_SYM tx_isolation @@ -2842,15 +3056,18 @@ set_isolation: { current_thd->session_tx_isolation= Lex->tx_isolation= $2; } | tx_isolation { Lex->tx_isolation= $1; } + ; tx_isolation: TRANSACTION_SYM ISOLATION LEVEL_SYM isolation_types { $$=$4; } + ; isolation_types: READ_SYM UNCOMMITTED_SYM { $$= ISO_READ_UNCOMMITTED; } | READ_SYM COMMITTED_SYM { $$= ISO_READ_COMMITTED; } | REPEATABLE_SYM READ_SYM { $$= ISO_REPEATABLE_READ; } | SERIALIZABLE_SYM { $$= ISO_SERIALIZABLE; } + ; /* Lock function */ @@ -2860,28 +3077,34 @@ lock: Lex->sql_command=SQLCOM_LOCK_TABLES; } table_lock_list + {} + ; table_or_tables: TABLE_SYM | TABLES + ; table_lock_list: table_lock | table_lock_list ',' table_lock + ; table_lock: table_ident opt_table_alias lock_option { if (!add_table_to_list($1,$2,0,(thr_lock_type) $3)) YYABORT; } + ; lock_option: READ_SYM { $$=TL_READ_NO_INSERT; } | WRITE_SYM { $$=current_thd->update_lock_default; } | LOW_PRIORITY WRITE_SYM { $$=TL_WRITE_LOW_PRIORITY; } | READ_SYM LOCAL_SYM { $$= TL_READ; } + ; unlock: UNLOCK_SYM table_or_tables { Lex->sql_command=SQLCOM_UNLOCK_TABLES; } - + ; /* GRANT / REVOKE */ @@ -2895,6 +3118,8 @@ revoke: Lex->db=0; } grant_privileges ON opt_table FROM user_list + {} + ; grant: GRANT @@ -2907,28 +3132,33 @@ grant: } grant_privileges ON opt_table TO_SYM user_list grant_option + {} + ; grant_privileges: grant_privilege_list {} | ALL PRIVILEGES { Lex->grant = UINT_MAX;} | ALL { Lex->grant = UINT_MAX;} + ; grant_privilege_list: grant_privilege | grant_privilege_list ',' grant_privilege + {} + ; grant_privilege: SELECT_SYM { Lex->which_columns = SELECT_ACL;} - opt_column_list + opt_column_list {} | INSERT { Lex->which_columns = INSERT_ACL; } - opt_column_list + opt_column_list {} | UPDATE_SYM { Lex->which_columns = UPDATE_ACL; } - opt_column_list + opt_column_list {} | DELETE_SYM { Lex->grant |= DELETE_ACL;} - | REFERENCES { Lex->which_columns = REFERENCES_ACL;} opt_column_list + | REFERENCES { Lex->which_columns = REFERENCES_ACL;} opt_column_list {} | USAGE {} | INDEX { Lex->grant |= INDEX_ACL;} | ALTER { Lex->grant |= ALTER_ACL;} @@ -2939,6 +3169,7 @@ grant_privilege: | PROCESS { Lex->grant |= PROCESS_ACL;} | FILE_SYM { Lex->grant |= FILE_ACL;} | GRANT OPTION { Lex->grant |= GRANT_ACL;} + ; opt_table: '*' @@ -2981,12 +3212,12 @@ opt_table: if (Lex->grant == UINT_MAX) Lex->grant = TABLE_ACLS & ~GRANT_ACL; } - + ; user_list: grant_user { if (Lex->users_list.push_back($1)) YYABORT;} | user_list ',' grant_user { if (Lex->users_list.push_back($3)) YYABORT;} - + ; grant_user: user IDENTIFIED_SYM BY TEXT_STRING @@ -3007,15 +3238,17 @@ grant_user: { $$=$1; $1->password=$5 ; } | user { $$=$1; $1->password.str=NullS; } - + ; opt_column_list: /* empty */ { Lex->grant |= Lex->which_columns; } | '(' column_list ')' + ; column_list: column_list ',' column_list_id | column_list_id + ; column_list_id: ident @@ -3034,20 +3267,26 @@ column_list_id: else Lex->columns.push_back(new LEX_COLUMN (*new_str,Lex->which_columns)); } + ; grant_option: /* empty */ {} | WITH GRANT OPTION { Lex->grant |= GRANT_ACL;} + ; begin: - BEGIN_SYM { Lex->sql_command = SQLCOM_BEGIN;} opt_work + BEGIN_SYM { Lex->sql_command = SQLCOM_BEGIN;} opt_work {} + ; opt_work: /* empty */ {} | WORK_SYM {} + ; commit: COMMIT_SYM { Lex->sql_command = SQLCOM_COMMIT;} + ; rollback: ROLLBACK_SYM { Lex->sql_command = SQLCOM_ROLLBACK;} + ; -- cgit v1.2.1 From d88eb71f34abc92075da6fca5489fef9cbc5abd7 Mon Sep 17 00:00:00 2001 From: "monty@mashka.mysql.fi" <> Date: Wed, 29 Jan 2003 18:56:34 +0200 Subject: Fixed handling of lower_case_table_names in SHOW TABLE STATUS, mysql_list_fields() and mysql_table_dump(). This fixes some Errcode 13 errors on Windows when deleting tables. --- sql/mysql_priv.h | 2 +- sql/mysqld.cc | 2 +- sql/sql_db.cc | 2 -- sql/sql_parse.cc | 25 +++++++++---------------- sql/sql_show.cc | 2 ++ sql/table.cc | 24 ++++++++++++++++++++++-- 6 files changed, 35 insertions(+), 22 deletions(-) (limited to 'sql') diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index a5c2c3909d3..49f1713bbc9 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -654,7 +654,7 @@ int create_frm(char *name,uint reclength,uchar *fileinfo, HA_CREATE_INFO *create_info, uint keys); void update_create_info_from_table(HA_CREATE_INFO *info, TABLE *form); int rename_file_ext(const char * from,const char * to,const char * ext); -bool check_db_name(const char *db); +bool check_db_name(char *db); bool check_column_name(const char *name); bool check_table_name(const char *name, uint length); char *get_field(MEM_ROOT *mem,TABLE *table,uint fieldnr); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index acbc09c0f68..c188a015ef3 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2031,7 +2031,7 @@ The server will not act as a slave."); init_master_info(&glob_mi); } - printf(ER(ER_READY),my_progname,server_version,""); + printf(ER(ER_READY),my_progname,server_version, mysql_unix_port, mysql_port); fflush(stdout); #ifdef __NT__ diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 1ba02bb416c..60eeb3777c4 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -337,8 +337,6 @@ bool mysql_change_db(THD *thd,const char *name) x_free(dbname); DBUG_RETURN(1); } - if (lower_case_table_names) - casedn_str(dbname); DBUG_PRINT("general",("Use database: %s", dbname)); if (test_all_bits(thd->master_access,DB_ACLS)) db_access=DB_ACLS; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index d11548a62e2..8daba09174e 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -674,16 +674,19 @@ int mysql_table_dump(THD* thd, char* db, char* tbl_name, int fd) table_list->real_name = table_list->alias = tbl_name; table_list->lock_type = TL_READ_NO_INSERT; table_list->next = 0; - remove_escape(table_list->real_name); - - if (!(table=open_ltable(thd, table_list, TL_READ_NO_INSERT))) - DBUG_RETURN(1); if (!db || check_db_name(db)) { net_printf(&thd->net,ER_WRONG_DB_NAME, db ? db : "NULL"); goto err; } + if (lower_case_table_names) + casedn_str(tbl_name); + remove_escape(tbl_name); + + if (!(table=open_ltable(thd, table_list, TL_READ_NO_INSERT))) + DBUG_RETURN(1); + if (check_access(thd, SELECT_ACL, db, &table_list->grant.privilege)) goto err; if (grant_option && check_grant(thd, SELECT_ACL, table_list)) @@ -859,6 +862,8 @@ bool do_command(THD *thd) table_list.alias= table_list.real_name= thd->strdup(packet+1); thd->query=fields=thd->strdup(strend(packet+1)+1); mysql_log.write(thd,command,"%s %s",table_list.real_name,fields); + if (lower_case_table_names) + casedn_str(table_list.real_name); remove_escape(table_list.real_name); // This can't have wildcards if (check_access(thd,SELECT_ACL,table_list.db,&thd->col_access)) @@ -888,8 +893,6 @@ bool do_command(THD *thd) net_printf(&thd->net,ER_WRONG_DB_NAME, db ? db : "NULL"); break; } - if (lower_case_table_names) - casedn_str(db); if (check_access(thd,CREATE_ACL,db,0,1)) break; mysql_log.write(thd,command,packet+1); @@ -906,8 +909,6 @@ bool do_command(THD *thd) net_printf(&thd->net,ER_WRONG_DB_NAME, db ? db : "NULL"); break; } - if (lower_case_table_names) - casedn_str(db); if (check_access(thd,DROP_ACL,db,0,1) || end_active_trans(thd)) break; mysql_log.write(thd,command,db); @@ -1944,8 +1945,6 @@ mysql_execute_command(void) net_printf(&thd->net,ER_WRONG_DB_NAME, lex->name); break; } - if (lower_case_table_names) - casedn_str(lex->name); if (check_access(thd,CREATE_ACL,lex->name,0,1)) break; mysql_create_db(thd,lex->name,lex->create_info.options); @@ -1958,8 +1957,6 @@ mysql_execute_command(void) net_printf(&thd->net,ER_WRONG_DB_NAME, lex->name); break; } - if (lower_case_table_names) - casedn_str(lex->name); if (check_access(thd,DROP_ACL,lex->name,0,1) || end_active_trans(thd)) break; @@ -2773,11 +2770,7 @@ TABLE_LIST *add_table_to_list(Table_ident *table, LEX_STRING *alias, if (!(alias_str=sql_strmake(alias_str,table->table.length))) DBUG_RETURN(0); if (lower_case_table_names) - { casedn_str(table->table.str); - if (table->db.str) - casedn_str(table->db.str); - } if (!(ptr = (TABLE_LIST *) thd->calloc(sizeof(TABLE_LIST)))) DBUG_RETURN(0); /* purecov: inspected */ ptr->db= table->db.str; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index a6285cfacd0..729e1557cdc 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -307,6 +307,8 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild) net_store_data(packet,file_name); table_list.db=(char*) db; table_list.real_name= table_list.alias= file_name; + if (lower_case_table_names) + casedn_str(file_name); if (!(table = open_ltable(thd, &table_list, TL_READ))) { for (uint i=0 ; i < field_list.elements ; i++) diff --git a/sql/table.cc b/sql/table.cc index e0f5edbf262..3afadec3801 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1045,9 +1045,29 @@ char *get_field(MEM_ROOT *mem, TABLE *table, uint fieldnr) return to; } -bool check_db_name(const char *name) + +/* + Check if database name is valid + + SYNPOSIS + check_db_name() + name Name of database + + NOTES + If lower_case_table_names is set then database is converted to lower case + + RETURN + 0 ok + 1 error +*/ + +bool check_db_name(char *name) { - const char *start=name; + char *start=name; + + if (lower_case_table_names) + casedn_str(name); + while (*name) { #if defined(USE_MB) && defined(USE_MB_IDENT) -- cgit v1.2.1 From b025fa8b328ad247ad84c461392002aef04064d4 Mon Sep 17 00:00:00 2001 From: "monty@mashka.mysql.fi" <> Date: Wed, 29 Jan 2003 19:10:33 +0200 Subject: Fixed compilation error on windows --- sql/mysqld.cc | 15 +++++++-------- sql/sql_table.cc | 48 +++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 50 insertions(+), 13 deletions(-) (limited to 'sql') diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 416a5eeb76f..81aeec05e4d 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1382,8 +1382,10 @@ static void init_signals(void) } static void start_signal_handler(void) -{ -} +{} + +static void check_data_home(const char *path) +{} #elif defined(__NETWARE__) @@ -1500,12 +1502,10 @@ static void init_signals(void) } static void start_signal_handler(void) -{ -} +{} static void check_data_home(const char *path) -{ -} +{} #else /* if ! __WIN__ && ! __EMX__ */ @@ -1830,8 +1830,7 @@ extern "C" void *signal_hand(void *arg __attribute__((unused))) } static void check_data_home(const char *path) -{ -} +{} #endif /* __WIN__*/ diff --git a/sql/sql_table.cc b/sql/sql_table.cc index a4ba3617e67..e8857a7faeb 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -40,11 +40,28 @@ static int copy_data_between_tables(TABLE *from,TABLE *to, ORDER *order, ha_rows *copied,ha_rows *deleted); -/***************************************************************************** -** Remove all possbile tables and give a compact errormessage for all -** wrong tables. -** This will wait for all users to free the table before dropping it -*****************************************************************************/ +/* + delete (drop) tables. + + SYNOPSIS + mysql_rm_table() + thd Thread handle + tables List of tables to delete + if_exists If 1, don't give error if one table doesn't exists + + NOTES + Will delete all tables that can be deleted and give a compact error + messages for tables that could not be deleted. + If a table is in use, we will wait for all users to free the table + before dropping it + + Wait if global_read_lock (FLUSH TABLES WITH READ LOCK) is set. + + RETURN + 0 ok. In this case ok packet is sent to user + -1 Error (Error message given but not sent to user) + +*/ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists) { @@ -89,6 +106,26 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists) DBUG_RETURN(0); } + +/* + delete (drop) tables. + + SYNOPSIS + mysql_rm_table_part2_with_lock() + thd Thread handle + tables List of tables to delete + if_exists If 1, don't give error if one table doesn't exists + dont_log_query Don't write query to log files + + NOTES + Works like documented in mysql_rm_table(), but don't check + global_read_lock and don't send_ok packet to server. + + RETURN + 0 ok + 1 error +*/ + int mysql_rm_table_part2_with_lock(THD *thd, TABLE_LIST *tables, bool if_exists, bool dont_log_query) @@ -110,6 +147,7 @@ int mysql_rm_table_part2_with_lock(THD *thd, return error; } + /* TODO: When logging to the binary log, we should log -- cgit v1.2.1 From a9ee051a4de06a237be12ab5d25c167f2b0e299a Mon Sep 17 00:00:00 2001 From: "monty@mashka.mysql.fi" <> Date: Sun, 2 Feb 2003 05:13:09 +0200 Subject: Fixed core dump bug in 'mysql' when using \p in prompt on Windows. Fixed error when mysql_unix_port pointed to const string (not uncommon on windows) --- sql/mysqld.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sql') diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 81aeec05e4d..c26b450cbfe 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2371,9 +2371,9 @@ The server will not act as a slave."); sql_print_error("Warning: Can't create thread to manage maintenance"); } - if (unix_sock == INVALID_SOCKET) - mysql_unix_port[0]= 0; - printf(ER(ER_READY),my_progname,server_version, mysql_unix_port, mysql_port); + printf(ER(ER_READY),my_progname,server_version, + ((unix_sock == INVALID_SOCKET) ? (char*) "" : mysql_unix_port), + mysql_port); fflush(stdout); #ifdef __NT__ -- cgit v1.2.1 From e3cd63521cd68743393b35c0056faf3e9388ca1c Mon Sep 17 00:00:00 2001 From: "monty@mashka.mysql.fi" <> Date: Mon, 3 Feb 2003 20:20:32 +0200 Subject: Fix for MIN/MAX with empty tables MIN(key_column) could in some cases return NULL on a column with NULL and other values. MIN(key_column) and MAX(key_column) could in some cases return wrong values when used in OUTER JOIN. --- sql/item.h | 1 + sql/item_sum.h | 2 ++ sql/opt_sum.cc | 92 ++++++++++++++++++++++++++++++++++++++++--------------- sql/sql_select.cc | 6 ++++ 4 files changed, 76 insertions(+), 25 deletions(-) (limited to 'sql') diff --git a/sql/item.h b/sql/item.h index b690807691f..c669c266f0f 100644 --- a/sql/item.h +++ b/sql/item.h @@ -89,6 +89,7 @@ public: virtual void set_result_field(Field *field) {} virtual bool is_result_field() { return 0; } virtual void save_in_result_field(bool no_conversions) {} + virtual void no_rows_in_result() {} }; diff --git a/sql/item_sum.h b/sql/item_sum.h index 2cf92343ebb..04f95dfd778 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -69,6 +69,7 @@ public: void make_field(Send_field *field); void print(String *str); void fix_num_length_and_dec(); + void no_rows_in_result() { reset(); } virtual bool setup(THD *thd) {return 0;} unsigned int size_of() { return sizeof(*this);} }; @@ -135,6 +136,7 @@ class Item_sum_count :public Item_sum_int bool const_item() const { return !used_table_cache; } enum Sumfunctype sum_func () const { return COUNT_FUNC; } void reset(); + void no_rows_in_result() { count=0; } bool add(); void make_const(longlong count_arg) { count=count_arg; used_table_cache=0; } longlong val_int(); diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index ecfa97586e9..d5a4149f243 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB +/* Copyright (C) 2000-2003 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,28 +22,55 @@ static bool find_range_key(TABLE_REF *ref, Field* field,COND *cond); -/***************************************************************************** -** This function is only called for queries with sum functions and no -** GROUP BY part. -** This substitutes constants for some COUNT(), MIN() and MAX() functions. -** The function returns 1 if all items was resolved and -1 on impossible -** conditions -****************************************************************************/ +/* + Substitutes constants for some COUNT(), MIN() and MAX() functions. + + SYNOPSIS + opt_sum_query() + tables Tables in query + all_fields All fields to be returned + conds WHERE clause + + NOTE: + This function is only called for queries with sum functions and no + GROUP BY part. + + RETURN VALUES + 0 No errors + 1 if all items was resolved + -1 on impossible conditions +*/ int opt_sum_query(TABLE_LIST *tables, List &all_fields,COND *conds) { List_iterator_fast it(all_fields); - int const_result=1; - bool recalc_const_item=0; - table_map removed_tables=0; + int const_result= 1; + bool recalc_const_item= 0; + table_map removed_tables= 0, outer_tables= 0, used_tables= 0; + table_map where_tables= 0; Item *item; COND *org_conds= conds; - /* Add all ON conditions to WHERE condition */ + if (conds) + where_tables= conds->used_tables(); + + /* Don't replace expression on a table that is part of an outer join */ for (TABLE_LIST *tl=tables; tl ; tl= tl->next) { if (tl->on_expr) - conds= and_expressions(conds, tl->on_expr, &org_conds); + { + outer_tables|= tl->table->map; + + /* + We can't optimise LEFT JOIN in cases where the WHERE condition + restricts the table that is used, like in: + SELECT MAX(t1.a) FROM t1 LEFT JOIN t2 join-condition + WHERE t2.field IS NULL; + */ + if (tl->table->map & where_tables) + return 0; + } + used_tables|= tl->table->map; } /* @@ -68,8 +95,8 @@ int opt_sum_query(TABLE_LIST *tables, List &all_fields,COND *conds) TABLE_LIST *table; for (table=tables; table ; table=table->next) { - if (table->on_expr || (table->table->file->table_flags() & - HA_NOT_EXACT_COUNT)) + if (outer_tables || (table->table->file->table_flags() & + HA_NOT_EXACT_COUNT)) { const_result=0; // Can't optimize left join break; @@ -99,21 +126,35 @@ int opt_sum_query(TABLE_LIST *tables, List &all_fields,COND *conds) byte key_buff[MAX_KEY_LENGTH]; TABLE_REF ref; ref.key_buff=key_buff; + Item_field *item_field= ((Item_field*) expr); + TABLE *table= item_field->field->table; - if (!find_range_key(&ref, ((Item_field*) expr)->field,conds)) + if ((outer_tables & table->map) || + (!find_range_key(&ref, item_field->field,conds))) { const_result=0; break; } - TABLE *table=((Item_field*) expr)->field->table; - bool error=table->file->index_init((uint) ref.key); + bool error= table->file->index_init((uint) ref.key); + enum ha_rkey_function find_flag= HA_READ_KEY_OR_NEXT; + uint prefix_len= ref.key_length; + /* + If we are doing MIN() on a column with NULL fields + we must read the key after the NULL column + */ + if (item_field->field->null_bit) + { + ref.key_buff[ref.key_length++]=1; + find_flag= HA_READ_AFTER_KEY; + } + if (!ref.key_length) error=table->file->index_first(table->record[0]) !=0; else error=table->file->index_read(table->record[0],key_buff, ref.key_length, - HA_READ_KEY_OR_NEXT) || - key_cmp(table, key_buff, ref.key, ref.key_length); + find_flag) || + key_cmp(table, key_buff, ref.key, prefix_len); if (table->key_read) { table->key_read=0; @@ -121,7 +162,7 @@ int opt_sum_query(TABLE_LIST *tables, List &all_fields,COND *conds) } table->file->index_end(); if (error) - return -1; // Impossible query + return -1; // No rows matching where removed_tables|= table->map; } else if (!expr->const_item()) // This is VERY seldom false @@ -147,13 +188,14 @@ int opt_sum_query(TABLE_LIST *tables, List &all_fields,COND *conds) byte key_buff[MAX_KEY_LENGTH]; TABLE_REF ref; ref.key_buff=key_buff; + TABLE *table=((Item_field*) expr)->field->table; - if (!find_range_key(&ref, ((Item_field*) expr)->field,conds)) + if ((outer_tables & table->map) || + !find_range_key(&ref, ((Item_field*) expr)->field,conds)) { const_result=0; break; } - TABLE *table=((Item_field*) expr)->field->table; if ((table->file->table_flags() & HA_NOT_READ_AFTER_KEY)) { const_result=0; @@ -203,8 +245,8 @@ int opt_sum_query(TABLE_LIST *tables, List &all_fields,COND *conds) const_result=0; } } - if (conds && (conds->used_tables() & ~ removed_tables)) - const_result=0; + if (used_tables != removed_tables) + const_result=0; // We didn't remove all tables return const_result; } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 6996bba8798..be5e5be7cb7 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3104,7 +3104,13 @@ return_zero_rows(JOIN *join, select_result *result,TABLE_LIST *tables, if (!(result->send_fields(fields,1))) { if (send_row) + { + List_iterator_fast it(fields); + Item *item; + while ((item= it++)) + item->no_rows_in_result(); result->send_data(fields); + } if (tables) // Not from do_select() { /* Close open cursors */ -- cgit v1.2.1 From 59400e211f2e23a9d19948585da00007248862df Mon Sep 17 00:00:00 2001 From: "monty@mashka.mysql.fi" <> Date: Tue, 4 Feb 2003 01:05:39 +0200 Subject: Fixed bug in ulonglong parsing for constructs that only takes unsigned longlong as parameter. --- sql/sql_yacc.yy | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sql') diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index f09aac1b357..d94118ebfc6 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2376,6 +2376,7 @@ delete_limit_clause: ULONG_NUM: NUM { $$= strtoul($1.str,NULL,10); } + | LONG_NUM { $$= (ulonglong) strtoll($1.str,NULL,10); } | ULONGLONG_NUM { $$= (ulong) strtoull($1.str,NULL,10); } | REAL_NUM { $$= strtoul($1.str,NULL,10); } | FLOAT_NUM { $$= strtoul($1.str,NULL,10); }; @@ -2383,7 +2384,7 @@ ULONG_NUM: ulonglong_num: NUM { $$= (ulonglong) strtoul($1.str,NULL,10); } | ULONGLONG_NUM { $$= strtoull($1.str,NULL,10); } - | LONG_NUM { $$= (ulonglong) strtoul($1.str,NULL,10); } + | LONG_NUM { $$= (ulonglong) strtoll($1.str,NULL,10); } | REAL_NUM { $$= strtoull($1.str,NULL,10); } | FLOAT_NUM { $$= strtoull($1.str,NULL,10); }; @@ -3110,8 +3111,8 @@ text_string: literal: text_literal { $$ = $1; } - | NUM { $$ = new Item_int($1.str, (longlong) atol($1.str),$1.length); } - | LONG_NUM { $$ = new Item_int($1.str); } + | NUM { $$ = new Item_int($1.str, (longlong) strtol($1.str, NULL, 10),$1.length); } + | LONG_NUM { $$ = new Item_int($1.str, (longlong) strtoll($1.str,NULL,10), $1.length); } | ULONGLONG_NUM { $$ = new Item_uint($1.str, $1.length); } | REAL_NUM { $$ = new Item_real($1.str, $1.length); } | FLOAT_NUM { $$ = new Item_float($1.str, $1.length); } -- cgit v1.2.1