From b7e4463dacb38d73492b3b039daf335a7fb0f76d Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 23 Aug 2004 15:29:55 +0200 Subject: Fixed: BUG#5135: cannot turn on log_warnings with SET in 4.1 (and 4.0) mysql-test/r/variables.result: Test case for BUG#5135, check that setting log_warnings actually works. mysql-test/t/variables.test: Test case for BUG#5135, check that setting log_warnings actually works. sql/mysqld.cc: Set a max value for log_warnings, so se can set it to something other than 0. --- mysql-test/r/variables.result | 16 ++++++++++++++++ mysql-test/t/variables.test | 10 ++++++++++ sql/mysqld.cc | 4 ++-- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index e36f4165f46..13d09e09783 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -381,3 +381,19 @@ set global myisam_max_sort_file_size=4294967296; show global variables like 'myisam_max_sort_file_size'; Variable_name Value myisam_max_sort_file_size MAX_FILE_SIZE +set @tstlw = @@log_warnings; +show global variables like 'log_warnings'; +Variable_name Value +log_warnings 1 +set global log_warnings = 0; +show global variables like 'log_warnings'; +Variable_name Value +log_warnings 0 +set global log_warnings = 42; +show global variables like 'log_warnings'; +Variable_name Value +log_warnings 42 +set global log_warnings = @tstlw; +show global variables like 'log_warnings'; +Variable_name Value +log_warnings 1 diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index b9aa52ec627..03e4778d9d6 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -276,3 +276,13 @@ select @@session.key_buffer_size; set global myisam_max_sort_file_size=4294967296; --replace_result 4294967296 MAX_FILE_SIZE 2146435072 MAX_FILE_SIZE show global variables like 'myisam_max_sort_file_size'; + +# BUG#5135: cannot turn on log_warnings with SET in 4.1 (and 4.0) +set @tstlw = @@log_warnings; +show global variables like 'log_warnings'; +set global log_warnings = 0; +show global variables like 'log_warnings'; +set global log_warnings = 42; +show global variables like 'log_warnings'; +set global log_warnings = @tstlw; +show global variables like 'log_warnings'; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index e4d60fc9e7c..e20251adac4 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3959,11 +3959,11 @@ replicating a LOAD DATA INFILE command", 0, 0, 0, 0}, {"log-warnings", 'W', "Log some not critical warnings to the log file", (gptr*) &global_system_variables.log_warnings, - (gptr*) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, 0, + (gptr*) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, ~0L, 0, 0, 0}, {"warnings", 'W', "Deprecated ; Use --log-warnings instead", (gptr*) &global_system_variables.log_warnings, - (gptr*) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, 0, + (gptr*) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, ~0L, 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.", -- cgit v1.2.1 From e9c25d9336c8d1266254df5f795366e7d280de85 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 23 Aug 2004 16:15:57 +0200 Subject: Fix for BUG#5033 "When using temporary tables truncate does NOT reset the auto_increment counter" (ok'd by CTO to fix it in 4.0). Fix to make mysql-test-run work with all Valgrind versions. mysql-test/mysql-test-run.sh: fixing mysql-test-run.sh so that it works indifferently with Valgrind 1.x, 2.x (versions <= 2.0.0 refuse --tool option; versions >=2.1.2 require it; 2.1.0 accepts it). I hope the shell code is portable enough; anyway Valgrind only runs on Linux... I tested it with 2.0.0, 2.1.0, 2.1.2. mysql-test/r/truncate.result: result update mysql-test/t/truncate.test: testing if TRUNCATE resets autoinc counter for temp tables (BUG#5033); testing difference with DELETE FROM. sql/sql_delete.cc: in mysql_truncate(), always reset the autoinc counter, as manual says (even if it's a temp table, which was BUG#5033). --- mysql-test/mysql-test-run.sh | 4 +++- mysql-test/r/truncate.result | 21 +++++++++++++++++++++ mysql-test/t/truncate.test | 16 +++++++++++++++- sql/sql_delete.cc | 5 +---- 4 files changed, 40 insertions(+), 6 deletions(-) diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index cd6c331687f..d47560fe7a6 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -349,9 +349,11 @@ while test $# -gt 0; do VALGRIND=`which valgrind` # this will print an error if not found # Give good warning to the user and stop if [ -z "$VALGRIND" ] ; then - $ECHO "You need to have the 'valgrind' program in your PATH to run mysql-test-run with option --valgrind. Valgrind's home page is http://developer.kde.org/~sewardj ." + $ECHO "You need to have the 'valgrind' program in your PATH to run mysql-test-run with option --valgrind. Valgrind's home page is http://valgrind.kde.org ." exit 1 fi + # >=2.1.2 requires the --tool option, some versions write to stdout, some to stderr + valgrind --help 2>&1 | grep "\-\-tool" > /dev/null && VALGRIND="$VALGRIND --tool=memcheck" VALGRIND="$VALGRIND --alignment=8 --leak-check=yes --num-callers=16" EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-safemalloc --skip-bdb" EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc --skip-bdb" diff --git a/mysql-test/r/truncate.result b/mysql-test/r/truncate.result index 1b387214292..fef15533738 100644 --- a/mysql-test/r/truncate.result +++ b/mysql-test/r/truncate.result @@ -31,4 +31,25 @@ SELECT * from t1; a 1 2 +delete from t1; +insert into t1 (a) values (NULL),(NULL); +SELECT * from t1; +a +3 +4 +drop table t1; +create temporary table t1 (a integer auto_increment primary key); +insert into t1 (a) values (NULL),(NULL); +truncate table t1; +insert into t1 (a) values (NULL),(NULL); +SELECT * from t1; +a +1 +2 +delete from t1; +insert into t1 (a) values (NULL),(NULL); +SELECT * from t1; +a +3 +4 drop table t1; diff --git a/mysql-test/t/truncate.test b/mysql-test/t/truncate.test index 3acab9f56de..f92e92fbc97 100644 --- a/mysql-test/t/truncate.test +++ b/mysql-test/t/truncate.test @@ -23,7 +23,7 @@ drop table t1; truncate non_existing_table; # -# test autoincrement with TRUNCATE +# test autoincrement with TRUNCATE; verifying difference with DELETE # create table t1 (a integer auto_increment primary key); @@ -31,5 +31,19 @@ insert into t1 (a) values (NULL),(NULL); truncate table t1; insert into t1 (a) values (NULL),(NULL); SELECT * from t1; +delete from t1; +insert into t1 (a) values (NULL),(NULL); +SELECT * from t1; drop table t1; +# Verifying that temp tables are handled the same way + +create temporary table t1 (a integer auto_increment primary key); +insert into t1 (a) values (NULL),(NULL); +truncate table t1; +insert into t1 (a) values (NULL),(NULL); +SELECT * from t1; +delete from t1; +insert into t1 (a) values (NULL),(NULL); +SELECT * from t1; +drop table t1; diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index b568166a766..555e63b9e32 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -545,15 +545,13 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok) int error; DBUG_ENTER("mysql_truncate"); + bzero((char*) &create_info,sizeof(create_info)); /* If it is a temporary table, close and regenerate it */ if (!dont_send_ok && (table_ptr=find_temporary_table(thd,table_list->db, table_list->real_name))) { TABLE *table= *table_ptr; - HA_CREATE_INFO create_info; table->file->info(HA_STATUS_AUTO | HA_STATUS_NO_LOCK); - bzero((char*) &create_info,sizeof(create_info)); - create_info.auto_increment_value= table->file->auto_increment_value; db_type table_type=table->db_type; strmov(path,table->path); @@ -596,7 +594,6 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok) DBUG_RETURN(-1); } - bzero((char*) &create_info,sizeof(create_info)); *fn_ext(path)=0; // Remove the .frm extension error= ha_create_table(path,&create_info,1) ? -1 : 0; query_cache_invalidate3(thd, table_list, 0); -- cgit v1.2.1 From 6d9046c6e7cbb691eb3a9e96003b9fcff6be7e28 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 23 Aug 2004 19:13:47 +0400 Subject: Fix for bug #5134: WHERE x = 'bar' AND x LIKE BINARY 'bar' returns wrong results --- mysql-test/r/binary.result | 18 ++++++++++++++++++ mysql-test/t/binary.test | 13 +++++++++++++ sql/sql_select.cc | 10 ++++++++-- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/binary.result b/mysql-test/r/binary.result index 2de8b01bc3a..054918e8df3 100644 --- a/mysql-test/r/binary.result +++ b/mysql-test/r/binary.result @@ -80,3 +80,21 @@ NULL select b from t1 having binary b like ''; b drop table t1; +create table t1( firstname char(20), lastname char(20)); +insert into t1 values ("john","doe"),("John","Doe"); +select * from t1 where firstname='john' and firstname like binary 'john'; +firstname lastname +john doe +select * from t1 where firstname='john' and binary 'john' = firstname; +firstname lastname +john doe +select * from t1 where firstname='john' and firstname = binary 'john'; +firstname lastname +john doe +select * from t1 where firstname='John' and firstname like binary 'john'; +firstname lastname +john doe +select * from t1 where firstname='john' and firstname like binary 'John'; +firstname lastname +John Doe +drop table t1; diff --git a/mysql-test/t/binary.test b/mysql-test/t/binary.test index 95815cda60f..a8c724bf33b 100644 --- a/mysql-test/t/binary.test +++ b/mysql-test/t/binary.test @@ -49,3 +49,16 @@ select b from t1 where binary b like ''; select b from t1 group by binary b like ''; select b from t1 having binary b like ''; drop table t1; + +# +# Bug5134: WHERE x = 'bar' AND x LIKE BINARY 'bar' returns wrong results +# + +create table t1( firstname char(20), lastname char(20)); +insert into t1 values ("john","doe"),("John","Doe"); +select * from t1 where firstname='john' and firstname like binary 'john'; +select * from t1 where firstname='john' and binary 'john' = firstname; +select * from t1 where firstname='john' and firstname = binary 'john'; +select * from t1 where firstname='John' and firstname like binary 'john'; +select * from t1 where firstname='john' and firstname like binary 'John'; +drop table t1; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 882f345a1ca..cf5e8a75f85 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3371,7 +3371,10 @@ change_cond_ref_to_const(I_List *save_list,Item *and_father, Item *right_item= func->arguments()[1]; Item_func::Functype functype= func->functype(); - if (right_item->eq(field,0) && left_item != value) + if (right_item->eq(field,0) && left_item != value && + (left_item->result_type() != STRING_RESULT || + value->result_type() != STRING_RESULT || + left_item->binary == value->binary)) { Item *tmp=value->new_item(); if (tmp) @@ -3390,7 +3393,10 @@ change_cond_ref_to_const(I_List *save_list,Item *and_father, func->arguments()[1]->result_type())); } } - else if (left_item->eq(field,0) && right_item != value) + else if (left_item->eq(field,0) && right_item != value && + (right_item->result_type() != STRING_RESULT || + value->result_type() != STRING_RESULT || + right_item->binary == value->binary)) { Item *tmp=value->new_item(); if (tmp) -- cgit v1.2.1 From 8b11e715bb4128e9b0fc31f3390f9d96189c4ff0 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 Aug 2004 13:51:28 +0200 Subject: - make sure to recreate all autoconf/automake-related files after modifying configure.in for the commercial tarballs - added my-innodb-heavy-4G.cnf to the distribution Build-tools/mysql-copyright: - make sure to recreate all autoconf/automake-related files after modifying configure.in support-files/Makefile.am: - added my-innodb-heavy-4G.cnf to the distribution --- Build-tools/mysql-copyright | 2 +- support-files/Makefile.am | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Build-tools/mysql-copyright b/Build-tools/mysql-copyright index 84e13d6041e..ad4547b493c 100755 --- a/Build-tools/mysql-copyright +++ b/Build-tools/mysql-copyright @@ -120,7 +120,7 @@ sub main open(CONFIGURE,">configure.in") or die "$! Unable to open configure.in to write to!\n"; print CONFIGURE $configure; close(CONFIGURE); - `autoconf`; + `aclocal && autoheader && aclocal && automake && autoconf`; if (! -f "configure") { print "\"./configure\" was not produced, exiting!\n"; exit(0); diff --git a/support-files/Makefile.am b/support-files/Makefile.am index 79ba6eec763..ddad52fbb2a 100644 --- a/support-files/Makefile.am +++ b/support-files/Makefile.am @@ -22,6 +22,7 @@ EXTRA_DIST = mysql.spec.sh \ my-medium.cnf.sh \ my-large.cnf.sh \ my-huge.cnf.sh \ + my-innodb-heavy-4G \ mysql-log-rotate.sh \ mysql.server.sh \ binary-configure.sh \ @@ -34,6 +35,7 @@ pkgdata_DATA = my-small.cnf \ my-medium.cnf \ my-large.cnf \ my-huge.cnf \ + my-innodb-heavy-4G.cnf \ mysql-log-rotate \ mysql-@VERSION@.spec \ binary-configure \ @@ -45,6 +47,7 @@ CLEANFILES = my-small.cnf \ my-medium.cnf \ my-large.cnf \ my-huge.cnf \ + my-innodb-heavy-4G.cnf \ mysql.spec \ mysql-@VERSION@.spec \ mysql-log-rotate \ -- cgit v1.2.1 From b758a6d142a3c2a96c6744c9cf28e444180caa19 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 Aug 2004 17:29:08 +0400 Subject: Fix for bug #4340: find_in_set is case insensitive even on binary operators(2nd version) mysql-test/r/func_set.result: Fix for bug #4340: find_in_set is case insensitive even on binary operators mysql-test/t/func_set.test: Fix for bug #4340: find_in_set is case insensitive even on binary operators sql/item_func.cc: Fix for bug #4340: find_in_set is case insensitive even on binary operators --- mysql-test/r/func_set.result | 9 +++++++++ mysql-test/t/func_set.test | 8 ++++++++ sql/item_func.cc | 24 +++++++++++++++++++----- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/func_set.result b/mysql-test/r/func_set.result index eeeb216d142..9181fe9e54d 100644 --- a/mysql-test/r/func_set.result +++ b/mysql-test/r/func_set.result @@ -28,3 +28,12 @@ find_in_set("abc","abc") find_in_set("ab","abc") find_in_set("abcd","abc") select interval(null, 1, 10, 100); interval(null, 1, 10, 100) -1 +select find_in_set(binary 'a',binary 'A,B,C'); +find_in_set(binary 'a',binary 'A,B,C') +0 +select find_in_set('a',binary 'A,B,C'); +find_in_set('a',binary 'A,B,C') +0 +select find_in_set(binary 'a', 'A,B,C'); +find_in_set(binary 'a', 'A,B,C') +0 diff --git a/mysql-test/t/func_set.test b/mysql-test/t/func_set.test index 81f561989d5..a1ee293ae05 100644 --- a/mysql-test/t/func_set.test +++ b/mysql-test/t/func_set.test @@ -16,3 +16,11 @@ select elt(2,1),field(NULL,"a","b","c"); select find_in_set("","a,b,c"),find_in_set("","a,b,c,"),find_in_set("",",a,b,c"); select find_in_set("abc","abc"),find_in_set("ab","abc"),find_in_set("abcd","abc"); select interval(null, 1, 10, 100); + +# +# Bug4340: find_in_set is case insensitive even on binary operators +# + +select find_in_set(binary 'a',binary 'A,B,C'); +select find_in_set('a',binary 'A,B,C'); +select find_in_set(binary 'a', 'A,B,C'); diff --git a/sql/item_func.cc b/sql/item_func.cc index 237db890abb..334be48dc9a 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1071,6 +1071,7 @@ static const char separator=','; longlong Item_func_find_in_set::val_int() { + bool binary_cmp= args[0]->binary || args[1]->binary; if (enum_value) { ulonglong tmp=(ulonglong) args[1]->val_int(); @@ -1103,12 +1104,25 @@ longlong Item_func_find_in_set::val_int() do { const char *pos= f_pos; - while (pos != f_end) + if (binary_cmp) { - if (toupper(*str) != toupper(*pos)) - goto not_found; - str++; - pos++; + while (pos != f_end) + { + if (*str != *pos) + goto not_found; + str++; + pos++; + } + } + else + { + while (pos != f_end) + { + if (toupper(*str) != toupper(*pos)) + goto not_found; + str++; + pos++; + } } if (str == real_end || str[0] == separator) return (longlong) position; -- cgit v1.2.1 From 9d1a9d72cba1aa828e631f520540411d7508a4e0 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 Aug 2004 10:40:20 -0300 Subject: Fix warning VC++ and fix applied fisrt to source 4.1 mysys/my_lib.c: Same fix for bug #4737 that wrongly I did first on tree 4.1 mysys/my_vsnprintf.c: Fix VC++ warning assuming that my_vsnprintf() is external BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + mysys/my_lib.c | 11 ----------- mysys/my_vsnprintf.c | 20 +++++++++----------- 3 files changed, 10 insertions(+), 22 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index c4d6b93ffcf..d16de3077f3 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -68,6 +68,7 @@ miguel@hegel.(none) miguel@hegel.br miguel@hegel.local miguel@hegel.txg +miguel@hegel.txg.br miguel@light. miguel@light.local miguel@sartre.local diff --git a/mysys/my_lib.c b/mysys/my_lib.c index 0207d9a3683..055e00d2efc 100644 --- a/mysys/my_lib.c +++ b/mysys/my_lib.c @@ -461,17 +461,6 @@ MY_DIR *my_dir(const char *path, myf MyFlags) else finfo.mystat= NULL; - /* - If the directory is the root directory of the drive, Windows sometimes - creates hidden or system files there (like RECYCLER); do not show - them. We would need to see how this can be achieved with a Borland - compiler. - */ -#ifndef __BORLANDC__ - if (attrib & (_A_HIDDEN | _A_SYSTEM)) - continue; -#endif - if (push_dynamic(dir_entries_storage, (gptr)&finfo)) goto error; diff --git a/mysys/my_vsnprintf.c b/mysys/my_vsnprintf.c index 289c21e1ea4..e7cc780060c 100644 --- a/mysys/my_vsnprintf.c +++ b/mysys/my_vsnprintf.c @@ -33,17 +33,6 @@ length of result string */ -int my_snprintf(char* to, size_t n, const char* fmt, ...) -{ - int result; - va_list args; - va_start(args,fmt); - result= my_vsnprintf(to, n, fmt, args); - va_end(args); - return result; -} - - int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) { char *start=to, *end=to+n-1; @@ -140,6 +129,15 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) return (uint) (to - start); } +int my_snprintf(char* to, size_t n, const char* fmt, ...) +{ + int result; + va_list args; + va_start(args,fmt); + result= my_vsnprintf(to, n, fmt, args); + va_end(args); + return result; +} #ifdef MAIN #define OVERRUN_SENTRY 250 -- cgit v1.2.1