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.
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
- 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
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
- 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
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().
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.)
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
(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
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
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.
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
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"
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
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.
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
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
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
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
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
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 {}
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
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.
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
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.
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).
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.
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.
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.
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.
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
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.