List:Internals« Previous MessageNext Message »
From:Krunal Bauskar Date:April 3 2008 6:10am
Subject:Inconsistent store implementation for field_year. (one checks >= 2155.0 other checks > 2155)
View as plain text  
Hi,

For datatype YEAR:

In field.cc: 5161, year value 2155 is considered invalid:

int Field_year::store(double nr)
{
  if (nr < 0.0 || nr >= 2155.0)
  {
    (void) Field_year::store((longlong) -1, FALSE);
    return 1;
  }
  return Field_year::store((longlong) nr, FALSE);
}


But in field.cc:5172, year value 2155 is valid:

int Field_year::store(longlong nr, bool unsigned_val)
{
  ASSERT_COLUMN_MARKED_FOR_WRITE;
  if (nr < 0 || nr >= 100 && nr <= 1900 || nr > 2155)
  {
    *ptr= 0;
    set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
    return 1;
  }
  ...
}

How come different store functions have different behavior?


Regards,
Krunal
Thread
Inconsistent store implementation for field_year. (one checks >= 2155.0 other checks > 2155)Krunal Bauskar3 Apr 2008
  • re: Inconsistent store implementation for field_year. (one checks >=2155.0 other checks > 2155)Michael Widenius5 May 2008