Commit ed040fe2 authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi
Browse files

Fix for bug in WHERE key='j' or key='J'

parent 82d87ebd
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -46897,6 +46897,8 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.50
@itemize @bullet
@item
Fixed bug when using @code{WHERE key_column = 'J' or key_column='j'}.
@item
Fixed core-dump bug when using @code{--log-bin} with @code{LOAD DATA
INFILE} without an active database.
@item
@@ -46934,7 +46936,7 @@ Don't give warning for statement that is only a comment; This is needed for
@code{mysqldump --disable-keys} to work.
@item
Fixed unlikely caching bug when doing a join without keys. In this case
the last used field for a table always returned @code{NULL}.
the last used column for a table always returned @code{NULL}.
@item
Added options to make @code{LOAD DATA LOCAL INFILE} more secure.
@item
+5 −12
Original line number Diff line number Diff line
@@ -251,7 +251,7 @@ static struct option long_options[] =

static void print_version(void)
{
  printf("%s  Ver 1.11 for %s on %s\n",my_progname,SYSTEM_TYPE,MACHINE_TYPE);
  printf("%s  Ver 1.12 for %s on %s\n",my_progname,SYSTEM_TYPE,MACHINE_TYPE);
}

static void usage(void)
@@ -594,10 +594,7 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table)
	else
	{
	  if (tmp_dir[0])
	  {
	    if (!(error=my_copy(new_name,org_name,MYF(MY_WME))))
	      VOID(my_delete(new_name,MYF(MY_WME)));
	  }
	    error=my_copy(new_name,org_name,MYF(MY_WME));
	  else
	    error=my_rename(new_name,org_name,MYF(MY_WME));
	  if (!error)
@@ -607,13 +604,8 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table)
      else
      {
	if (tmp_dir[0])
	{

	  if (!(error=my_copy(new_name,org_name,
			      MYF(MY_WME | MY_HOLD_ORIGINAL_MODES
				  | MY_COPYTIME))))
	    VOID(my_delete(new_name,MYF(MY_WME)));
	}
	  error=my_copy(new_name,org_name,
			MYF(MY_WME | MY_HOLD_ORIGINAL_MODES | MY_COPYTIME));
	else
	  error=my_redel(org_name,new_name,MYF(MY_WME | MY_COPYTIME));
      }
@@ -627,6 +619,7 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table)
  if (error)
  {
    VOID(fprintf(stderr,"Aborting: %s is not compressed\n",org_name));
    VOID(my_delete(new_name,MYF(MY_WME)));
    DBUG_RETURN(-1);
  }
  if (write_loop || verbose)
+10 −0
Original line number Diff line number Diff line
@@ -55,3 +55,13 @@ believe
believe in love
aString
believe in myself
count(*)
602
count(*)
602
count(*)
602
count(*)
389
count(*)
213
+2 −1
Original line number Diff line number Diff line
@@ -105,7 +105,6 @@ drop table t1;
# Problem with binary strings
#

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
  t1ID int(10) unsigned NOT NULL auto_increment,
  art char(1) binary NOT NULL default '',
@@ -161,4 +160,6 @@ INSERT INTO t1 (art) VALUES ('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'
select count(*) from t1 where upper(art) = 'J';
select count(*) from t1 where art = 'J' or art = 'j';
select count(*) from t1 where art = 'j' or art = 'J';
select count(*) from t1 where art = 'j';
select count(*) from t1 where art = 'J';
drop table t1;
+20 −3
Original line number Diff line number Diff line
@@ -59,12 +59,28 @@ void Item::set_name(char *str,uint length)
  }
}

bool Item::eq(const Item *item) const		// Only doing this on conds
/*
  This function is only called when comparing items in the WHERE clause
*/

bool Item::eq(const Item *item, bool binary_cmp) const
{
  return type() == item->type() && name && item->name &&
    !my_strcasecmp(name,item->name);
}

bool Item_string::eq(const Item *item, bool binary_cmp) const
{
  if (type() == item->type())
  {
    if (binary_cmp)
      return !stringcmp(&str_value, &item->str_value);
    return !sortcmp(&str_value, &item->str_value);
  }
  return 0;
}


/*
  Get the value of the function as a TIME structure.
  As a extra convenience the time structure is reset on error!
@@ -202,7 +218,7 @@ longlong Item_field::val_int_result()
  return result_field->val_int();
}

bool Item_field::eq(const Item *item) const
bool Item_field::eq(const Item *item, bool binary_cmp) const
{
  return item->type() == FIELD_ITEM && ((Item_field*) item)->field == field;
}
@@ -245,7 +261,8 @@ void Item_string::print(String *str)
  str->append('\'');
}

bool Item_null::eq(const Item *item) const { return item->type() == type(); }
bool Item_null::eq(const Item *item, bool binary_cmp) const
{ return item->type() == type(); }
double Item_null::val() { null_value=1; return 0.0; }
longlong Item_null::val_int() { null_value=1; return 0; }
/* ARGSUSED */
Loading