Commit graph

132 commits

Author SHA1 Message Date
unknown
665004c8e0 fix for bug #23938: ISNULL on DATE AND CAST AS DATE returns false for null values
Set null_value in case of wrong data.


mysql-test/r/cast.result:
  fix for bug #23938: ISNULL on DATE AND CAST AS DATE returns false for null values
    - test result.
mysql-test/t/cast.test:
  fix for bug #23938: ISNULL on DATE AND CAST AS DATE returns false for null values
    - test case.
sql/item_timefunc.cc:
  fix for bug #23938: ISNULL on DATE AND CAST AS DATE returns false for null values
    - set null_value in case of error.
2006-12-04 17:06:25 +04:00
unknown
89924c5874 Merge bk-internal.mysql.com:/home/bk/mysql-4.1-maint
into  polly.local:/home/kaa/src/maint/m41-maint--07OGk


sql/item_timefunc.cc:
  Auto merged
2006-10-11 17:19:19 +04:00
unknown
18b91b023d Cset exclude: Kristofer.Pettersson@naruto.|ChangeSet|20060922092201|15946
sql/item_timefunc.cc:
  Exclude
2006-10-11 13:42:48 +02:00
unknown
5623f2e9a6 Merge bk-internal.mysql.com:/home/bk/mysql-4.1-maint
into  polly.local:/home/kaa/src/maint/m41-maint--07OGk


sql/item_timefunc.cc:
  Auto merged
2006-10-11 14:57:09 +04:00
unknown
3baf203483 Merge polly.local:/tmp/maint/bug11655/my41-bug11655
into  polly.local:/home/kaa/src/maint/m41-maint--07OGk


sql/field.cc:
  Auto merged
sql/item_timefunc.cc:
  Auto merged
mysql-test/r/func_time.result:
  Manually merged
mysql-test/t/func_time.test:
  Manually merged
2006-10-11 14:55:23 +04:00
unknown
fedfd803ef Merge naruto.:C:/cpp/bug21811/my41-bug21811
into  naruto.:C:/cpp/mysql-4.1-maint


sql/item_timefunc.cc:
  Auto merged
2006-10-11 10:27:28 +02:00
unknown
634d3ff2c6 Fixes a number of problems with time/datetime <-> string conversion functions:
- bug #11655 "Wrong time is returning from nested selects - maximum time exists
- input and output TIME values were not validated properly in several conversion functions
- bug #20927 "sec_to_time treats big unsigned as signed"
- integer overflows were not checked in several functions. As a result, input values like 2^32 or 3600*2^32 were treated as 0
- BIGINT UNSIGNED values were treated as SIGNED in several functions
- in cases where both input string truncation and out-of-range TIME value occur, only 'truncated incorrect time value' warning was produced


include/my_time.h:
  Added defines for the TIME limits
  Added defines for the warning flags set by str_to_time() and check_time_range()
  Added check_time_range() declaration
mysql-test/r/func_sapdb.result:
  Fixed testcases which relied on incorrect TIMEDIFF() behaviour
mysql-test/r/func_time.result:
  Fixed testcase which relied on incorrect behaviour
  Added testcases for out-of-range values in SEC_TO_TIME(), TIME_TO_SEC(), ADDTIME(), SUBTIME() and EXTRACT()
mysql-test/t/func_time.test:
  Added testcases for out-of-range values in SEC_TO_TIME(), TIME_TO_SEC(), ADDTIME(), SUBTIME() and EXTRACT()
sql-common/my_time.c:
  Added check_time_range() to be used from str_to_time() and item_timefunc.cc
  Added new out-of-range flag to str_to_time() warnings
  Use '%u' instead of '%d' in my_*_to_str() because the arguments are unsigned
sql/field.cc:
  Replaced out-of-range checks with checks for flags returned by str_to_time()
sql/item_timefunc.cc:
  Added wrappers over make_datetime() and make_time() which perform out-of-range checks on input values
  Moved common code in Item_func_sec_to_time::val_str() and Item_func_sec_to_time::val_int() into a separate function sec_to_time()
  Replaced calls to make_datetime() with make_datetime_with_warn() in Item_func_add_time and Item_func_timediff
  Checks for 'unsigned int' overflows in Item_func_maketime
  Use make_time_with_warn() instead of make_time() in Item_func_maketime
  Fixed incorrect sizeof() in Item_func_str_to_date::get_time()
sql/time.cc:
  Check for return value of str_to_time() along with warning flags
2006-10-04 17:13:32 +04:00
unknown
9afa051a12 Merge bk-internal:/home/bk/mysql-4.1-maint
into  rama.(none):/home/jimw/my/mysql-4.1-clean


include/my_global.h:
  Auto merged
sql/item_subselect.cc:
  Auto merged
sql/item_timefunc.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/opt_range.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/slave.cc:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/mysqld.cc:
  Resolve conflict
2006-09-28 18:11:29 -07:00
unknown
e8cc98c87a Bug#21811 Odd casting with date + INTERVAL arithmetic
- The definition of the result type of a type_date function didn't
  include INTERVAL_WEEK
- This patch adds an explicit test for INTERVAL_WEEK which results 
  in the result type for an item_date_add_intervall operation 
  being DATE rather than DATETIME when one parameter is
  INTERVAL_WEEK.


sql/item_timefunc.cc:
  Added explicit test for INTERVAL_WEEK to evaluate as MYSQL_TYPE_DATE
2006-09-22 11:22:01 +02:00
unknown
915bdfbea8 Bug #2717: include/my_global.h mis-defines __attribute__
Fix when __attribute__() is stubbed out, add ATTRIBUTE_FORMAT() for specifying
  __attribute__((format(...))) safely, make more use of the format attribute,
  and fix some of the warnings that this turns up (plus a bonus unrelated one).


include/m_ctype.h:
  Add ATTRIBUTE_FORMAT to printf-like functions.
include/m_string.h:
  Add ATTRIBUTE_FORMAT to my_snprintf() declaration.
include/my_global.h:
  Fix neutering of __attribute__() on old versions of GCC and non-GCC compilers.
  Add ATTRIBUTE_FORMAT() macro for setting __attribute_((format(...)), since it
  is available from different versions of gcc and g++.
include/my_sys.h:
  Add ATTRIBUTE_FORMAT() to my_printf_error declaration
sql/item_subselect.cc:
  Silence warning about members being initialized out-of-order
sql/item_timefunc.cc:
  Fix format specifier in snprintf() calls with milliseconds
sql/mysql_priv.h:
  Add ATTRIBUTE_FORMAT to printf-like functions.
sql/mysqld.cc:
  Fix various format specifiers
  Make sure that method_conv is always set by myisam_stats_method
sql/opt_range.cc:
  Cast pointers to correct type for %lx
sql/set_var.cc:
  Fix __attribute__((unused)) (missing inner set of parens)
sql/slave.cc:
  Fix format specifier
sql/slave.h:
  Add ATTRIBUTE_FORMAT to slave_print_error() declaration.
sql/sql_acl.cc:
  Fix number of  arguments passed for formatting, and fix acl_host_or_ip being
  passed instead of just the hostname.
sql/sql_class.h:
  Add ATTRIBUTE_FORMAT to MYSQL_LOG::write().
2006-08-17 12:25:40 -07:00
unknown
fa1641e1f3 Bug#19844: time_format in Union truncates values
time_format() claimed %H and %k would return at most two digits
(hours 0-23), but this coincided neither with actual behaviour
nor with docs.  this is not visible in simple queries; forcing
a temp-table is probably the easiest way to see this.  adjusted
the return-length appropriately; the alternative would be to
adjust the docs to say that behaviour for > 99 hours is undefined.
---
Bug#19844: time_format in Union truncates values

time_format() claimed %H and %k would return at most two digits
(hours 0-23), but this coincided neither with actual behaviour
nor with docs.  this is not visible in simple queries; forcing
a temp-table is probably the easiest way to see this.  adjusted
the return-length appropriately; the alternative would be to
adjust the docs to say that behaviour for > 99 hours is undefined.


mysql-test/r/func_time.result:
  Bug#19844: time_format in Union truncates values
  
  show time_format() handles %H and %k correctly four > 99 hours
mysql-test/t/func_time.test:
  Bug#19844: time_format in Union truncates values
  
  show time_format() handles %H and %k correctly four > 99 hours
sql/item_timefunc.cc:
  Bug#19844: time_format in Union truncates values
  
  unbreak promises we make about field-length of %H and %k in
  time_format() so they coincide with the actual range rather
  than just 0..23. the docs say we must operate outside that
  range, so we'd better do it right.
  ---
  Bug#19844: time_format in Union truncates values
  
  unbreak promises we make about field-length of %H and %k in
  time_format() so they coincide with the actual range rather
  than just 0..23. the docs say we must operate outside that
  range, so we'd better do it right.
  One digit values are padded to two digits with %H, "longer"
  values are handled correctly up to seven digits including
  any sign.
  (clarified comments as per jimw's suggestion.)
2006-08-10 15:37:24 +02:00
unknown
d39e85320f Backporting Kostja's changes made for 5.0 into 4.1.
Please use "ul" when merging this changeset to 5.0.


sql/item_timefunc.cc:
  Fix a valgrind warning in type_date test.
sql/sql_locale.cc:
  Fix a Windows build failure:  "false" -> FALSE
2006-07-18 15:53:12 +05:00
unknown
184ff212b6 WL#2928 Date Translation NRE
(implemented by by Josh Chamas)


libmysqld/Makefile.am:
  Adding new source file
mysql-test/r/date_formats.result:
  Adding test case
mysql-test/t/date_formats.test:
  Adding test case
sql/Makefile.am:
  Adding new source file
BitKeeper/etc/ignore:
  Added libmysqld/sql_locale.cc to the ignore list
sql/item_timefunc.cc:
  Using current locale data, instead of hard coded English names.
sql/mysql_priv.h:
  Adding new type MY_LOCALE, and declaring new global variables.
sql/set_var.cc:
  Adding "lc_time_names" system variable.
sql/set_var.h:
  Adding "lc_time_names" system variable.
sql/sql_cache.cc:
  Adding lc_time_names as a query cache flag.
sql/sql_class.cc:
  Setting default locale to en_US
sql/sql_class.h:
  Adding locale variable into system_variables.
sql/sql_locale.cc:
  Adding new file with locale data for various languages
2006-07-04 17:40:40 +05:00
unknown
82d127b55b Dec. 31st, 9999 is still a valid date, only starting with Jan 1st 10000 things become invalid (Bug #12356)
mysql-test/r/func_sapdb.result:
  test cases for date range edge cases added
mysql-test/r/func_time.result:
  test cases for date range edge cases added
mysql-test/t/func_sapdb.test:
  test cases for date range edge cases added
mysql-test/t/func_time.test:
  test cases for date range edge cases added
2006-06-27 19:33:59 +04:00
unknown
d0f39b6aeb Manually merged
sql/item_timefunc.cc:
  Auto merged
sql/item_timefunc.h:
  Auto merged
2006-06-17 02:11:12 +04:00
unknown
47311e8e87 Fixed bug#16377: result of DATE/TIME functions were compared as strings which
can lead to a wrong result.

All date/time functions has the STRING result type thus their results are
compared as strings. The string date representation allows a user to skip 
some of leading zeros. This can lead to wrong comparison result if a date/time 
function result is compared to such a string constant.

The idea behind this bug fix is to compare results of date/time functions
and data/time constants as ints, because that date/time representation is 
more exact. To achieve this the agg_cmp_type() is changed to take in the
account that a date/time field or an date/time item should be compared 
as ints.

This bug fix is partially back ported from 5.0.

The agg_cmp_type() function now accepts THD as one of parameters. 
In addition, it now checks if a date/time field/function is present in the
list. If so, it tries to coerce all constants to INT to make date/time
comparison return correct result. The field for the constant coercion is
taken from the Item_field or constructed from the Item_func. In latter case
the constructed field will be freed after conversion of all constant items.
Otherwise the result is same as before - aggregated with help of the
item_cmp_type() function.

From the Item_func_between::fix_length_and_dec() function removed the part
which was converting date/time constants to int if possible. Now this is 
done by the agg_cmp_type() function.

The new function result_as_longlong() is added to the Item class. 
It indicates that the item is a date/time item and result of it can be
compared as int. Such items are date/time fields/functions.

Correct val_int() methods are implemented for classes Item_date_typecast, 
Item_func_makedate, Item_time_typecast, Item_datetime_typecast. All these
classes are derived from Item_str_func and Item_str_func::val_int() converts
its string value to int without regard to the date/time type of these items.

Arg_comparator::set_compare_func() and Arg_comparator::set_cmp_func()
functions are changed to substitute result type of an item with the INT_RESULT
if the item is a date/time item and another item is a constant. This is done
to get a correct result of comparisons like date_time_function() = string_constant.


mysql-test/r/cast.result:
  Fixed wrong test case result after bug fix#16377.
sql/item_timefunc.h:
  Fixed bug#16377: result of DATE/TIME functions were compared as strings which
  can lead to a wrong result.
  The result_as_longlong() function is set to return TRUE for these classes:
  Item_date, Item_date_func, Item_func_curtime, Item_func_sec_to_time,
  Item_date_typecast, Item_time_typecast, Item_datetime_typecast,
  Item_func_makedate.
sql/item_timefunc.cc:
  Fixed bug#16377: result of DATE/TIME functions were compared as strings which
  can lead to a wrong result.Correct val_int() methods are implemented for classes Item_date_typecast, 
  Item_func_makedate, Item_time_typecast, Item_datetime_typecast.
sql/item_cmpfunc.h:
  Fixed bug#16377: result of DATE/TIME functions were compared as strings which
  can lead to a wrong result.
  Arg_comparator::set_compare_func() and Arg_comparator::set_cmp_func()
  functions are changed to substitute result type of an item with the INT_RESULT
  if the item is a date/time item and another item is a constant.
sql/field.cc:
  Fixed bug#16377: result of DATE/TIME functions were compared as strings which
  can lead to a wrong result.
  Field::set_warning(), Field::set_datetime_warning() now use current_thd to get thd if table isn't set.
sql/item_cmpfunc.cc:
  Fixed bug#16377: result of DATE/TIME functions were compared as strings which
  can lead to a wrong result.
  The agg_cmp_type() function now accepts THD as one of parameters. 
  In addition, it now checks if a date/time field/function is present in the
  list. If so, it tries to coerce all constants to INT to make date/time
  comparison return correct result. The field for the constant coercion is
  taken from the Item_field or constructed from the Item_func. In latter case
  the constructed field will be freed after conversion of all constant items.
  Otherwise the result is same as before - aggregated with help of the
  item_cmp_type() function.
sql/item.h:
  The new function result_as_longlong() is added to the Item class. 
  It indicates that the item is a date/time item and result of it can be
  compared as int. Such items are date/time fields/functions.
mysql-test/t/func_time.test:
  Added test case fot bug#16377: result of DATE/TIME functions were compared as strings which
  can lead to a wrong result.
mysql-test/r/func_time.result:
  Added test case fot bug#16377: result of DATE/TIME functions were compared as strings which
  can lead to a wrong result.
2006-06-13 19:09:24 +04:00
unknown
f1b1c0eb3f Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.1
into  mysql.com:/usr/home/ram/work/4.1.b16546


sql/item_timefunc.cc:
  Auto merged
mysql-test/r/func_time.result:
  merging
mysql-test/t/func_time.test:
  merging
2006-06-06 09:10:28 +05:00
unknown
3f73225669 Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.1
into  mysql.com:/usr/home/ram/work/4.1.b18501


sql/item_timefunc.cc:
  Auto merged
2006-05-10 13:27:48 +05:00
unknown
02dcc76e37 Fixed Bug#11324:
TIME_FORMAT using "%l:%i" returns 36:00 with 24:00:00 in TIME column


mysql-test/r/date_formats.result:
  Added test case for Bug#11324,
  "TIME_FORMAT using "%l:%i" returns 36:00 with 24:00:00 in TIME column"
mysql-test/t/date_formats.test:
  Added test case for Bug#11324,
  "TIME_FORMAT using "%l:%i" returns 36:00 with 24:00:00 in TIME column"
2006-05-04 20:19:37 +03:00
unknown
bcb61e6860 Fix for Bug#11326.
mysql-test/r/date_formats.result:
  Added test cases for Bug#11326
mysql-test/t/date_formats.test:
  Added test cases for Bug#11326
2006-05-04 19:31:10 +03:00
unknown
409fb4895f Fix for bug #16546: DATETIME+0 not always coerced the same way
mysql-test/r/func_time.result:
  Fix for bug #16546: DATETIME+0 not always coerced the same way
    - test case
mysql-test/t/func_time.test:
  Fix for bug #16546: DATETIME+0 not always coerced the same way
    - test case
sql/item_timefunc.cc:
  Fix for bug #16546: DATETIME+0 not always coerced the same way
    - set decimals to DATETIME_DEC
sql/item_timefunc.h:
  Fix for bug #16546: DATETIME+0 not always coerced the same way
    - set decimals to DATETIME_DEC
2006-05-02 18:00:44 +05:00
unknown
3ca1852cba Fix for bug #18501: Server crashes with monthname().
mysql-test/r/func_time.result:
  Fix for bug #18501: Server crashes with monthname().
    - test case
mysql-test/t/func_time.test:
  Fix for bug #18501: Server crashes with monthname().
    - test case
sql/item_timefunc.cc:
  Fix for bug #18501: Server crashes with monthname().
    - check null_value as well.
2006-04-25 14:34:19 +05:00
unknown
5c0c1dcc3d Bug#18691: Converting number to UNICODE string returns invalid result.
Conversion from int and real numbers to UCS2 didn't work fine: 
CONVERT(100, CHAR(50) UNICODE)
CONVERT(103.9, CHAR(50) UNICODE)

The problem appeared because numbers have binary charset, so,
simple charset recast binary->ucs2 was performed
instead of real conversion.

Fixed to make numbers pretend to be non-binary.


mysql-test/r/ctype_ucs.result:
  Adding test case
mysql-test/t/ctype_ucs.test:
  Adding test case
sql/item_timefunc.cc:
  Adding new member from_cs, to replace my_charset_bin
  to a non-binary charset when converting from numbers to UCS2
sql/item_timefunc.h:
  Adding new member from_cs, to replace my_charset_bin
  to a non-binary charset when converting from numbers to UCS2
2006-04-13 10:55:48 +05:00
unknown
e5f077f79a date_formats.test:
fix for bug #15828 after review
  doing val_str now before testing of null value secures the function for null values returned by dynamic functions - the fix before was incomplete andy covered constant null values


mysql-test/t/date_formats.test:
  fix for bug #15828 after review
  doing val_str now before testing of null value secures the function for null values returned by dynamic functions - the fix before was incomplete andy covered constant null values
2006-01-16 15:46:37 +01:00
unknown
37b104b8ec item_timefunc.cc:
fix for bug #15828 after review


sql/item_timefunc.cc:
  fix for bug #15828 after review
2006-01-14 16:06:51 +01:00
unknown
f36a0feed7 item_timefunc.cc:
fix for bug#15828 after review


sql/item_timefunc.cc:
  fix for bug#15828 after review
2006-01-14 09:53:12 +01:00
unknown
25e32d83d6 fix for bug#15828
problem was not checking 2nd parameter of str_to_date against NULL


mysql-test/r/date_formats.result:
  bk commit
2006-01-13 14:42:46 +01:00
unknown
fffe741705 Review of new pushed code
Removed wrong fix for bug #14009 (use of abs() on null value causes problems with filesort)
Mark that add_time(), time_diff() and str_to_date() can return null values


myisam/mi_check.c:
  keyoffset is not a position (no %lx here)
mysql-test/r/func_sapdb.result:
  Fixed test after marking that timediff() can return NULL
sql/item_func.cc:
  Removed wrong fix for bug #14009 (use of abs() on null value causes problems with filesort)
sql/item_timefunc.cc:
  Mark that add_time and str_to_date() can return null values
sql/item_timefunc.h:
  Mark that time_diff can return 0
sql/spatial.cc:
  Simple cleanups during review of new code
2005-11-01 13:00:02 +02:00
unknown
b96dbef6fd Fix bug #14016 date_format() 2nd parameter was compared using case insensitive
collation

By default constant strings in second parameter of date_time() have case
insensitive collation. Because of this expressions date_format(f,'%m') and 
date_format(f,'%M') wrongly becomes equal, which results in choosing wrong 
column to sort by.

Now if second parameter of date_format() is constant then it's collation is 
changed to case sensitive.


sql/item_timefunc.cc:
  Fix bug #14016 date_format() 2nd parameter was compared using case insensitive collation.
  If second parameter of date_format() is constant then it's collation is changed to case sensitive.
mysql-test/r/date_formats.result:
  Test case for bug#14016 2nd parameter was compared using case insensitive collation
mysql-test/t/date_formats.test:
  Test case for bug#14016 2nd parameter was compared using case insensitive collation
2005-10-25 20:37:26 +04:00
unknown
3a31f7b91f Simple fixes during review of new code
include/my_global.h:
  Added floatget() to read unaligned flaot
mysql-test/r/select.result:
  Added test for found_rows()
mysql-test/t/select.test:
  Added test for found_rows()
sql/des_key_file.cc:
  Moved initalization of LOCK_des_key_file to mysqld to make simpler code and avoid theoretical race condition
sql/field_conv.cc:
  Added optimizzed varsion of do_cut_string (for simple character sets)
sql/item_func.cc:
  Simplify code (and ensure DBUG_ENTER is excuted before main code)
sql/item_strfunc.cc:
  Safe calculation of max_length
  This was needed as max_length can now be 1<<32-1 (after konstantins recent patch to fix BLOB_LENGTH)
  Remove init_des_key_file() as this is not initialized in mysqld.cc
sql/item_timefunc.cc:
  Safe calculation of max_length
  This was needed as max_length can now be 1<<32-1 (after konstantins recent patch to fix BLOB_LENGTH)
sql/log_event.cc:
  Simplify code
sql/mysql_priv.h:
  Moved initalization of LOCK_des_key_file to mysqld to make simpler code and avoid theoretical race condition
sql/mysqld.cc:
  Moved initalization of LOCK_des_key_file to mysqld to make simpler code and avoid theoretical race condition
  Revert wrong patch of calling close_connection() in first close_connections() loop. (Bug #7403)
  Instead we now print a warning for closed connections only if mysqld is sarted with --warnings
  Added comments to make the close_connections() logic clearer
sql/sql_prepare.cc:
  Use floatget() and doubleget() to protect against unaligned data
sql/sql_select.cc:
  Fixed some cases unlikely cases where found_rows() would return wrong for queries that would return 0 or 1 rows
2005-07-19 19:25:05 +03:00
unknown
5aa793f72b backport for #10568: Function 'LAST_DAY(date)' does not return NULL for invalid argument. 2005-06-24 14:04:48 +05:00
unknown
062a1b8b4e a compiler must see '#pragma implementation' *before*
'#pragma interface' (that comes with the #include'd header file)
2005-06-05 19:38:52 +02:00
unknown
72dd44b9de Move USE_PRAGMA_IMPLEMENTATION to proper place
Ensure that 'null_value' is not accessed before val() is called in FIELD() functions
Fixed initialization of key maps. This fixes some problems with keys when you have more than 64 keys
Fixed that ROLLUP don't always create a temporary table. This fix ensures that func_gconcat.test results are now predictable


mysql-test/r/func_gconcat.result:
  Move innodb specific test to innodb.test
  Changed table name r2 -> t2
  More test to see how ROLLUP was optimized
mysql-test/r/innodb.result:
  Moved test here form func_gconcat
mysql-test/r/olap.result:
  New test results after optimization
mysql-test/t/func_gconcat.test:
  Move innodb specific test to innodb.test
  Changed table name r2 -> t2
  More test to see how ROLLUP was optimized
mysql-test/t/innodb.test:
  Moved test here form func_gconcat
sql/field.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/ha_berkeley.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/ha_blackhole.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/ha_heap.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/ha_innodb.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/ha_isam.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/ha_isammrg.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/ha_myisam.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/ha_myisammrg.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/ha_ndbcluster.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/handler.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/hash_filo.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/item.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/item_cmpfunc.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/item_func.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
  Ensure that 'null_value' is not accessed before val() is called
sql/item_geofunc.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/item_strfunc.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/item_subselect.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/item_sum.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/item_timefunc.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/item_uniq.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/log_event.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/mysql_priv.h:
  Change key_map_full to not be const as we are giving it a proper value on startup
sql/mysqld.cc:
  Move key_map variables here and initialize key_map_full properly
sql/opt_range.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/opt_range.h:
  Fix that test_quick_select() works with any ammount of keys
sql/procedure.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/protocol.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/protocol_cursor.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/set_var.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/sql_analyse.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/sql_class.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/sql_crypt.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/sql_insert.cc:
  Fixed that max_rows is ulong
sql/sql_list.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/sql_map.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/sql_olap.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/sql_select.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
  Fixed that ROLLUP don't have to always create a temporary table
  Added new argument to remove_const() to make above possible
  Fixed some errors that creapt up when we don't always do a temporary table for ROLLUP
sql/sql_string.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/sql_table.cc:
  Simple optimizations
  Fixed wrong checking of build_table_path() in undef-ed code
sql/sql_udf.cc:
  Move USE_PRAGMA_IMPLEMENTATION to proper place
sql/sql_yacc.yy:
  removed extra {}
2005-06-03 23:46:03 +03:00
unknown
cee10f979e tztime.cc:
Set #pragma implementation" earlier
Many files:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION


client/sql_string.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
mysys/raid.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/field.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/ha_berkeley.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/ha_blackhole.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/ha_heap.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/ha_innodb.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/ha_isam.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/ha_isammrg.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/ha_myisam.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/ha_myisammrg.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/ha_ndbcluster.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/handler.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/hash_filo.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/item.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/item_cmpfunc.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/item_func.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/item_geofunc.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/item_strfunc.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/item_subselect.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/item_sum.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/item_timefunc.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/item_uniq.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/log_event.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/opt_range.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/procedure.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/protocol.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/protocol_cursor.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/set_var.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/sql_analyse.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/sql_class.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/sql_crypt.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/sql_list.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/sql_map.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/sql_olap.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/examples/ha_archive.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/sql_select.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/sql_string.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/sql_udf.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/examples/ha_example.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/examples/ha_tina.cc:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
sql/tztime.cc:
  Set #pragma implementation" earlier
2005-06-02 02:43:32 +02:00
unknown
22944a9563 Add ifdefs to control when "#pragma implementation" should be used
Added some more ifdefs for "#pragma interface"


client/sql_string.cc:
  USE_PRAGMA_IMPLEMENTATION
client/sql_string.h:
  USE_PRAGMA_INTERFACE
include/my_global.h:
  Use pragma implementation for gcc pre version 3
mysys/raid.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/field.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/ha_berkeley.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/ha_blackhole.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/ha_heap.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/ha_innodb.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/ha_isam.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/ha_isammrg.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/ha_myisam.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/ha_myisammrg.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/ha_ndbcluster.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/handler.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/hash_filo.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/item.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/item_cmpfunc.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/item_func.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/item_geofunc.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/item_strfunc.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/item_subselect.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/item_sum.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/item_timefunc.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/item_uniq.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/item_uniq.h:
  USE_PRAGMA_INTERFACE
sql/log_event.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/log_event.h:
  USE_PRAGMA_INTERFACE
sql/opt_range.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/procedure.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/protocol.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/protocol_cursor.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/set_var.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/sql_analyse.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/sql_analyse.h:
  USE_PRAGMA_INTERFACE
sql/sql_class.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/sql_crypt.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/sql_crypt.h:
  USE_PRAGMA_IMPLEMENTATION
sql/sql_list.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/sql_map.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/sql_map.h:
  USE_PRAGMA_INTERFACE
sql/sql_olap.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/sql_select.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/sql_string.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/sql_udf.cc:
  USE_PRAGMA_IMPLEMENTATION
sql/tztime.cc:
  USE_PRAGMA_IMPLEMENTATION
2005-05-26 12:09:14 +02:00
unknown
b0d05dd9a3 Fix for func_sapdb failures on 64-bit platforms (aka Bug #10040
"'func_sapdb' fails on 64bit build hosts")


sql/item_timefunc.cc:
  calc_time_diff():
    Fixed yet another signedness problem.
2005-04-25 11:25:40 +04:00
unknown
fee4b2c271 Fix for bug #8068 "TIMEDIFF with first negative argument gives wrong
result" (and similar bug in ADDTIME/SUBTIME).

Both Item_func_add_time/Item_func_timediff::val_str() now use
calc_time_diff() function which was backported from 5.0 (and which
was was fixed to properly handle microseconds part of its second 
argument). Also now we correctly set sign of result in case when
first argument is negative and second is positive.  


mysql-test/r/func_sapdb.result:
  Added test for bug #8068 "TIMEDIFF with first negative argument gives wrong 
  result".
mysql-test/t/func_sapdb.test:
  Added test for bug #8068 "TIMEDIFF with first negative argument gives wrong 
  result".
sql/item_timefunc.cc:
  - Backported calc_time_diff() function from 5.0 tree. Changed it to
    accept time value as its second argument when its first argument
    is datetime value. Fixed wrong handling of microsecond part of
    second argument.
  - Item_func_add_time::val_str()/Item_func_timediff::val_str()
    Removed similar pieces of code calculating difference 
    between two datetime values (or their sum) in microseconds.
    Now we use calc_time_diff() function instead. 
    Also now we correctly set sign of result in case when first 
    argument is negative and second is positive.
2005-03-28 16:20:55 +04:00
unknown
bf89dc063a Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/dlenev/src/mysql-4.1-tzbug


sql/item_timefunc.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/tztime.cc:
  Auto merged
2005-01-28 09:32:43 +03:00
unknown
199a139da1 item_timefunc.cc:
CAST now always return a well-formed character string.


sql/item_timefunc.cc:
  CAST now always return a well-formed character string.
2005-01-27 14:51:16 +04:00
unknown
20bd0bd6fd Fix for bug #7899 "CREATE TABLE .. SELECT .. and CONVERT_TZ() function
does not work well together". Now using simplier and more correct
implementation of st_lex::unlink_first_table()/link_first_table_back() 
(It also nicely handles case when global table list is created because
of implictly used time zone tables). (2nd attempt)

Fix for bug #7705 "CONVERT_TZ() crashes with subquery/WHERE on index
column". Implemented new approach for caching objects for constant
time zone arguments. Now instead of determining whenever these arguments
are constants and performing time zone lookup at fix_fields() stage, we
do it on first get_date() invocation.

Cleanup of global @@time_zone variable handling.


mysql-test/r/timezone2.result:
  Added test for bugs #7705 "CONVERT_TZ() crashes with subquery/WHERE on
  index column" and #7899 "CREATE TABLE .. SELECT .. and CONVERT_TZ()
  function does not work well together".
mysql-test/t/timezone2.test:
  Added test for bugs #7705 "CONVERT_TZ() crashes with subquery/WHERE on
  index column" and #7899 "CREATE TABLE .. SELECT .. and CONVERT_TZ()
  function does not work well together".
sql/item_timefunc.cc:
  Item_func_convert_tz():
    New approach for caching objects for constant time zone arguments.
    Now instead of determining whenever these arguments are constants
    and performing time zone lookup at fix_fields() stage, we do it
    on first get_date() invocation. This works better in cases when 
    const_item() for these arguments returns true only on get_date()
    stage but not on fix_fields() stage (e.g. this happens in quries
    with joins or derived tables).
sql/item_timefunc.h:
  Item_func_convert_tz():
    Added from_tz_cached/to_tz_cached members indicating whenever we
    already have Time_zone object representing one of constant time zone
    arguments.
sql/set_var.cc:
  Cleaned up global @@time_zone variable handling. Now we use proper
  locking when we are setting or reading its value.
sql/set_var.h:
  Removed declaration of sys_var_thd_time_zone::get_tz_ptr() method, which
  no longer used.
sql/sql_lex.cc:
  st_lex::unlink_first_table(), st_lex::link_first_table_back():
   Simplify implementation according to Monty's suggestion.
   Instead doing something special if global and local table lists
   are the same, we simply save/restore pointers to first elements
   of both global and local lists (which works even when this lists
   are the same!). This handles nicely the case when we have separate
   global table list becuase time zone tables are implicitly used.
sql/tztime.cc:
  Backport of Monty's fixes from 5.0, which give us nicer error messages
  if we haven't found time zone with such name or its description.
2005-01-26 22:25:02 +03:00
unknown
8bdb500105 fixes/cleanups according to Coverity report 2005-01-24 15:48:25 +01:00
unknown
d853e732b9 Fix for bug #7586 "TIMEDIFF for sec+microsec not working properly".
mysql-test/r/func_sapdb.result:
  Added test for bug #7586 "TIMEDIFF for sec+microsec not working
  properly". Corrected previously wrong results of couple other
  statements.
mysql-test/t/func_sapdb.test:
  Added test for bug #7586 "TIMEDIFF for sec+microsec not working
  properly".
sql/item_timefunc.cc:
  Item_func_timediff::val_str():
   Use simplier and less error-prone implementation. Now we are counting 
   difference between time values in microseconds and convert it to time
   value (instead of using seconds and taking difference in "second_part"s 
   into account).
2005-01-12 12:18:36 +03:00
unknown
0e302f5e8b Merged fixes for bug #7297 "Two digit year should be interpreted
correctly even with zero month and day" and bug #7515 "from_unixtime(0)
now returns NULL instead of the Epoch" into 4.1 tree.


mysql-test/r/ps_2myisam.result:
  Updated test result after merging fix for bug #7297 "Two digit year should
  be interpreted correctly even with zero month and day" into 4.1
mysql-test/r/ps_3innodb.result:
  Updated test result after merging fix for bug #7297 "Two digit year should
  be interpreted correctly even with zero month and day" into 4.1
mysql-test/r/ps_4heap.result:
  Updated test result after merging fix for bug #7297 "Two digit year should
  be interpreted correctly even with zero month and day" into 4.1
mysql-test/r/ps_5merge.result:
  Updated test result after merging fix for bug #7297 "Two digit year should
  be interpreted correctly even with zero month and day" into 4.1
mysql-test/r/ps_6bdb.result:
  Updated test result after merging fix for bug #7297 "Two digit year should
  be interpreted correctly even with zero month and day" into 4.1
mysql-test/r/ps_7ndb.result:
  Updated test result after merging fix for bug #7297 "Two digit year should
  be interpreted correctly even with zero month and day" into 4.1
sql-common/my_time.c:
  Merged fix for bug #7297 "Two digit year should be interpreted correctly
  even with zero month and day" into 4.1
sql/item_timefunc.cc:
  Small fix after merging patch solving bug #7515 "from_unixtime(0) now
  returns NULL instead of the Epoch" into 4.1.
2004-12-30 23:44:42 +03:00
unknown
e107535fa2 Manual merge of fix for bugs of #7297 and #7515 into 4.1 tree.
mysql-test/r/func_time.result:
  Manual merge.
mysql-test/r/type_datetime.result:
  Manual merge.
mysql-test/t/func_time.test:
  Manual merge.
mysql-test/t/type_datetime.test:
  Manual merge.
sql/item_timefunc.cc:
  Manual merge.
sql/item_timefunc.h:
  Manual merge.
sql/time.cc:
  Manual merge.
2004-12-30 21:37:32 +03:00
unknown
1ffd688a4a Fix for bug #7515 "from_unixtime(0) now returns NULL instead of
the Epoch". (With after review fixes).


mysql-test/r/func_time.result:
  Added test for bug #7515 "from_unixtime(0) now returns NULL instead of
  the Epoch".
mysql-test/t/func_time.test:
  Added test for bug #7515 "from_unixtime(0) now returns NULL instead of
  the Epoch".
sql/item_timefunc.cc:
  Item_func_from_unixtime:
   from_unixtime(0) should return Epoch instead of NULL.
sql/item_timefunc.h:
  Item_func_from_unixtime:
   - Removed unused method definition.
   - fix_length_and_dec() should set maybe_null to true since now
     from_unixtime() can return NULL even in case when none of its
     arguments is NULL.
2004-12-30 21:18:10 +03:00
unknown
1382df5aff Fix for bug #6914 "Problems using time()/date() output in expressions".
When we cast datetime value to DATE (TIME) type we should throw away its
time (date) part. This was not done properly if CAST() function was used
in datetime expressions.


mysql-test/r/cast.result:
  Added test for bug #6914 "Problems using time()/date() output in
  expressions".
mysql-test/t/cast.test:
  Added test for bug #6914 "Problems using time()/date() output in
  expressions".
sql/item_timefunc.cc:
  Item_time_typecast::get_time()/Item_date_typecast::get_date():
    When we cast datetime value to DATE we should throw away its time part.
    When we cast such value to TIME type we should throw away its date part.
2004-12-30 13:39:01 +03:00
unknown
0ed3eb41a0 Fix for bug #7458 "Microseconds are gobbled from the string result of
STR_TO_DATE() function if there is another format specifier after %f 
in format string". Also small cleanup of STR_TO_DATE() implementation.
(After review version.)


mysql-test/r/date_formats.result:
  Added test for small bug in STR_TO_DATE() implementation which caused
  microseconds to be gobbled from string result of this function, if
  there was another specifier after %f in format string.
mysql-test/t/date_formats.test:
  Added test for small bug in STR_TO_DATE() implementation which caused
  microseconds to be gobbled from string result of this function, if
  there was another specifier after %f in format string.
sql/item_timefunc.cc:
  Small cleanup of str_to_date() implementation.
    Renamed check_result_type() to less ambigous get_date_time_result_type()
    and made it static. Also added handling of %X,%x,%V,%v to this function.
    Fixed small bug in it which caused microseconds to be gobbled if there
    was some other specifiers after %f.
    Cleaned up comments a bit.
2004-12-22 18:58:25 +03:00
unknown
7c0504ad17 Manual merge of fix for bug #6439 "from_unixtime() function returns
wrong datetime values for too big argument" from 4.0 tree to 4.1 tree.


mysql-test/r/func_time.result:
  Manual merge
mysql-test/t/func_time.test:
  Manual merge
sql/item_timefunc.cc:
  Manual merge
2004-11-19 19:19:45 +03:00
unknown
e1509cf781 Proposed fix for bug #6439 "from_unixtime() function returns wrong datetime
values for too big argument".

Added range checking for from_unixtime() argument, cleaned up code 
a bit.


mysql-test/r/func_time.result:
  Test for bug #6439 "from_unixtime() function returns wrong datetime 
  values for too big argument".
mysql-test/t/func_time.test:
  Test for bug #6439 "from_unixtime() function returns wrong datetime 
  values for too big argument".
sql/item_timefunc.cc:
  Item_func_from_unixtime: 
    Added error range checking for function argument + small code clean up.
2004-11-15 16:11:13 +03:00
unknown
a9c7e3179c Fix for valgrind/purify for variables that the compiler touches but that doesn't affect the outcome of the tests 2004-11-09 14:46:26 +02:00