From 0ff984fda218d64f29d3d715ed181deb51752b26 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 22 Apr 2002 10:34:46 +0300 Subject: [PATCH] Fixed that IF is case insensitive if 2 and 3 arguments are case insensitive. Added copyright messages to some files that was missing it. Docs/manual.texi: Changelog dbug/Makefile.am: Added missing dbug_analyze.c dbug/monty.doc: Added copyright message mysql-test/t/func_test.test: Moved test of IF to new file sql/item_cmpfunc.cc: Fixed that IF is case insensitive if 2 and 3 arguments are case insensitive. strings/bfill.c: Added copyright message strings/bmove.c: Added copyright message strings/ctype-ujis.c: Added copyright message strings/strend.c: Added copyright message strings/strstr.c: Added copyright message strings/strxmov.c: Added copyright message strings/strxnmov.c: Added copyright message --- Docs/manual.texi | 14 ++++++++++++-- dbug/Makefile.am | 7 ++++--- dbug/monty.doc | 8 ++++++++ mysql-test/t/func_test.test | 11 ----------- sql/item_cmpfunc.cc | 4 ++++ strings/bfill.c | 17 +++++++++++++++++ strings/bmove.c | 17 +++++++++++++++++ strings/ctype-ujis.c | 17 +++++++++++++++++ strings/strend.c | 17 +++++++++++++++++ strings/strstr.c | 17 +++++++++++++++++ strings/strxmov.c | 17 +++++++++++++++++ strings/strxnmov.c | 17 +++++++++++++++++ 12 files changed, 147 insertions(+), 16 deletions(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index a439b17b847..bf5bb1a9d3d 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -29916,6 +29916,9 @@ stored into a temporary table) is calculated in MySQL Version @item expr2 or expr3 returns an integer @tab integer @end multitable +If expr2 and expr3 are strings, then the result is case sensitive if +both strings are case sensitive. (Starting from 3.23.51) + @findex CASE @item CASE value WHEN [compare-value] THEN result [WHEN [compare-value] THEN result ...] [ELSE result] END @item CASE WHEN [condition] THEN result [WHEN [condition] THEN result ...] [ELSE result] END @@ -46854,6 +46857,7 @@ users use this code as the rest of the code and because of this we are not yet 100% confident in this code. @menu +* News-3.23.51:: * News-3.23.50:: Changes in release 3.23.50 * News-3.23.49:: Changes in release 3.23.49 * News-3.23.48:: Changes in release 3.23.48 @@ -46908,9 +46912,15 @@ not yet 100% confident in this code. * News-3.23.0:: Changes in release 3.23.0 @end menu -@node News-3.23.50, News-3.23.49, News-3.23.x, News-3.23.x -@appendixsubsec Changes in release 3.23.50 +@node News-3.23.51, News-3.23.50, News-3.23.x, News-3.23.x +@appendixsubsec Changes in release 3.23.51 +@itemize @bullet +Fixed the result from @code{IF()} is case in-sensitive if the 2 and +third arguments are case sensitive. +@end itemize +@node News-3.23.50, News-3.23.49, News-3.23.51, News-3.23.x +@appendixsubsec Changes in release 3.23.50 @itemize @bullet @item Fixed problem with @code{crash-me} and gcc 3.0.4. diff --git a/dbug/Makefile.am b/dbug/Makefile.am index 7add2fb6583..c789019cc6b 100644 --- a/dbug/Makefile.am +++ b/dbug/Makefile.am @@ -20,8 +20,9 @@ LDADD = libdbug.a ../strings/libmystrings.a pkglib_LIBRARIES = libdbug.a noinst_HEADERS = dbug_long.h libdbug_a_SOURCES = dbug.c sanity.c -EXTRA_DIST = example1.c example2.c example3.c user.r monty.doc readme.prof \ - main.c factorial.c +EXTRA_DIST = example1.c example2.c example3.c \ + user.r monty.doc readme.prof \ + main.c factorial.c dbug_analyze.c OMIT_DEPENDENCIES = pthread.h stdio.h __stdio.h stdlib.h __stdlib.h math.h\ __math.h time.h __time.h unistd.h __unistd.h types.h \ @@ -32,7 +33,7 @@ OMIT_DEPENDENCIES = pthread.h stdio.h __stdio.h stdlib.h __stdlib.h math.h\ sleep.h specific.h version.h pwd.h timers.h uio.h \ cdefs.h machdep.h signal.h __signal.h util.h -# Must be linked with libs thta are not compiled yet +# Must be linked with libs that are not compiled yet extra_progs: factorial dbug_analyze factorial: main.o factorial.o diff --git a/dbug/monty.doc b/dbug/monty.doc index f6d8bdff9cd..1c102e1c31e 100644 --- a/dbug/monty.doc +++ b/dbug/monty.doc @@ -10,3 +10,11 @@ giving a double ':'. (As in "O,c::\tmp\log") DBUG_DUMP("keyword",memory-position,length) writes a hexdump of the given memory-area to the outputfile. + +All changes that I or other people at MySQL AB have done to all files +in the dbug library (Mainly in dbug.c, dbug_analyze.c, dbug_long.h, +dbug.h) are put in public domain, as the rest of the dbug.c library) + +To my knowledge, all code in dbug library are in public domain. + +Michael Widenius diff --git a/mysql-test/t/func_test.test b/mysql-test/t/func_test.test index 0439a96f077..ec44009b1a6 100644 --- a/mysql-test/t/func_test.test +++ b/mysql-test/t/func_test.test @@ -11,7 +11,6 @@ select 'abc' like '%c','abcabc' like '%c', "ab" like "", "ab" like "a", "ab" li select "Det här är svenska" regexp "h[[:alpha:]]+r", "aba" regexp "^(a|b)*$"; select "aba" regexp concat("^","a"); select !0,NOT 0=1,!(0=0),1 AND 1,1 && 0,0 OR 1,1 || NULL, 1=1 or 1=1 and 1=0; -select IF(0,"ERROR","this"),IF(1,"is","ERROR"),IF(NULL,"ERROR","a"),IF(1,2,3)|0,IF(1,2.0,3.0)+0 ; select 2 between 1 and 3, "monty" between "max" and "my",2=2 and "monty" between "max" and "my" and 3=3; select 'b' between 'a' and 'c', 'B' between 'a' and 'c'; select 2 in (3,2,5,9,5,1),"monty" in ("david","monty","allan"), 1.2 in (1.4,1.2,1.0); @@ -24,13 +23,3 @@ select -1.49 or -1.49,0.6 or 0.6; select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1; select 1 and 2 between 2 and 10, 2 between 2 and 10 and 1; select 1 and 0 or 2, 2 or 1 and 0; - -# -# Problem with IF() -# - -drop table if exists t1; -create table t1 (num double(12,2)); -insert into t1 values (144.54); -select sum(if(num is null,0.00,num)) from t1; -drop table t1; diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 373aede7b6b..2b7f4cb6c40 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -490,8 +490,12 @@ Item_func_if::fix_length_and_dec() decimals=max(args[1]->decimals,args[2]->decimals); enum Item_result arg1_type=args[1]->result_type(); enum Item_result arg2_type=args[2]->result_type(); + binary=1; if (arg1_type == STRING_RESULT || arg2_type == STRING_RESULT) + { cached_result_type = STRING_RESULT; + binary=args[1]->binary | args[2]->binary; + } else if (arg1_type == REAL_RESULT || arg2_type == REAL_RESULT) cached_result_type = REAL_RESULT; else diff --git a/strings/bfill.c b/strings/bfill.c index ac5d3096b14..9f5db7201d0 100644 --- a/strings/bfill.c +++ b/strings/bfill.c @@ -1,3 +1,20 @@ +/* Copyright (C) 2002 MySQL AB + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ + /* File : bfill.c Author : Richard A. O'Keefe. Michael Widenius; ifdef MC68000 diff --git a/strings/bmove.c b/strings/bmove.c index f63ff0bd4f8..466bf74db75 100644 --- a/strings/bmove.c +++ b/strings/bmove.c @@ -1,3 +1,20 @@ +/* Copyright (C) 2002 MySQL AB + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ + /* File : bmove.c Author : Richard A. O'Keefe. Michael Widenius; ifdef MC68000 diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c index d994a2e5e96..5356978976f 100644 --- a/strings/ctype-ujis.c +++ b/strings/ctype-ujis.c @@ -1,3 +1,20 @@ +/* Copyright (C) 2002 MySQL AB & tommy@valley.ne.jp. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ + /* This file is for Japanese EUC charset, and created by tommy@valley.ne.jp. */ diff --git a/strings/strend.c b/strings/strend.c index 18b9d1fbd0d..3affb9bd5f6 100644 --- a/strings/strend.c +++ b/strings/strend.c @@ -1,3 +1,20 @@ +/* Copyright (C) 2002 MySQL AB + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ + /* File : strend.c Author : Richard A. O'Keefe. Updated: 23 April 1984 diff --git a/strings/strstr.c b/strings/strstr.c index 572bf88c95c..01b29db0068 100644 --- a/strings/strstr.c +++ b/strings/strstr.c @@ -1,3 +1,20 @@ +/* Copyright (C) 2002 MySQL AB + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ + /* File : strstr.c Author : Monty Updated: 1986.11.24 diff --git a/strings/strxmov.c b/strings/strxmov.c index 7ee1d303ee8..3ef120a691e 100644 --- a/strings/strxmov.c +++ b/strings/strxmov.c @@ -1,3 +1,20 @@ +/* Copyright (C) 2002 MySQL AB + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ + /* File : strxmov.c Author : Richard A. O'Keefe. Updated: 25 may 1984 diff --git a/strings/strxnmov.c b/strings/strxnmov.c index b55a2e0ab79..ec3b6fe71e8 100644 --- a/strings/strxnmov.c +++ b/strings/strxnmov.c @@ -1,3 +1,20 @@ +/* Copyright (C) 2002 MySQL AB + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ + /* File : strxnmov.c Author : Richard A. O'Keefe. Updated: 2 June 1984