• unknown's avatar
    Fix for bugs · 86010101
    unknown authored
    #27176: Assigning a string to an year column has unexpected results
    #26359: Strings becoming truncated and converted to numbers under STRICT mode
    
    Problems: 
    1. storing a string to an integer field we don't check 
       if strntoull10rnd() returns MY_ERRNO_EDOM error.
       Fix: check for MY_ERRNO_EDOM.
    2. storing a string to an year field we use my_strntol() function.
       Fix: use strntoull10rnd() instead.
    
    
    mysql-test/r/strict.result:
      Fix for bugs
      #27176: Assigning a string to an year column has unexpected results
      #26359: Strings becoming truncated and converted to numbers under STRICT mode
        - test result.
    mysql-test/r/type_date.result:
      Fix for bugs
      #27176: Assigning a string to an year column has unexpected results
      #26359: Strings becoming truncated and converted to numbers under STRICT mode
        - test result.
    mysql-test/r/type_year.result:
      Fix for bugs
      #27176: Assigning a string to an year column has unexpected results
      #26359: Strings becoming truncated and converted to numbers under STRICT mode
        - test result.
    mysql-test/t/strict.test:
      Fix for bugs
      #27176: Assigning a string to an year column has unexpected results
      #26359: Strings becoming truncated and converted to numbers under STRICT mode
        - test case.
    mysql-test/t/type_year.test:
      Fix for bugs
      #27176: Assigning a string to an year column has unexpected results
      #26359: Strings becoming truncated and converted to numbers under STRICT mode
    sql/field.cc:
      Fix for bugs
      #27176: Assigning a string to an year column has unexpected results
      #26359: Strings becoming truncated and converted to numbers under STRICT mode
        - Field_num::get_int() method introduced. It converts a string to integer
          then check errors and bounds.
        - similar Field_tiny::store(const char...),  Field_short::store(const char...),
          Field_medium::store(const char...), Field_long::store(const char...)
          rewritten, now they just call Field_num::get_int() then store value returned.
        - Field_num::check_int() simplified.
        - Field_year::store(const char...) now uses strntoull10rnd() and properly checks
          errors returned.
    sql/field.h:
      Fix for bugs
      #27176: Assigning a string to an year column has unexpected results
      #26359: Strings becoming truncated and converted to numbers under STRICT mode
       - check_int() moved to Field_num.
       - get_int() introduced.
    86010101
strict.result 59.7 KB