An error occurred fetching the project authors.
  1. 15 Aug, 2008 1 commit
    • Ramil Kalimullin's avatar
      Fix for bug#37337: Function returns different results · 67a3d9e4
      Ramil Kalimullin authored
      Problem: REGEXP in functions/PSs may return wrong results
      due to improper initialization.
      
      Fix: initialize required REGEXP params.
      
      
      sql/item_cmpfunc.cc:
        Fix for bug#37337: Function returns different results
        
        prev_regexp is used in the Item_func_regex::regcomp()
        to store previous regex and to avoid re-initialization 
        if given the same pattern.
        Shoud be deleted in the Item_func_regex::cleanup() where we
        clean up the regexp structure.
      67a3d9e4
  2. 30 Jul, 2008 1 commit
    • Georgi Kodinov's avatar
      Bug#37662 nested if() inside sum() is parsed in exponential time · ae4a35fd
      Georgi Kodinov authored
            
      min() and max() functions are implemented in MySQL as macros.
      This means that max(a,b) is expanded to: ((a) > (b) ? (a) : (b))
      Note how 'a' is quoted two times.
      Now imagine 'a' is a recursive function call that's several 10s of levels deep.
      And the recursive function does max() with a function arg as well to dive into
      recursion.
      This means that simple function call can take most of the clock time.
      Identified and fixed several such calls to max()/min() : including the IF() 
      sql function implementation.
      
      mysql-test/r/func_if.result:
        Bug#37662 test case
      mysql-test/t/func_if.test:
        Bug#37662 test case
      sql/item.cc:
        Bug#37662 don't call expensive functions as arguments to min/max
      sql/item_cmpfunc.cc:
        Bug#37662 don't call expensive functions as arguments to min/max
      sql/item_func.cc:
        Bug#37662 don't call expensive functions as arguments to min/max
      ae4a35fd
  3. 15 Jul, 2008 1 commit
  4. 14 Jul, 2008 1 commit
    • Gleb Shchepa's avatar
      Bug #37761: IN handles NULL differently for table-subquery · e000e4a2
      Gleb Shchepa authored
                  and value-list
      
      The server returns unexpected results if a right side of the 
      NOT IN clause consists of NULL value and some constants of
      the same type, for example:
      
        SELECT * FROM t WHERE NOT t.id IN (NULL, 1, 2) 
        
      may return 3, 4, 5 etc if a table contains these values.
      
      
      The Item_func_in::val_int method has been modified:
      unnecessary resets of an Item_func_case::has_null field 
      value has been moved outside of an argument comparison
      loop. (Also unnecessary re-initialization of the null_value
      field has been moved).
      
      
      mysql-test/r/func_in.result:
        Added test case for bug #37761.
      mysql-test/t/func_in.test:
        Added test case for bug #37761.
      sql/item_cmpfunc.cc:
        Bug #37761: IN handles NULL differently for table-subquery 
                    and value-list
        
        The Item_func_in::val_int method has been modified:
        unnecessary resets of an Item_func_case::has_null field 
        value has been moved outside of an argument comparison
        loop. (Also unnecessary re-initialization of the null_value
        field has been moved).
      e000e4a2
  5. 28 Mar, 2008 1 commit
    • unknown's avatar
      Bug#26243 mysql command line crash after control-c · a9089cf4
      unknown authored
      - Backported the 5.1 DBUG to 5.0.
      - Avoid memory cleanup race on Windows client for CTRL-C
      
      
      client/mysql.cc:
        Bug#26243 mysql command line crash after control-c
        - On Windows, the sigint handler shouldn't call mysql_end
        because the main thread will do so automatically.
        - Remove unnecessary signal call from the sigint handler.
        - Call my_end with proper value.
      dbug/dbug.c:
        Bug#26243 mysql command line crash after control-c
        - Backported the 5.1 DBUG library. The old version uses a non-thread 
        safe global variable 'static struct state *stack'.
      dbug/factorial.c:
        Bug#26243 mysql command line crash after control-c
        - Backported the 5.1 DBUG library. The old version uses a non-thread 
        safe global variable 'static struct state *stack'.
      dbug/user.r:
        Bug#26243 mysql command line crash after control-c
        - Backported the 5.1 DBUG library. The old version uses a non-thread 
        safe global variable 'static struct state *stack'.
      include/my_dbug.h:
        Bug#26243 mysql command line crash after control-c
        - Backported the 5.1 DBUG library. The old version uses a non-thread 
        safe global variable 'static struct state *stack'.
      libmysql/libmysql.c:
        Bug#26243 mysql command line crash after control-c
        - Update for new DBUG library.
      myisam/mi_open.c:
        Bug#26243 mysql command line crash after control-c
        - Update for new DBUG library.
      sql/ha_federated.cc:
        Bug#26243 mysql command line crash after control-c
        - Update for new DBUG library.
      sql/ha_innodb.cc:
        Bug#26243 mysql command line crash after control-c
        - Update for new DBUG library.
      sql/ha_myisammrg.cc:
        Bug#26243 mysql command line crash after control-c
        - Update for new DBUG library.
      sql/item_cmpfunc.cc:
        Bug#26243 mysql command line crash after control-c
        - Update for new DBUG library.
      sql/mysqld.cc:
        Bug#26243 mysql command line crash after control-c
        - Update for new DBUG library.
      sql/net_serv.cc:
        Bug#26243 mysql command line crash after control-c
        - Update for new DBUG library.
      sql/opt_range.cc:
        Bug#26243 mysql command line crash after control-c
        - Update for new DBUG library.
      sql/set_var.cc:
        Bug#26243 mysql command line crash after control-c
        - Update for new DBUG library.
      sql/slave.cc:
        Bug#26243 mysql command line crash after control-c
        - Update for new DBUG library.
      sql/sql_cache.cc:
        Bug#26243 mysql command line crash after control-c
        - Update for new DBUG library.
      sql/sql_select.cc:
        Bug#26243 mysql command line crash after control-c
        - Update for new DBUG library.
      tests/mysql_client_test.c:
        Bug#26243 mysql command line crash after control-c
        - Update for new DBUG library.
      a9089cf4
  6. 22 Feb, 2008 1 commit
    • unknown's avatar
      Fix for Bug#30217: Views: changes in metadata behaviour · a3e83048
      unknown authored
      between 5.0 and 5.1.
        
      The problem was that in the patch for Bug#11986 it was decided
      to store original query in UTF8 encoding for the INFORMATION_SCHEMA.
      This approach however turned out to be quite difficult to implement
      properly. The main problem is to preserve the same IS-output after
      dump/restore.
        
      So, the fix is to rollback to the previous functionality, but also
      to fix it to support multi-character-set-queries properly. The idea
      is to generate INFORMATION_SCHEMA-query from the item-tree after
      parsing view declaration. The IS-query should:
        - be completely in UTF8;
        - not contain character set introducers.
        
      For more information, see WL4052.
      
      
      mysql-test/include/ddl_i18n.check_views.inc:
        Add a test case for Bug#30217.
      mysql-test/r/ddl_i18n_koi8r.result:
        Update result file.
      mysql-test/r/ddl_i18n_utf8.result:
        Update result file.
      mysql-test/r/information_schema.result:
        Update result file.
      mysql-test/r/information_schema_db.result:
        Update result file.
      mysql-test/r/mysqldump.result:
        Update result file.
      mysql-test/r/show_check.result:
        Update result file.
      mysql-test/t/ddl_i18n_koi8r.test:
        Add a test case for Bug#30217.
      mysql-test/t/ddl_i18n_utf8.test:
        Add a test case for Bug#30217.
      mysql-test/t/mysqldump.test:
        Add a test case for Bug#30217.
      sql/ha_ndbcluster.cc:
        Add a parameter to print().
      sql/item.cc:
        1. Add a parameter to print().
        2. Item_string::print():
              - Do not append character set introducer to the text literal
                if we're building a query for INFORMATION_SCHEMA;
              - Convert text literal to UTF8 if we're building a query
                for INFORMATION_SCHEMA.
      sql/item.h:
        Add a parameter to print().
      sql/item_cmpfunc.cc:
        Add a parameter to print().
      sql/item_cmpfunc.h:
        Add a parameter to print().
      sql/item_func.cc:
        Add a parameter to print().
      sql/item_func.h:
        Add a parameter to print().
      sql/item_geofunc.h:
        Add a parameter to print().
      sql/item_row.cc:
        Add a parameter to print().
      sql/item_row.h:
        Add a parameter to print().
      sql/item_strfunc.cc:
        Add a parameter to print().
      sql/item_strfunc.h:
        Add a parameter to print().
      sql/item_subselect.cc:
        Add a parameter to print().
      sql/item_subselect.h:
        Add a parameter to print().
      sql/item_sum.cc:
        Add a parameter to print().
      sql/item_sum.h:
        Add a parameter to print().
      sql/item_timefunc.cc:
        Add a parameter to print().
      sql/item_timefunc.h:
        Add a parameter to print().
      sql/mysql_priv.h:
        Add a parameter to print().
      sql/sp_head.cc:
        Add a parameter to print().
      sql/sql_lex.cc:
        Add a parameter to print().
      sql/sql_lex.h:
        Add a parameter to print().
      sql/sql_parse.cc:
        Add a parameter to print().
      sql/sql_select.cc:
        Add a parameter to print().
      sql/sql_show.cc:
        Add a parameter to print().
      sql/sql_test.cc:
        Add a parameter to print().
      sql/sql_view.cc:
        Build INFORMATION_SCHEMA query from Item-tree.
      sql/sql_yacc.yy:
        Build INFORMATION_SCHEMA query from Item-tree.
      sql/table.h:
        Add a parameter to print().
      a3e83048
  7. 13 Feb, 2008 1 commit
    • unknown's avatar
      Fixed bug#33764: Wrong result with IN(), CONCAT() and implicit · 247efb9c
      unknown authored
                       type conversion.
      
      Instead of copying of whole character string from a temporary
      buffer, the server copied a short-living pointer to that string
      into a long-living structure. That has been fixed.
      
      
      mysql-test/r/select.result:
        Added test case for bug#33764.
      mysql-test/t/select.test:
        Added test case for bug#33764.
      sql/item_cmpfunc.cc:
        Fixed bug#33764.
        Copying of a pointer has been replaced with an optional copying of
        a whole array to a newly allocated memory space in case of a
        functional source item.
      247efb9c
  8. 30 Jan, 2008 2 commits
    • unknown's avatar
      Fixing return value. · b0283afb
      unknown authored
      sql/item_cmpfunc.cc:
        Minor fix to return correct value in case of error.
      sql/rpl_utility.cc:
        Minor fix to return correct value in case of error.
      b0283afb
    • unknown's avatar
      Post-merge changes. · 101c30cc
      unknown authored
      BitKeeper/deleted/.del-show_binlog_events2.inc:
        Delete: mysql-test/include/show_binlog_events2.inc
      client/mysqlbinlog.cc:
        char -> uchar for raw memory.
      sql/item_cmpfunc.cc:
        Adding cast to remove warning when converting negative integer
        to unsigned type.
      sql/log_event.cc:
        char -> uchar for raw memory.
      sql/log_event.h:
        char -> uchar for raw memory.
      sql/rpl_utility.cc:
        Adding cast to remove warning when converting negative integer
        to unsigned type.
      sql/slave.cc:
        char -> uchar for raw memory.
      sql/sql_repl.cc:
        char -> uchar for raw memory.
      sql-common/client.c:
        char -> uchar for raw memory.
      101c30cc
  9. 09 Dec, 2007 1 commit
  10. 08 Dec, 2007 1 commit
    • unknown's avatar
      Fix for BUG#32694 "NOT NULL table field in a subquery produces invalid results" · b3d8ff4e
      unknown authored
        
      The problem was that when convert_constant_item is called for subqueries,
      this happens when we already started executing the top-level query, and
      the field argument of convert_constant_item pointed to a valid table row.
      In turn convert_constant_item used the field buffer to compute the value
      of its item argument. This copied the item's value into the field,
      and made equalities with outer references always true.
        
      The fix saves/restores the original field's value when it belongs to an
      outer table.
      
      
      mysql-test/r/type_datetime.result:
        Test for BUG#32694.
      mysql-test/t/type_datetime.test:
        Test for BUG#32694.
      sql/item_cmpfunc.cc:
        - Changed convert_constant_item() so that it doesn't destroy the contents
          of its field argument when the field originates from table in an outer
          query.
      b3d8ff4e
  11. 23 Nov, 2007 1 commit
    • unknown's avatar
      Fix for bug #32560: crash with interval function and count(*) · 1f57bfb8
      unknown authored
      Problem: INTERVAL function implementation doesn't handle NULL range values.
      
      Fix: skip NULL ranges looking for a proper one.
      
      
      mysql-test/r/func_set.result:
        Fix for bug #32560: crash with interval function and count(*)
          - test result.
      mysql-test/t/func_set.test:
        Fix for bug #32560: crash with interval function and count(*)
          - test case.
      sql/item_cmpfunc.cc:
        Fix for bug #32560: crash with interval function and count(*)
          - skip NULL ranges calculating INTERVAL(...).
      1f57bfb8
  12. 21 Nov, 2007 1 commit
    • unknown's avatar
      Fix for bug #32021: Using Date 000-00-01 in WHERE causes wrong result · f2a631f0
      unknown authored
        
      Problem: caching 00000000-00000099 dates as integer values we're 
      improperly shifting them up twice in the get_datetime_value().
        
      Fix: don't shift cached DATETIME values up for the second time.
      
      
      mysql-test/r/type_date.result:
        Fix for bug #32021: Using Date 000-00-01 in WHERE causes wrong result
          - test result.
      mysql-test/t/type_date.test:
        Fix for bug #32021: Using Date 000-00-01 in WHERE causes wrong result
          - test case.
      sql/item.h:
        Fix for bug #32021: Using Date 000-00-01 in WHERE causes wrong result
          - Item_cache::field_type() method added.
          - new Item_cache(enum_field_types) and Item_cache_int(enum_field_types) 
            constructors added.
      sql/item_cmpfunc.cc:
        Fix for bug #32021: Using Date 000-00-01 in WHERE causes wrong result
          - don't shift cached DATETIME values for the second time in the
            get_datetime_value():
              creating new Item_cache_int set DATETIME filed type,
              check the type before shifting.
      f2a631f0
  13. 17 Nov, 2007 1 commit
    • unknown's avatar
      Fixed bug #32335. · 99054db6
      unknown authored
      Comparison of a BIGINT NOT NULL column with a constant arithmetic
      expression that evaluates to NULL caused error 1048: "Column '...'
      cannot be null".
      
      Made convert_constant_item() check if the constant expression is NULL
      before attempting to store it in a field. Attempts to store NULL in a
      NOT NULL field caused query errors.
      
      
      sql/item_cmpfunc.cc:
        Fixed bug #32335.
        1. Made convert_constant_item() check if the constant expression is NULL
           before attempting to store it in a field. Attempts to store NULL in
           a NOT NULL field caused query errors.
        
        2. Also minor bug has been fixed: the thd->count_cuted_fields value
           was not restored in case of successful conversion.
      mysql-test/t/select.test:
        Added test case for bug #32335.
      mysql-test/r/select.result:
        Added test case for bug #32335.
      99054db6
  14. 10 Nov, 2007 2 commits
    • unknown's avatar
      Fixed bug #28076: inconsistent binary/varbinary comparison. · e7c6a81f
      unknown authored
      After adding an index the <VARBINARY> IN (SELECT <BINARY> ...)
      clause returned a wrong result: the VARBINARY value was illegally padded
      with zero bytes to the length of the BINARY column for the index search.
      (<VARBINARY>, ...) IN (SELECT <BINARY>, ... ) clauses are affected too.
      
      
      sql/item.cc:
        Fixed bug #28076.
        The Item_cache_str::save_in_field method has been overloaded
        to check cached values for an illegal padding before the saving
        into a field.
      sql/item.h:
        Fixed bug #28076.
        The Item_cache_str::is_varbinary flag has been added and the
        Item_cache_str::save_in_field method has been overloaded to prevent
        cached values from an illegal padding when saving in fields.
        The signature of the Item_cache::get_cache method has been
        changed to accept pointers to Item instead of Item_result
        values.
      sql/item_cmpfunc.cc:
        Fixed bug #28076.
        The Item_in_optimizer::fix_left method has been modified to
        to call Item_cache::get_cache in a new manner.
      sql/item_subselect.cc:
        Fixed bug #28076.
        The subselect_indexsubquery_engine::exec method has been
        modified to take into account field conversion errors
        (copy&paste from subselect_uniquesubquery_engine::exec).
      sql/sp_rcontext.cc:
        Fixed bug #28076.
        The sp_rcontext::create_case_expr_holder method has been
        modified to call Item_cache::get_cache in a new manner.
      sql/sp_rcontext.h:
        Fixed bug #28076.
        The sp_rcontext::create_case_expr_holder method signature
        has been modified to pass Item pointers to the
        Item_cache::get_cache method.
      sql/sql_class.cc:
        Fixed bug #28076.
        The select_max_min_finder_subselect::send_data method has been
        modified to call Item_cache::get_cache in a new manner.
      mysql-test/t/subselect.test:
        Added test case for bug #28076.
      mysql-test/r/subselect.result:
        Added test case for bug #28076.
      e7c6a81f
    • unknown's avatar
      Bug#31800: Date comparison fails with timezone and slashes for greater than comparison · ac3ef6c7
      unknown authored
      BETWEEN was more lenient with regard to what it accepted as a DATE/DATETIME
      in comparisons than greater-than and less-than were. ChangeSet makes < >
      comparisons similarly robust with regard to trailing garbage (" GMT-1")
      and "missing" leading zeros. Now all three comparators behave similarly
      in that they throw a warning for "junk" at the end of the data, but then
      proceed anyway if possible. Before < > fell back on a string- (rather than
      date-) comparison when a warning-condition was raised in the string-to-date
      conversion. Now the fallback only happens on actual errors, while warning-
      conditions still result in a warning being to delivered to the client.
      
      
      mysql-test/r/select.result:
        Show that we compare DATE/DATETIME-like strings as date(time)s
        now, rather than as bin-strings.
        Adjust older result as "2005-09-3a" is now correctly seen as
        "2005-09-3" + trailing garbage, rather than as "2005-09-30".
      mysql-test/t/select.test:
        Show that we compare DATE/DATETIME-like strings as date(time)s
        now, rather than as bin-strings.
      sql-common/my_time.c:
        correct/clarify date-related comments, particulary for check_date().
        doxygenize comment while at it.
      sql/item_cmpfunc.cc:
        get_date_from_str() no longer signals an error when all we had
        was a warning-condition -- and one we already gave the user a
        warning for at that. Preamble doxygenized.
      ac3ef6c7
  15. 29 Oct, 2007 1 commit
    • unknown's avatar
      Fix for bug #30782: Truncated UNSIGNED BIGINT columns only in SELECT w/ CASE, · 42894ed0
      unknown authored
      JOIN, and ORDER BY
      
      Problem: improper maximum length calculation of the CASE function leads to 
      decimal value truncation (storing/retrieving decimal field values).
      
      Fix: accurately calculate maximum length/unsigned flag/decimals parameters 
      of the CASE function.
      
      
      mysql-test/r/case.result:
        Fix for bug #30782: Truncated UNSIGNED BIGINT columns only in SELECT w/ CASE, 
        JOIN, and ORDER BY
          - test result.
      mysql-test/t/case.test:
        Fix for bug #30782: Truncated UNSIGNED BIGINT columns only in SELECT w/ CASE, 
        JOIN, and ORDER BY
          - test case.
      sql/item_cmpfunc.cc:
        Fix for bug #30782: Truncated UNSIGNED BIGINT columns only in SELECT w/ CASE, 
        JOIN, and ORDER BY
          - accurately calculate Item_func_case::max_length/unsigned_flag/decimals.
      sql/item_cmpfunc.h:
        Fix for bug #30782: Truncated UNSIGNED BIGINT columns only in SELECT w/ CASE, 
        JOIN, and ORDER BY
          - accurately calculate Item_func_case::max_length/unsigned_flag/decimals.
      42894ed0
  16. 24 Oct, 2007 1 commit
  17. 17 Oct, 2007 1 commit
    • unknown's avatar
      Fix for bug #31207: Test "join_nested" shows different strategy on IA64 · ce8bf087
      unknown authored
      CPUs / Intel's ICC compile
      
      The bug is a combination of two problems:
      
      1. IA64/ICC MySQL binaries use glibc's qsort(), not the one in mysys.
      
      2. The order relation implemented by join_tab_cmp() is not transitive,
      i.e. it is possible to choose such a, b and c that (a < b) && (b < c)
      but (c < a). This implies that result of a sort using the relation
      implemented by join_tab_cmp() depends on the order in which
      elements are compared, i.e. the result is implementation-specific. Since
      choose_plan() uses qsort() to pre-sort the
      join tables using join_tab_cmp() as a compare function, the results of
      the sorting may vary depending on qsort() implementation.
      
      It is neither possible nor important to implement a better ordering
      algorithm in join_tab_cmp(). Therefore the only way to fix it is to
      force our own qsort() to be used by renaming it to my_qsort(), so we don't depend
      on linker to decide that.
      
      This patch also "fixes" bug #20530: qsort redefinition violates the
      standard.
      
      
      include/my_sys.h:
        Renamed qsort() and qsort2() to my_qsort() and my_qsort2(). Since
        previously we relied on stdlib.h to provide a declaration for qsort(), a
        separate declaration for my_qsort() is now required.
      libmysql/Makefile.shared:
        Added mf_qsort.c to libmysql, since my_lib.c now uses my_qsort() instead of qsort().
      myisam/ft_boolean_search.c:
        Replaced qsort2() with my_qsort2().
      myisam/ft_nlq_search.c:
        Replaced qsort2() with my_qsort2().
      myisam/myisampack.c:
        Replaced qsort() with my_qsort().
      myisam/sort.c:
        Replaced qsort2() with my_qsort2().
      mysys/mf_keycache.c:
        Replaced qsort() with my_qsort().
      mysys/mf_qsort.c:
        Renamed qsort() to my_qsort() and qsort2() to my_qsort2().
      mysys/mf_sort.c:
        Replaced qsort2() with my_qsort2().
      mysys/my_lib.c:
        Replaced qsort() with my_qsort().
      mysys/queues.c:
        Replaced qsort2() with my_qsort2().
      sql/item_cmpfunc.cc:
        Replaced qsort2() with my_qsort2().
      sql/item_cmpfunc.h:
        Replaced qsort2() with my_qsort2().
      sql/opt_range.cc:
        Replaced qsort() with my_qsort().
      sql/records.cc:
        Replaced qsort() with my_qsort().
      sql/sql_acl.cc:
        Replaced qsort() with my_qsort().
      sql/sql_array.h:
        Replaced qsort() with my_qsort().
      sql/sql_help.cc:
        Replaced qsort() with my_qsort().
      sql/sql_select.cc:
        Replaced qsort() with my_qsort().
      sql/examples/ha_tina.cc:
        Replaced qsort() with my_qsort().
      sql/sql_table.cc:
        Replaced qsort() with my_qsort().
      ce8bf087
  18. 11 Oct, 2007 2 commits
    • unknown's avatar
      Doxygenization of comments. · d43c15b0
      unknown authored
      d43c15b0
    • unknown's avatar
      Bug #31440: 'select 1 regex null' asserts debug server · 76af5717
      unknown authored
      The special case with NULL as a regular expression
      was handled at prepare time. But in this special case
      the item was not marked as fixed. This caused an assertion
      at execution time.
      Fixed my marking the item as fixed even when known to 
      return NULL at prepare time.
      
      
      mysql-test/r/func_regexp.result:
        Bug #31440: test case
      mysql-test/t/func_regexp.test:
        Bug #31440: test case
      sql/item_cmpfunc.cc:
        Bug #31440: mark the item as fixed even when 
        known to return NULL.
      76af5717
  19. 10 Oct, 2007 1 commit
    • unknown's avatar
      Fixed bug #31471: decimal_bin_size: Assertion `scale >= 0 && · c866f801
      unknown authored
                        precision > 0 && scale <= precision'.
      
      A sign of a resulting item of the IFNULL function was not
      updated and the maximal length of this result was calculated
      improperly. Correct algorithm was copy&pasted from the IF
      function implementation.
      
      
      sql/item_cmpfunc.cc:
        Fixed bug #31471.
        The Item_func_ifnull::fix_length_and_dec method has been
        modified to update the Item_func_ifnull::unsigned_flag field
        and to take this field into account when calculating the
        Item_func_ifnull::max_length value.
        (See Item_func_if::fix_length_and_dec for reference).
      mysql-test/t/null.test:
        Added test case for bug #31471.
      mysql-test/r/null.result:
        Added test case for bug #31471.
      mysql-test/r/create.result:
        Update test case after the bugfix of bug #31471.
      c866f801
  20. 05 Oct, 2007 1 commit
    • unknown's avatar
      Bug#31081 server crash in regexp function · 64b19133
      unknown authored
      Problem: The "regex" library written by Henry Spencer
      does not support tricky character sets like UCS2.
      Fix: convert tricky character sets to UTF8 before calling
      regex functions.
      
      
      mysql-test/r/ctype_uca.result:
        Adding tests
      mysql-test/r/ctype_ucs.result:
        Adding tests
      mysql-test/r/ctype_utf8.result:
        Adding tests
      mysql-test/r/func_regexp.result:
        Adding tests
      mysql-test/t/ctype_uca.test:
        Adding tests
      mysql-test/t/ctype_ucs.test:
        Adding tests
      mysql-test/t/ctype_utf8.test:
        Adding tests
      mysql-test/t/func_regexp.test:
        Adding tests
      sql/item_cmpfunc.cc:
        - Adding new method Item_func_regex::regcomp()
        to share more code between fix_fields() and val_int()
        - Adding conversion from ASCII-incompatible charsets like UCS2
        to UTF8, because the "regexp" does not support these charsets
        - Additional optimization: calculate flags for regcomp only
          once in fix_fields, instead of every regcomp()
      sql/item_cmpfunc.h:
        Adding prototypes for new members and methods
      mysql-test/include/ctype_regex.inc:
        New BitKeeper file ``mysql-test/include/ctype_regex.inc''
        
        Moving common regular expression tests into a separate
        file and uncluding it into func_regexp and into many ctype_xxx tests.
      64b19133
  21. 22 Sep, 2007 1 commit
    • unknown's avatar
      Bug#27216: functions with parameters of different date types may return wrong · ebaa05ef
      unknown authored
      type of the result.
      
      There are several functions that accept parameters of different types.
      The result field type of such functions was determined based on
      the aggregated result type of its arguments. As the DATE and the DATETIME
      types are represented by the STRING type, the result field type
      of the affected functions was always STRING for DATE/DATETIME arguments.
      The affected functions are COALESCE, IF, IFNULL, CASE, LEAST/GREATEST, CASE.
      
      Now the affected functions aggregate the field types of their arguments rather
      than their result types and return the result of aggregation as their result
      field type.
      The cached_field_type member variable is added to the number of classes to
      hold the aggregated result field type.
      The str_to_date() function's result field type now defaults to the
      MYSQL_TYPE_DATETIME.
      The agg_field_type() function is added. It aggregates field types with help
      of the Field::field_type_merge() function.
      The create_table_from_items() function now uses the 
      item->tmp_table_field_from_field_type() function to get the proper field
      when the item is a function with a STRING result type.
      
      
      libmysql/libmysql.c:
        Bug#27216: functions with parameters of different date types may return wrong
        type of the result.
        The client library now accepts the NEWDATE type as a string.
      sql/item_cmpfunc.cc:
        Bug#27216: functions with parameters of different date types may return wrong
        type of the result.
        Now the fix_length_and_dec functions of the
        Item_func_ifnull,Item_func_if, Item_func_case, Item_func_coalesce
        classes are use agg_field_type function to find out the type of their 
        result field.
      sql/item_cmpfunc.h:
        Bug#27216: functions with parameters of different date types may return wrong
        type of the result.
        The cached_field type is added to the Item_func_case, Item_func_if and
        Item_func_coalesce classes.
        The field_type function is added to the Item_func_ifnull, Item_func_if,
        Item_func_coalesce, Item_func_case classes.
      sql/item_func.cc:
        Bug#27216: functions with parameters of different date types may return wrong
        type of the result.
        The Item_func_min_max::fix_length_and_dec function now uses the agg_field_type
        function to find out the correct type of the result field.
      sql/item_func.h:
        Bug#27216: functions with parameters of different date types may return wrong
        type of the result.
        The cached_field_type variable is added to the Item_func_min_max class.
      sql/item_timefunc.cc:
        Bug#27216: functions with parameters of different date types may return wrong
        type of the result.
        The result of the str_to_date function now defaults to the
        DATETIME type.
      sql/mysql_priv.h:
        Bug#27216: functions with parameters of different date types may return wrong
        type of the result.
        The prototype of the agg_field_type function is added.
      sql/protocol.cc:
        Bug#27216: functions with parameters of different date types may return wrong
        type of the result.
        The Protocol_simple::store function is now used to store fields of NEWDATE type.
      sql/sql_insert.cc:
        Bug#27216: functions with parameters of different date types may return wrong
        type of the result.
        The create_table_from_items function now uses the
        tmp_table_field_from_field_type function to get field for items with the
        STRING result type.
      mysql-test/r/date_formats.result:
        A test case result corrected after fixing bug#27216.
      mysql-test/r/type_datetime.result:
        Added a test case for the bug#27216: functions with parameters of different
        date types may return wrong type of the result.
      mysql-test/t/type_datetime.test:
        Added a test case for the bug#27216: functions with parameters of different
        date types may return wrong type of the result.
      ebaa05ef
  22. 13 Aug, 2007 1 commit
    • unknown's avatar
      Fixed a lot of compiler warnings and errors detected by Forte C++ on Solaris · 09a53f28
      unknown authored
      Faster thr_alarm()
      Added 'Opened_files' status variable to track calls to my_open()
      Don't give warnings when running mysql_install_db
      Added option --source-install to mysql_install_db
      
      I had to do the following renames() as used polymorphism didn't work with Forte compiler on 64 bit systems
      index_read()      -> index_read_map()
      index_read_idx()  -> index_read_idx_map()
      index_read_last() -> index_read_last_map()
      
      
      BUILD/compile-solaris-sparc-forte:
        Updated script to current Solaris installations
        Now we compile by default for 64 bits
      client/mysql.cc:
        Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
      client/mysql_upgrade.c:
        Fixed compiler warning (on Forte)
      client/mysqladmin.cc:
        Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
      client/mysqlcheck.c:
        Fixed compiler warning (on Forte)
      client/mysqldump.c:
        Fixed compiler warning (on Forte)
      client/mysqlslap.c:
        Fixed compiler warning (on Forte)
      client/mysqltest.c:
        Fixed compiler warning (on Forte)
      client/sql_string.cc:
        Avoid compiler warnings when using C function pointers in C++
      configure.in:
        Added detection of mtmalloc and ieeefp.h
      extra/replace.c:
        Fixed compiler warning (on Forte)
      include/m_ctype.h:
        Added some typedef's to make it easy to use C function pointers in C++
      include/my_sys.h:
        Added my_file_total_opened (counter for calls to my_open())
      include/myisam.h:
        Fixed compiler warning (on Forte)
      libmysql/libmysql.c:
        Fixed compiler warning (on Forte) by adding casts and change types
      libmysql/manager.c:
        Fixed compiler warning (on Forte) by adding casts and change types
      mysql-test/r/ctype_cp932_binlog_stm.result:
        Updated positions
        (Needed because we didn't before correctly restore collation_database after running stored procedure
      mysys/my_fopen.c:
        Count number of opened files
      mysys/my_open.c:
        Count number of opened files
      mysys/my_static.c:
        Count number of opened files
      mysys/thr_alarm.c:
        Optimization to do less alarm() and pthread_sigmask() calls.
        Idea is to remember time for next pending alarm and not reschedule a new alarm if it's after the current one.
        Before we only did this if there was other pending alarms.
        We don't have to use pthread_sigmask() in case of 'USE_ONE_SIGNAL_HAND' as the alarm()
        signal will be blocked for the calling thread anyway and no other thread will have the alarm() signal enabled to call process_alarm()
      regex/regcomp.c:
        Fixed compiler warning (on Forte) by adding casts and change types
      scripts/mysql_install_db.sh:
        Added option --source-install to allow one to create a mysql database from the source tree without installing MySQL
        Don't give (unnecessary) warnings
      server-tools/instance-manager/angel.cc:
        Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
      server-tools/instance-manager/thread_registry.cc:
        Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
      sql/event_db_repository.cc:
        index_read() -> index_read_map()
      sql/event_queue.cc:
        Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
      sql/field.cc:
        Fixed compiler warnings about hidden fields
      sql/ha_partition.cc:
        Fixed compiler warnings about hidden fields
        index_read() -> index_read_map()
      sql/ha_partition.h:
        index_read() -> index_read_map()
      sql/handler.cc:
        Added PAGE option to row types (to prepare for future)
        index_read() -> index_read_map()
      sql/handler.h:
        Added ROW_TYPE_PAGE (for future)
        Added flag to signal if table was to be created transactionally
        I had to do the following renames() as used polymorphism didn't work with Forte compiler on 64 bit systems
        index_read()      -> index_read_map()
        index_read_idx()  -> index_read_idx_map()
        index_read_last() -> index_read_last_map()
      sql/item.cc:
        Fixed indentation
        Renamed local variable to avoid hiding class variable
      sql/item_cmpfunc.cc:
        Renamed local variable to avoid hiding class variable
      sql/item_cmpfunc.h:
        Removed not used variable
      sql/item_func.cc:
        Renamed local variable to avoid hiding class variable
      sql/item_strfunc.cc:
        Moved functions from Item_strfunc.cc
      sql/item_strfunc.h:
        Move functions to item_strfunc.cc
        Use C function pointer type to avoid compiler warnings (with Forte)
      sql/item_subselect.cc:
        index_read() -> index_read_map()
      sql/item_xmlfunc.cc:
        Renamed local variable to avoid hiding class variable
        Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
      sql/key.cc:
        Fixed indentation
      sql/log.cc:
        Renamed local variable to avoid hiding class variable
      sql/log_event.cc:
        Removed call to my_time() when creating class instance of Log_event() as this may have static instances.
        (One can't call my_time() before my_init())
        index_read() -> index_read_map()
        Renamed local variable to avoid hiding class variable
      sql/log_event_old.cc:
        Renamed local variable to avoid hiding class variable
      sql/mysql_priv.h:
        Made all create_backup_ctx() declarations identical.
        This lifted up a bug where wrong create_backup_ctx() was called in some cases.
        Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
      sql/mysqld.cc:
        Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
        Fixed indentation
        Don't call end_thr_alarm() when calling unireg_abort() as unireg_abort() already calls end_thr_alarm()
        Added variable 'Opened_files' (number of calls to my_open() or my_fopen())
        Don't print 'loose' warnings when using --bootstrap (to avoid warnings when running mysql_install_db)
        Fixed compiler warnings
      sql/opt_range.cc:
        index_read() -> index_read_map()
      sql/opt_sum.cc:
        index_read() -> index_read_map()
      sql/partition_info.cc:
        Renamed local variable to avoid hiding class variable
      sql/rpl_filter.cc:
        Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
      sql/set_var.cc:
        Renamed local variable to avoid hiding class variable
        Added 'process_key_cache_t' type to avoid compiler warning (on Forte)
      sql/set_var.h:
        Added 'process_key_cache_t' type to avoid compiler warning (on Forte)
      sql/sp.cc:
        More debugging
        index_read() -> index_read_map()
      sql/sp_cache.cc:
        Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
      sql/sp_head.cc:
        Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
        Moved 'saved_creation_ctx' higher up to be able to free objects allocated by create_backup_ctx()
      sql/sql_acl.cc:
        index_read() -> index_read_map()
      sql/sql_class.cc:
        Renamed local variable to avoid hiding class variable
        Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
      sql/sql_class.h:
        Renamed local variable to avoid hiding class variable
      sql/sql_db.cc:
        Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
      sql/sql_delete.cc:
        Renamed local variable to avoid hiding class variable
      sql/sql_handler.cc:
        index_read() -> index_read_map()
      sql/sql_help.cc:
        index_read() -> index_read_map()
      sql/sql_insert.cc:
        index_read() -> index_read_map()
        Renamed local variable to avoid hiding class variable
      sql/sql_lex.cc:
        Renamed local variable to avoid hiding class variable
      sql/sql_plugin.cc:
        Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
        index_read() -> index_read_map()
        Don't give warnings about not used plugins if we are using --warnings=0
      sql/sql_select.cc:
        index_read() -> index_read_map()
      sql-common/client.c:
        Fixed compiler warning (on Forte)
      sql-common/my_time.c:
        Removed never accessed code
        Fixed compiler warning (on Forte)
      sql/sql_servers.cc:
        index_read() -> index_read_map()
      sql/sql_show.cc:
        Added TRANSACTIONAL to SHOW CREATE
        Fixed ROW_TYPE_PAGE
      sql/sql_string.cc:
        Avoid compiler warnings when using C function pointers in C++
      sql/sql_table.cc:
        Set create_info->transactional if we used TRANSACTIONAL=1
      sql/sql_udf.cc:
        index_read() -> index_read_map()
      sql/sql_yacc.yy:
        Added TRANSACTIONAL=0|1 to CREATE (for future)
        Added row type PAGE (was only partionally handled before)
      sql/strfunc.cc:
        Avoid compiler warnings when using C function pointers in C++
      sql/table.cc:
        More DBUG statements
        Declare all create_backup_ctx() functions identically
        Remember if table was created with TRANSACTIONAL flag or not (future safe)
        Renamed local variable to avoid hiding class variable
      sql/table.h:
        Remember if table was created with TRANSACTIONAL=1
      sql/tztime.cc:
        index_read() -> index_read_map()
      sql-common/pack.c:
        Fixed compiler warning (on Forte)
      storage/archive/archive_reader.c:
        Fixed compiler warning (on Forte)
      storage/archive/azio.c:
        Fixed compiler warning (on Forte)
      storage/blackhole/ha_blackhole.cc:
        index_read() -> index_read_map()
      storage/blackhole/ha_blackhole.h:
        index_read() -> index_read_map()
      storage/csv/ha_tina.cc:
        Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
      storage/example/ha_example.cc:
        index_read() -> index_read_map()
      storage/example/ha_example.h:
        index_read() -> index_read_map()
      storage/heap/ha_heap.cc:
        index_read() -> index_read_map()
      storage/heap/ha_heap.h:
        index_read() -> index_read_map()
      storage/heap/hp_test1.c:
        Fixed compiler warning (on Forte)
      storage/heap/hp_test2.c:
        Fixed compiler warning (on Forte)
      storage/myisam/ft_boolean_search.c:
        Fixed compiler warning (on Forte)
      storage/myisam/ft_nlq_search.c:
        Fixed compiler warning (on Forte)
      storage/myisam/ft_parser.c:
        Fixed compiler warning (on Forte)
      storage/myisam/ft_stopwords.c:
        Fixed compiler warning (on Forte)
      storage/myisam/ha_myisam.cc:
        index_read() -> index_read_map()
      storage/myisam/ha_myisam.h:
        index_read() -> index_read_map()
      storage/myisam/mi_check.c:
        Fixed compiler warning (on Forte)
      storage/myisam/mi_delete.c:
        Fixed compiler warning (on Forte)
      storage/myisam/mi_dynrec.c:
        Fixed compiler warning (on Forte)
      storage/myisam/mi_extra.c:
        Fixed compiler warning (on Forte)
      storage/myisam/mi_key.c:
        Fixed compiler warning (on Forte)
      storage/myisam/mi_keycache.c:
        Fixed compiler warning (on Forte)
      storage/myisam/mi_locking.c:
        Fixed compiler warning (on Forte)
      storage/myisam/mi_log.c:
        Fixed compiler warning (on Forte)
      storage/myisam/mi_open.c:
        Fixed compiler warning (on Forte)
      storage/myisam/mi_packrec.c:
        Fixed compiler warning (on Forte)
      storage/myisam/mi_page.c:
        Fixed compiler warning (on Forte)
      storage/myisam/mi_rkey.c:
        Added comment
      storage/myisam/mi_search.c:
        Fixed compiler warning (on Forte)
      storage/myisam/mi_statrec.c:
        Fixed compiler warning (on Forte)
      storage/myisam/mi_test1.c:
        Fixed compiler warning (on Forte)
      storage/myisam/mi_test2.c:
        Fixed compiler warning (on Forte)
      storage/myisam/mi_test3.c:
        Fixed compiler warning (on Forte)
      storage/myisam/mi_update.c:
        Fixed compiler warning (on Forte)
      storage/myisam/mi_write.c:
        Fixed compiler warning (on Forte)
      storage/myisam/myisamdef.h:
        Fixed that file_read/file_write returns type size_t
        Changed some functions to use uchar * as argument/return value instead of char*
        This fixed some compiler warnings on Forte
      storage/myisam/myisamlog.c:
        Fixed compiler warning (on Forte)
      storage/myisam/myisampack.c:
        Fixed compiler warning (on Forte)
      storage/myisam/rt_test.c:
        Fixed compiler warning (on Forte)
      storage/myisam/sort.c:
        Fixed compiler warning (on Forte) by adding casts or changing variables to uchar*
      storage/myisam/sp_test.c:
        Fixed compiler warning (on Forte) by adding casts or changing variables to uchar*
      storage/myisammrg/ha_myisammrg.cc:
        index_read() -> index_read_map()
      storage/myisammrg/ha_myisammrg.h:
        index_read() -> index_read_map()
      storage/myisammrg/myrg_create.c:
        Fixed compiler warning (on Forte) by adding casts or changing variable types
      storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp:
        Tdummy -> align  (as in other part of cluster code)
      storage/ndb/src/kernel/vm/DynArr256.cpp:
        Removed not used variable
      storage/ndb/src/ndbapi/Ndb.cpp:
        Removed not used variable
      strings/strtod.c:
        Include ieeefp.h to avoid compiler warning
      tests/bug25714.c:
        Fixed compiler warning
      tests/mysql_client_test.c:
        Remove not used variable
        Fixed indentation
        Removed never reached code
        Fixed compiler warning (on Forte) by adding casts or changing variable types
      vio/viosocket.c:
        Fixed compiler warning (on Forte) by adding casts or changing variable types
      09a53f28
  23. 15 Jul, 2007 4 commits
    • unknown's avatar
      item_cmpfunc.cc: · 56a65d7a
      unknown authored
        A typo fixed.
      
      
      sql/item_cmpfunc.cc:
        A typo fixed.
      56a65d7a
    • unknown's avatar
      item_cmpfunc.cc: · 3e925554
      unknown authored
        Fixed compiler warning.
      
      
      sql/item_cmpfunc.cc:
        Fixed compiler warning.
      3e925554
    • unknown's avatar
      item_cmpfunc.cc: · 16135c7d
      unknown authored
        A comment changed.
      
      
      sql/item_cmpfunc.cc:
        A comment changed.
      16135c7d
    • unknown's avatar
      Extended fix for the bug#29555. · 6e078ff5
      unknown authored
      The get_time_value function is added. It is used to obtain TIME values both
      from items the can return time as an integer and from items that can return
      time only as a string.
      The Arg_comparator::compare_datetime function now uses pointer to a getter
      function to obtain values to compare. Now this function is also used for
      comparison of TIME values.
      The get_value_func variable is added to the Arg_comparator class.
      It points to a getter function for the DATE/DATETIME/TIME comparator.
      
      
      mysql-test/t/type_time.test:
        Extended test case for the bug#29555.
      mysql-test/r/type_time.result:
        Extended test case for the bug#29555.
      sql/item_cmpfunc.cc:
        Extended fix for the bug#29555.
        The get_time_value function is added. It is used to obtain TIME values both
        from items the can return time as an integer and from items that can return
        time only as a string.
        The Arg_comparator::compare_datetime function now uses pointer to a getter
        function to obtain values to compare. Now this function is also used for
        comparison of TIME values.
      sql/item_cmpfunc.h:
        Extended fix for the bug#29555.
        The get_value_func variable is added to the Arg_comparator class.
        It points to a getter function for the DATE/DATETIME/TIME comparator.
      6e078ff5
  24. 12 Jul, 2007 1 commit
    • unknown's avatar
      Bug#29739: Incorrect time comparison in BETWEEN. · e08e63b1
      unknown authored
      Time values were compared by the BETWEEN function as strings. This led to a
      wrong result in cases when some of arguments are less than 100 hours and other
      are greater.
      
      Now if all 3 arguments of the BETWEEN function are of the TIME type then
      they are compared as integers.
      
      
      mysql-test/t/type_time.test:
        Added a tes tcase for the bug#29739: Incorrect time comparison in BETWEEN.
      mysql-test/r/type_time.result:
        Added a tes tcase for the bug#29739: Incorrect time comparison in BETWEEN.
      sql/item_cmpfunc.cc:
        Bug#29739: Incorrect time comparison in BETWEEN.
        Now if all 3 arguments of the BETWEEN function are of the TIME type then
        they are compared as integers.
      e08e63b1
  25. 11 Jul, 2007 1 commit
    • unknown's avatar
      Bug#29555: Comparing time values as strings may lead to a wrong result. · 25e28d4d
      unknown authored
      Time values were compared as strings. This led to a wrong comparison
      result when comparing values one of which is under 100 hours and another is
      over 100 hours.
      
      Now when the Arg_comparator::set_cmp_func function sees that both items to
      compare are of the TIME type it sets the comparator to the
      Arg_comparator::compare_e_int or the Arg_comparator::compare_int_unsigned
      functions.
      
      
      sql/item_cmpfunc.cc:
        Bug#29555: Comparing time values as strings may lead to a wrong result.
        Now when the Arg_comparator::set_cmp_func function sees that both items to
        compare are of the TIME type it sets the comparator to the
        Arg_comparator::compare_e_int or the Arg_comparator::compare_int_unsigned
        functions.
      mysql-test/r/type_time.result:
        Added a test case for the bug#29555: Comparing time values as strings may
        lead to a wrong result.
      mysql-test/t/type_time.test:
        Added a test case for the bug#29555: Comparing time values as strings may
        lead to a wrong result.
      25e28d4d
  26. 11 Jun, 2007 1 commit
  27. 05 Jun, 2007 1 commit
    • unknown's avatar
      Bug#28778: Wrong result of BETWEEN when comparing a DATETIME field with an · 0304a13e
      unknown authored
      integer constants.
      
      This bug is introduced by the fix for bug#16377. Before the fix the 
      Item_func_between::fix_length_and_dec method converted the second and third
      arguments to the type of the first argument if they were constant and the first
      argument is of the DATE/DATETIME type. That approach worked well for integer
      constants and sometimes produced bad result for string constants. The fix for
      the bug#16377 wrongly removed that code at all and as a result of this the
      comparison of a DATETIME field and an integer constant was carried out in a
      wrong way and sometimes led to wrong result sets.
      
      Now the Item_func_between::fix_length_and_dec method converts the second and
      third arguments to the type of the first argument if they are constant, the
      first argument is of the DATE/DATETIME type and the DATETIME comparator isn't
      applicable.
      
      
      sql/item_cmpfunc.cc:
        Bug#28778: Wrong result of BETWEEN when comparing a DATETIME field with an
        integer constants.
        Now the Item_func_between::fix_length_and_dec method converts the second and
        third arguments to the type of the first argument if they are constant, the
        first argument is of the DATE/DATETIME type and the DATETIME comparator isn't
        applicable.
      mysql-test/r/type_datetime.result:
        Added a test case for the bug#28778: Wrong result of BETWEEN when comparing a DATETIME
        field with an integer constants.
      mysql-test/t/type_datetime.test:
        Added a test case for the bug#28778: Wrong result of BETWEEN when comparing a DATETIME
        field with an integer constants.
      0304a13e
  28. 30 May, 2007 1 commit
    • unknown's avatar
      Got rid of log_01[], because we don't really need it. Division and log_10[]... · 9dc7a7b8
      unknown authored
      Got rid of log_01[], because we don't really need it. Division and log_10[] can always be used instead, which is also a more precise way.
      
      This is for bug #28121.
      
      
      include/m_string.h:
        Got rid of log_01[], because we don't really need it.
      sql/item_cmpfunc.cc:
        Got rid of log_01[], because we don't really need it.
      strings/strtod.c:
        Got rid of log_01[], because we don't really need it.
      9dc7a7b8
  29. 29 May, 2007 1 commit
    • unknown's avatar
      Bug#28450: The Item_date_add_interval in select list may fail the field · d393c9e6
      unknown authored
      type assertion.
      
      The bug was introduced by the patch for bug #16377.
      The "+ INTERVAL" (Item_date_add_interval) function detects its result type
      by the type of its first argument. But in some cases it returns STRING
      as the result type. This happens when, for example, the first argument is a 
      DATE represented as string. All this makes the get_datetime_value()
      function misinterpret such result and return wrong DATE/DATETIME value.
      To avoid such cases in the fix for #16377 the code that detects correct result
      field type on the first execution was added to the
      Item_date_add_interval::get_date() function. Due to this the result
      field type of the Item_date_add_interval item stored by the send_fields()
      function differs from item's result field type at the moment when
      the item is actually sent. It causes an assertion failure.
      
      Now the get_datetime_value() detects that the DATE value is returned by
      some item not only by checking the result field type but also by comparing
      the returned value with the 100000000L constant - any DATE value should be
      less than this value.
      Removed result field type adjusting code from the
      Item_date_add_interval::get_date() function.
      
      
      sql/item_cmpfunc.cc:
        Bug#28450: The Item_date_add_interval in select list may fail the field 
        type assertion.
        Now the get_datetime_value() detects that the DATE value is returned by
        some item not only by checking the result field type but also by comparing
        the returned value with the 100000000L constant - any DATE value should be
        less than this value.
      mysql-test/r/func_date_add.result:
        Added a test case for the bug#28450: The Item_date_add_interval in select list may fail the field
        type assertion.
      sql/item_timefunc.cc:
        Bug#28450: The Item_date_add_interval in select list may fail the field 
        type assertion.
        Removed result field type adjusting code from the
        Item_date_add_interval::get_date() function.
      mysql-test/t/func_date_add.test:
        Added a test case for the bug#28450: The Item_date_add_interval in select list may fail the field
        type assertion.
      d393c9e6
  30. 28 May, 2007 1 commit
    • unknown's avatar
      Fix for bug #28121 "INSERT or UPDATE into DOUBLE(200,0) field being truncated to 31 digits" · e3af3c21
      unknown authored
      When storing a large number to a FLOAT or DOUBLE field with fixed length, it could be incorrectly truncated if the field's length was greater than 31.
      
      This patch also does some code cleanups to be able to reuse code which is common between Field_float::store() and Field_double::store().
      
      
      include/m_string.h:
        Added declarations for log_10 and log_01 from strtod.c
      mysql-test/r/type_float.result:
        Added the testcase for bug #28121 "INSERT or UPDATE into DOUBLE(200,0) field being truncated to 31 digits"
      mysql-test/t/type_float.test:
        Added the testcase for bug #28121 "INSERT or UPDATE into DOUBLE(200,0) field being truncated to 31 digits"
      sql/field.cc:
        Moved common code from Field_float::store() and Field_double:store() to Field_real::truncate()
        Fixed the algorithm to not truncate large input numbers if the field length is greater than 31.
        Fixed rounding to not depend on FLT_MAX/DBL_MAX constants.
      sql/field.h:
        Moved not_fixed member from Field_double to Field_real to allow code reuse between Field_float::store() and Field_double::store()
        Added truncate() method to Field_real which is used by both Field_float and Field_double
      sql/init.cc:
        log_10[] and log_01[] are now defined as statical arrays in strtod.c, no need to pre-computed them.
      sql/item_cmpfunc.cc:
        log_01[] now starts from 1e0, not from 1e-1 for consistency.
      sql/mysql_priv.h:
        Moved log_10[] and log_01[] from mysqld.cc to libmystrings.
      sql/mysqld.cc:
        Moved log_10[] and log_01[] from mysqld.cc to libmystrings.
      strings/strtod.c:
        Define and use log_10[] and log_01[] as static arrays of constants instead of values pre-computed at startup.
      e3af3c21
  31. 24 May, 2007 1 commit
  32. 17 May, 2007 1 commit
    • unknown's avatar
      Bug#28261: Wrong DATETIME comparison result when the GET_USER_VAR function · c4a4df5a
      unknown authored
      is involved.
      
      The Arg_comparator::compare_datetime() comparator caches its arguments if
      they are constants i.e. const_item() returns true. The
      Item_func_get_user_var::const_item() returns true or false based on
      the current query_id and the query_id where the variable was created.
      Thus even if a query can change its value its const_item() still will return
      true. All this leads to a wrong comparison result when an object of the
      Item_func_get_user_var class is involved.
      
      Now the Arg_comparator::can_compare_as_dates() and the
      get_datetime_value() functions never cache result of the GET_USER_VAR()
      function (the Item_func_get_user_var class).
      
      
      mysql-test/t/type_datetime.test:
        A test case is added for the bug#28261: Wrong DATETIME comparison result when the GET_USER_VAR function
        is involved.
      mysql-test/r/type_datetime.result:
        A test case is added for the bug#28261: Wrong DATETIME comparison result when the GET_USER_VAR function
        is involved.
      sql/item_cmpfunc.cc:
        Bug#28261: Wrong DATETIME comparison result when the GET_USER_VAR function
        is involved.
        Now the Arg_comparator::can_compare_as_dates() and the
        get_datetime_value() functions never cache result of the GET_USER_VAR()
        function (the Item_func_get_user_var class).
      c4a4df5a
  33. 16 May, 2007 1 commit
    • unknown's avatar
      Backport of TIME->MYSQL_TIME / Y2K fixset · b5e4f54a
      unknown authored
         
      Made year 2000 handling more uniform
      Removed year 2000 handling out from calc_days()
      The above removes some bugs in date/datetimes with year between 0 and 200
      Now we get a note when we insert a datetime value into a date column
      For default values to CREATE, don't give errors for warning level NOTE
      Fixed some compiler failures
      Added library ws2_32 for windows compilation (needed if we want to compile with IOCP support)
      Removed duplicate typedef TIME and replaced it with MYSQL_TIME
      
      Better (more complete) fix for: Bug#21103 "DATE column not compared as DATE"
      Fixed properly Bug#18997 "DATE_ADD and DATE_SUB perform year2K autoconversion magic on 4-digit year value"
      Fixed Bug#23093 "Implicit conversion of 9912101 to date does not match cast(9912101 as date)"
       
      
      
      include/my_time.h:
        Removed not used define YY_MAGIC_BELOW
        Added prototype for year_2000_handling()
      mysql-test/r/date_formats.result:
        Updated results (fixed bug in date_format() with year < 99
      mysql-test/r/func_sapdb.result:
        Added more testing of make_date()
      mysql-test/r/ps_2myisam.result:
        Now we get a note when we insert a datetime value into a date column
      mysql-test/r/ps_3innodb.result:
        Now we get a note when we insert a datetime value into a date column
      mysql-test/r/ps_4heap.result:
        Now we get a note when we insert a datetime value into a date column
      mysql-test/r/ps_5merge.result:
        Now we get a note when we insert a datetime value into a date column
      mysql-test/r/ps_7ndb.result:
        Now we get a note when we insert a datetime value into a date column
      mysql-test/r/strict.result:
        zero-year in str_to_date() throws warning in strict
      mysql-test/r/type_date.result:
        Added test for date conversions
      mysql-test/r/type_datetime.result:
        Added testcase for datetime to date conversion.
      mysql-test/t/date_formats.test:
        Added testing of dates < 200
      mysql-test/t/func_sapdb.test:
        More testing of makedate()
      mysql-test/t/type_date.test:
        Added test for date conversions
      mysql-test/t/type_datetime.test:
        Added testcase for datetime to date conversion
      sql/field.cc:
        Give note if we insert a datetime value in a date field
        Don't give notes if we are doing internal test conversions (like from convert_constant_item())
        More documentation (store functions can now return '3' to inform that the function did return a NOTE (not warning or error))
        Revert some changes in Field_newdate::store() to get more optimal code
        Field::set_warning() will now ignore notes if CHECK_FIELD_IGNORE is set.
        New parameters to make_truncated_value_warning()
      sql/field.h:
        Give note if we insert a datetime value in a date field
        Don't give notes if we are doing internal test conversions (like from convert_constant_item())
        More documentation (store functions can now return '3' to inform that the function did return a NOTE (not warning or error))
        Revert some changes in Field_newdate::store() to get more optimal code
        Field::set_warning() will now ignore notes if CHECK_FIELD_IGNORE is set.
        New parameters to make_truncated_value_warning()
      sql/item.cc:
        Give note if we insert a datetime value in a date field
        Don't give notes if we are doing internal test conversions (like from convert_constant_item())
        More documentation (store functions can now return '3' to inform that the function did return a NOTE (not warning or error))
        Revert some changes in Field_newdate::store() to get more optimal code
        Field::set_warning() will now ignore notes if CHECK_FIELD_IGNORE is set.
        New parameters to make_truncated_value_warning()
      sql/item.h:
        TIME -> MYSQL_TIME
      sql/item_cmpfunc.cc:
        Don't print notes in convert_constant_item()
      sql/item_func.h:
        TIME -> MYSQL_TIME
      sql/item_timefunc.cc:
        New parameters to make_truncated_value_warning()
        Moved year 2000 handling out from calc_days()
      sql/item_timefunc.h:
        TIME -> MYSQL_TIME
      sql/my_decimal.cc:
        TIME -> MYSQL_TIME
      sql/my_decimal.h:
        TIME -> MYSQL_TIME
      sql/mysql_priv.h:
        Added error level to make_truncated_value_warning()
      sql/protocol.cc:
        TIME -> MYSQL_TIME
      sql/protocol.h:
        TIME -> MYSQL_TIME
      sql/sp.cc:
        TIME -> MYSQL_TIME
      sql/sql_base.cc:
        Make testing of result value of save_in_field() uniform
      sql/sql_class.h:
        TIME -> MYSQL_TIME
      sql/sql_show.cc:
        TIME -> MYSQL_TIME
      sql/structs.h:
        TIME -> MYSQL_TIME
      sql/time.cc:
        Added error level to make_truncated_value_warning()
      sql/tztime.cc:
        TIME -> MYSQL_TIME
      sql/tztime.h:
        TIME -> MYSQL_TIME
      sql/unireg.cc:
        For default values to CREATE, don't give errors for warning level NOTE
        (Fixed failed CREATE when we give a datetime value to a date field)
      sql-common/my_time.c:
        Added year_2000_handling()
        Removed year 2000 handling from calc_daynr()
      b5e4f54a
  34. 15 May, 2007 1 commit
    • unknown's avatar
      Bug#28208: Wrong result of a non-const STRING function with a const DATETIME · 9aa67a40
      unknown authored
      function.
      
      A wrong  condition was used to check that the
      Arg_comparator::can_compare_as_dates() function calculated the value of the
      string constant. When comparing a non-const STRING function with a constant
      DATETIME function it leads to saving an arbitrary value as a cached value of
      the DATETIME function.
      
      Now the Arg_comparator::set_cmp_func() function initializes the const_value
      variable to the impossible DATETIME value (-1) and this const_value is
      cached only if it was changed by the Arg_comparator::can_compare_as_dates()
      function.
      
      
      mysql-test/t/type_datetime.test:
        Added a test case for the bug#28208: Wrong result of a non-const STRING function with a const DATETIME function.
      mysql-test/r/type_datetime.result:
        Added a test case for the bug#28208: Wrong result of a non-const STRING function with a const DATETIME function.
      sql/item_cmpfunc.cc:
        Bug#28208: Wrong result of a non-const STRING function with a const DATETIME
        function.
        Now the Arg_comparator::set_cmp_func() function initializes the const_value
        variable to the impossible DATETIME value (-1) and this const_value is
        cached only if it was changed by the Arg_comparator::can_compare_as_dates()
        function.
      9aa67a40