Commit graph

121 commits

Author SHA1 Message Date
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
unknown
435b20aa68 Simpler arena swapping code
Now thd->mem_root is a pointer to thd->main_mem_root and THR_MALLOC is a pointer to thd->mem_root.
This gives us the following benefits:
- Allow us to easily detect if arena has already been swapped before (this fixes a bug in setup_conds() where arena was swaped twice in some cases)
- Faster swaps of arenas (as we don't have to copy the whole MEM_ROOT)
- We don't anymore have to call my_pthread_setspecific_ptr(THR_MALLOC,...) to change where memory is alloced. Now it's enough to set thd->mem_root



client/mysqltest.c:
  Remove some not needed defines
  (Things like this should be done in config-win.h)
include/config-win.h:
  Added popen() and pclose() compatibility macros
mysql-test/t/rpl_failed_optimize-master.opt:
  Portability fix
sql/ha_berkeley.cc:
  New thd->memroot handling
sql/item_cmpfunc.cc:
  Simpler arena swapping code
sql/item_func.cc:
  Simpler arena swapping code
sql/item_subselect.cc:
  Simpler arena swapping code
  New thd->mem_root handling
sql/item_sum.cc:
  New thd->mem_root handling
sql/item_timefunc.cc:
  Fixed not-initalized usage errors found by valgrind
sql/log_event.cc:
  New thd->mem_root handling
sql/mysql_priv.h:
  New thd->mem_root handling
sql/mysqld.cc:
  New thd->mem_root handling
sql/opt_range.cc:
  New thd->mem_root handling
sql/repl_failsafe.cc:
  New thd->mem_root handling
sql/set_var.cc:
  New thd->mem_root handling
sql/sql_acl.cc:
  New thd->mem_root handling
sql/sql_base.cc:
  Simpler arena swapping code
  New thd->mem_root handling
sql/sql_class.cc:
  New thd->mem_root handling
sql/sql_class.h:
  Simpler arena swapping code
  New thd->mem_root handling
sql/sql_db.cc:
  New thd->mem_root handling
sql/sql_error.cc:
  New thd->mem_root handling
sql/sql_help.cc:
  New thd->mem_root handling
sql/sql_insert.cc:
  New thd->mem_root handling
sql/sql_parse.cc:
  New thd->mem_root handling
  Added some extra checking of return value of new
sql/sql_prepare.cc:
  New thd->mem_root handling
sql/sql_select.cc:
  New thd->mem_root handling
sql/sql_select.h:
  New thd->mem_root handling
sql/sql_union.cc:
  Simpler arena swapping code
sql/sql_yacc.yy:
  New thd->mem_root handling
sql/table.cc:
  New thd->mem_root handling
sql/thr_malloc.cc:
  New thd->mem_root handling
tests/client_test.c:
  Added drop table to some tests
  Changed some table names to 't1'
2004-11-08 01:13:54 +02:00
unknown
6e781e11a9 A fix according to Monty's request:
"uint *errors" is now a non-optional parameter in String:copy()
and copy_and_convert().
2004-10-29 17:00:39 +05:00
unknown
712326d684 Bug#6202: ENUMs are not case sensitive even if declared BINARY 2004-10-25 17:51:26 +05:00
unknown
9aefc403f9 A fix and test case for Bug#6049 "Loss of sign when using prepared
statements and negative time/date values". 
The bug was in wrong sprintf format used in the client library.
The fix moves TIME -> string conversion functions to sql-common and
utilized them in the client library.


include/my_time.h:
  Declarations for new functions shared between the client and server.
libmysql/libmysql.c:
  Fix for Bug#6049 "Loss of sign when using prepared statements and negative
  time/date values": use the same function as the server to convert
  date/time/datetime values to strings.
sql-common/my_time.c:
  Implementation of my_{time,datetime,date,TIME}_to_str: it's
  needed by the client library, so it should be shared.
sql/field.cc:
  Don't create String object if it's not needed.
sql/item.cc:
  Don't create String object if it's not needed: TIME_to_string was
  moved to my_TIME_to_str, with different arguments.
sql/item_timefunc.cc:
  Don't create String object if it's not needed.
sql/mysql_priv.h:
  TIME_to_string and MAX_DATE_REP_LENGTH moved to the client library.
  MAX_DATE_REP_LENGTH was renamed to MAX_DATE_STRING_REP_LENGTH to not 
  conflict with the same name in libmysql.c
sql/protocol.cc:
  Don't create String object if it's not needed.
sql/time.cc:
  Implementation of my_{time,date,datetime,TIME}_to_str moved to my_time.c
  shared between the client and the server.
tests/client_test.c:
  A test case for Bug#6049.
2004-10-16 00:12:59 +04:00
unknown
7b51154461 Support for TIMESTAMP columns holding NULL values. Unlike all other
column types TIMESTAMP is NOT NULL by default, so in order to have 
TIMESTAMP column holding NULL valaues you have to specify NULL as
one of its attributes (this needed for backward compatibility).

Main changes:
Replaced TABLE::timestamp_default_now/on_update_now members with
TABLE::timestamp_auto_set_type flag which is used everywhere
for determining if we should auto-set value of TIMESTAMP field 
during this operation or not. We are also use Field_timestamp::set_time()
instead of handler::update_timestamp() in handlers.


mysql-test/r/type_timestamp.result:
  Added test for TIMESTAMP columns which are able to store NULL values.
mysql-test/t/type_timestamp.test:
  Added test for TIMESTAMP columns which are able to store NULL values.
sql/field.cc:
  Added support for TIMESTAMP fields holding NULL values.
  We don't need Field_timestamp::set_timestamp_offsets() anymore.
  Instead we need Field_timestamp::get_auto_set_type() function
  which will convert TIMESTAMP auto-set type stored in Field in 
  unireg_check to value from timestamp_auto_set_type_enum.
  (We can't replace this function with additional Field_timestamp member
  and some code in constructor because then we will have troubles
  with Field::new_field() method).
  We should also set field to not null in Field_timestamp::set_time() now.
sql/field.h:
  Added support for TIMESTAMP fields holding NULL values.
  We don't need Field_timestamp::set_timestamp_offsets() anymore.
  Instead we need Field_timestamp::get_auto_set_type() function,
  which will convert TIMESTAMP auto-set type stored in Field in 
  unireg_check to value from timestamp_auto_set_type_enum.
  We also have to support NULL values in Field_timestamp::get_timestamp()
  function.
sql/field_conv.cc:
  Added comment clarifying behavior in case of TIMESTAMP fields which are
  able to store NULL values.
sql/ha_berkeley.cc:
  Now we use TABLE::timestamp_field_type instead of 
  TABLE::timestamp_default_now/on_update_now for determining 
  if we should auto-set value of TIMESTAMP field during this operation.
  We are also use Field_timestamp::set_time() instead of 
  handler::update_timestamp().
sql/ha_heap.cc:
  Now we use TABLE::timestamp_field_type instead of 
  TABLE::timestamp_default_now/on_update_now for determining 
  if we should auto-set value of TIMESTAMP field during this operation.
  We are also use Field_timestamp::set_time() instead of 
  handler::update_timestamp().
sql/ha_innodb.cc:
  Now we use TABLE::timestamp_field_type instead of 
  TABLE::timestamp_default_now/on_update_now for determining 
  if we should auto-set value of TIMESTAMP field during this operation.
  We are also use Field_timestamp::set_time() instead of 
  handler::update_timestamp().
sql/ha_isam.cc:
  Now we use TABLE::timestamp_field_type instead of 
  TABLE::timestamp_default_now/on_update_now for determining 
  if we should auto-set value of TIMESTAMP field during this operation.
  We are also use Field_timestamp::set_time() instead of 
  handler::update_timestamp().
sql/ha_isammrg.cc:
  Now we use TABLE::timestamp_field_type instead of 
  TABLE::timestamp_default_now/on_update_now for determining 
  if we should auto-set value of TIMESTAMP field during this operation.
  We are also use Field_timestamp::set_time() instead of 
  handler::update_timestamp().
sql/ha_myisam.cc:
  Now we use TABLE::timestamp_field_type instead of 
  TABLE::timestamp_default_now/on_update_now for determining 
  if we should auto-set value of TIMESTAMP field during this operation.
  We are also use Field_timestamp::set_time() instead of 
  handler::update_timestamp().
sql/ha_myisammrg.cc:
  Now we use TABLE::timestamp_field_type instead of 
  TABLE::timestamp_default_now/on_update_now for determining 
  if we should auto-set value of TIMESTAMP field during this operation.
  We are also use Field_timestamp::set_time() instead of 
  handler::update_timestamp().
sql/ha_ndbcluster.cc:
  Now we use TABLE::timestamp_field_type instead of 
  TABLE::timestamp_default_now/on_update_now for determining 
  if we should auto-set value of TIMESTAMP field during this operation.
  We are also use Field_timestamp::set_time() instead of 
  handler::update_timestamp().
sql/handler.cc:
  handler::update_timestamp() is no longer needed since now we use
  Field_timestamp::set_time() instead.
  (we can't use handler::update_timestamp() anyway since field position
  only is not enough for TIMESTAMP fields which are able to store NULLs)
sql/handler.h:
  handler::update_timestamp() is no longer needed since now we use
  Field_timestamp::set_time() instead.
sql/item_timefunc.cc:
  Since now TIMESTAMP fields can hold NULL values we should take this into
  account.
sql/sql_base.cc:
  Now we use TABLE::timestamp_field_type instead of 
  TABLE::timestamp_default_now/on_update_now. 
  (Here we use Field_timestamp::get_auto_set_type() to setup its value
   before further statement execution).
sql/sql_insert.cc:
  Now we use TABLE::timestamp_field_type instead of 
  TABLE::timestamp_default_now/on_update_now.
sql/sql_load.cc:
  Now we use TABLE::timestamp_field_type instead of 
  TABLE::timestamp_default_now/on_update_now.
sql/sql_parse.cc:
  Added support for TIMESTAMP fields holding NULL values.
  We should distinguish NULL default values and non-specified default
  values for such fields (because latter could mean DEFAULT NOW()
  ON UPDATE NOW() in some cases).
sql/sql_show.cc:
  Added support for TIMESTAMP fields holding NULL values.
  Unlike all other fields these are NOT NULL by default
  so we have to specify NULL attribute explicitly for them.
sql/sql_table.cc:
  Now we use TABLE::timestamp_field_type instead of 
  TABLE::timestamp_default_now/on_update_now.
sql/sql_update.cc:
  Now we use TABLE::timestamp_field_type instead of 
  TABLE::timestamp_default_now/on_update_now.
sql/sql_yacc.yy:
  Added support for TIMESTAMP fields holding NULL values.
  Unlike all other fields these are NOT NULL by default
  (so we have to set NOT_NULL_FLAG properly for them).
sql/table.h:
  Added timestamp_auto_set_type enum which values are used for indicating
  during which operations we should automatically set TIMESTAPM field
  value to current timestamp.
  TABLE: Replaced timestamp_default_now/on_update_now members with
  timestamp_auto_set_type flag (Now when TIMESTAMP field are able to 
  store NULL values, single position of field in record is not enough 
  for updating this field anyway).
2004-10-01 18:54:06 +04:00
unknown
95f42e1da2 Bug #5228 ORDER BY CAST(enumcol) sorts incorrectly under certain conditions 2004-09-07 15:42:19 +05:00
unknown
62c3acac18 Portablity fix.
hpux11 compiler dislikes empty array initializers.
2004-08-17 12:05:34 +04:00
unknown
68d7b26698 Fix for bug #4508 "CONVERT_TZ() function with new time zone as param crashes server".
Instead of trying to open time zone tables during calculation of CONVERT_TZ() function
or setting of @@time_zone variable we should open and lock them with the rest of 
statement's table (so we should add them to global table list) and after that use such 
pre-opened tables for loading info about time zones.


mysql-test/r/timezone2.result:
  Added test for bug #4508
mysql-test/t/timezone2.test:
  Added test for bug #4508
scripts/mysql_create_system_tables.sh:
  Added one more test time zone to time zone tables which is needed for test for bug #4508.
sql/item_create.cc:
  CONVERT_TZ() now is treated as special function.
sql/item_create.h:
  CONVERT_TZ() now is treated as special function.
sql/item_timefunc.cc:
  Item_func_convert_tz now uses list of pre-opened time zone tables instead of trying to
  open them ad-hoc. Also it avoid calling of current_thd.
sql/item_timefunc.h:
  Added comment describing special nature of CONVERT_TZ() function.
  Optimization: Added own fix_fields() method and tz_tables member for caching pointer
  to list of open time zone tables to Item_func_convert_tz class.
sql/lex.h:
  CONVERT_TZ() now is treated as special function.
sql/mysql_priv.h:
  Removed function which is no longer used.
sql/set_var.cc:
  Now my_tz_find() accepts list of pre-opened time zone tables as last argument 
  and no longer needs pointer to current THD.
sql/set_var.h:
  Exported sys_time_zone, which is now used in sql_yacc.yy for quick finding out if we are
  setting @@time_zone variable.
sql/sql_base.cc:
  Moved propagation of pointers to open tables from global list to local select lists to
  open_and_lock_tables(), also added implicit usage of time zone tables as condition for
  such propagation.
sql/sql_lex.cc:
  Added fake_time_zone_tables_list which is used to indicate that time zone tables are
  implicitly used in statement.
  st_select_lex_unit::create_total_list(): if time zone tables are implicitly used in
  statement add them to global tables list.
sql/sql_lex.h:
  Added LEX::time_zone_tables_used member which is used to indicate that time zone tables 
  are implicitly used in this statement (by pointing to fake_time_zone_table_list) and 
  for holding pointer to those tables after they've been opened.
sql/sql_parse.cc:
  We should also create global table list if statement uses time zone tables implicitly.
  Added initialization of LEX::time_zone_tables_used to mysql_query_init().
sql/sql_prepare.cc:
  We should also create global table list if statement uses time zone tables implicitly.
sql/sql_select.cc:
  Removed functions which are no longer used.
sql/sql_yacc.yy:
  CONVERT_TZ() and @@time_zone variable are handled in special way since they implicitly 
  use time zone tables.
sql/tztime.cc:
  Fix for bug #4508 "CONVERT_TZ() function with new time zone as param crashes server".
  If statement uses CONVERT_TZ() function or @@time_zone variable is set then it implicitly
  uses time zone tables. We need to open and lock such tables with all other tables of 
  such statement.
  
  All code responsible for opening table was removed from tz_load_from_db() and function was 
  renamed to tz_load_from_open_tables() (which uses list of pre-opened tables).
  We also have new functions for construction and initialization of table list of time
  zone tables.
  my_tz_find() now always require list of pre-opened time zone tables and no longer needs
  current THD. So we have to pre-open them in my_tz_init().
  Also now we try to open time zone tables only if they were found during startup.
sql/tztime.h:
  New function for construction of table list of time zone tables my_tz_get_table_list().
  Now my_tz_find() requires list of pre-pened time zone tables instead of current thread.
2004-08-10 12:42:31 +04:00
unknown
1b0f0b0afc Fix for bug #4756 "STR_TO_DATE() returning bad results with AM/PM".
Added support of converion specifiers mentioned in manual but missing in code.


mysql-test/r/date_formats.result:
  Added tests of str_to_date() with new %T, %r and %V, %v conversion specifiers, and also 
  some other specifiers for which tests were missing previously.
mysql-test/t/date_formats.test:
  Added tests of str_to_date() and new %T, %r and %V, %v conversion specifiers, and also 
  some other specifiers for which tests were missing previously.
sql/item_timefunc.cc:
  Added support for %T, %r, %V, %v, %X, %x conversion specifiers to extract_date_time()
  function. Also simplified a bit calculation of dates from week number.
2004-08-06 10:01:29 +04:00
unknown
9dde418895 Fix for Bug#4030 "Client side conversion string -> date type doesn't
work (prepared statements)" and after-review fixes:
- str_to_TIME renamed to str_to_datetime to pair with str_to_time
- functions str_to_time and str_to_TIME moved to sql-common
- send_data_str now supports MYSQL_TYPE_TIME, MYSQL_TIME_DATE,
  MYSQL_TIME_DATETIME types of user input buffers.
- few more comments in the client library
- a test case added.


VC++Files/libmysql/libmysql.dsp:
  new file: my_time.c
VC++Files/libmysqld/libmysqld.dsp:
  new file: my_time.c
VC++Files/sql/mysqld.dsp:
  new file: my_time.c
include/Makefile.am:
  - mysql_time.h added to the list of installed client library headers
include/mysql.h:
  - declarations for MYSQL_TIME and enum_mysql_timestamp_type moved to 
  mysql_time.h, which is in shared use of client library and mysys.
libmysql/Makefile.shared:
  - my_time.lo added to the list of libmysql objects
libmysql/libmysql.c:
  Fix for bug#4030 "Client side conversion string -> date type doesn't work
   (prepared statements)" and cleanup.
  - added case labels for TIME/DATE/DATETIME types to send_data_str
  - comments for read_binary_{date,time,datetime}, fetch_result_*, fetch_results.
libmysqld/Makefile.am:
  - my_time.c added
sql-common/Makefile.am:
  - my_time.c added to the list of files included into source distribution.
sql/Makefile.am:
  my_time.c added to the list of mysqld sources.
sql/field.cc:
  - TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to 
    MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
sql/item.cc:
  - TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to 
    MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
sql/item_timefunc.cc:
  - TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to 
    MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
sql/mysql_priv.h:
  - added typedefs for TIME and timestamp_type
  - removed declarations for str_to_time and str_to_TIME (now this functions
    reside in mysys)
sql/mysqld.cc:
  - log_10_int moved to mysys (it's used by str_to_TIME and str_to_time)
  - enum values TIMESTAMP_{TIME,DATE,DATETIME} were renamed to
    MYSQL_TIMESTAMP_{TIME,DATE,DATETIME}
sql/set_var.cc:
  - TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to 
    MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
sql/set_var.h:
  - fixed timestamp_type usage to be compatible with typedef.
sql/sql_prepare.cc:
  - TIMESTAMP_{TIME,DATE,DATETIME} were renamed to
    MYSQL_TIMESTAMP_{TIME,DATE,DATETIME}
  - embedded library implementation of set_param_{time,date,datetime} is
  much simplier now, as MYSQL_TIME is the same as TIME.
sql/sql_yacc.yy:
  - s/\<TIMESTAMP_/MYSQL_TIMESTAMP/gc
sql/structs.h:
  - declarations for TIME and timestamp_type replaced with typedefs
  - str_to_datetime arguments moved to mysys headers
sql/time.cc:
  - str_to_time and str_to_TIME moved to mysys
  - TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to 
    MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...} as these names are now
    exported to client.
  - str_to_TIME renamed to str_to_datetime to pair with str_to_time
  - str_to_TIME_with_warn renamed accordingly
sql/tztime.cc:
  - TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to 
    MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
tests/client_test.c:
  - a test case for Bug#4030 "Client side conversion string -> date type 
  doesn't work (prepared statements)"
2004-06-24 19:08:36 +04:00
unknown
6aaccbcbf7 WL#1264 "Per-thread time zone support infrastructure".
Added basic per-thread time zone functionality (based on public
domain elsie-code). Now user can select current time zone
(from the list of time zones described in system tables).
All NOW-like functions honor this time zone, values of TIMESTAMP
type are interpreted as values in this time zone, so now
our TIMESTAMP type behaves similar to Oracle's TIMESTAMP WITH
LOCAL TIME ZONE (or proper PostgresSQL type).
  
WL#1266 "CONVERT_TZ() - basic time with time zone conversion 
function".
  
Fixed problems described in Bug #2336 (Different number of warnings 
when inserting bad datetime as string or as number). This required
reworking of datetime realted warning hadling (they now generated 
at Field object level not in conversion functions).
  
Optimization: Now Field class descendants use table->in_use member
instead of current_thd macro.


include/my_global.h:
  Added macro for reading of 32-bit ints stored in network order from
  unaligned memory location.
include/mysqld_error.h:
  Added error-code for invalid timestamp warning and error-code
  for wrong or unknown time zone specification.
libmysqld/Makefile.am:
  Added main per-thread time zone support file to libmysqld
libmysqld/lib_sql.cc:
  Added initialization of time zones infrastructure to embedded server.
mysql-test/r/connect.result:
  Updated test result since now mysql database contains more
  system tables.
mysql-test/r/date_formats.result:
  Now when truncation occurs during conversion to datetime value we are producing Warnings 
  instead of Notes. Also we are giving more clear warnings about this in some cases.
mysql-test/r/func_sapdb.result:
  New warnings about truncation occured during conversion to datetime value added due
  their better handling.
mysql-test/r/func_time.result:
  New warnings about truncation occured during conversion to datetime value added due
  their better handling.
mysql-test/r/select.result:
  New warnings about truncation occured during conversion to datetime value added due
  their better handling. Also tweaked test a bit to made it less ambigious for reader.
mysql-test/r/system_mysql_db.result:
  Updated test result because new system tables holding time zone descriptions were 
  added.
mysql-test/r/timezone.result:
  Updated timezone.test to use new system variable which shows system time zone.
  Added test of warning which is produced if someone tries to store non-existing (due 
  falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/r/type_datetime.result:
  Separated and extended test of values and warnings produced for bad values stored in 
  DATETTIME fields.
mysql-test/r/type_time.result:
  Now we are producing more consistent warning when we are truncating datetime value while
  storing it in TIME field.
mysql-test/r/type_timestamp.result:
  Separated and extended test of values and warnings produced for bad
  values stored in TIMESTAMP fields.
mysql-test/t/select.test:
  Updated test to make it less ambigous for reader.
mysql-test/t/timezone.test:
  Updated timezone.test to use new system variable which shows system time zone.
  Added test of warning which is produced if someone tries to store non-existing (due 
  falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/t/type_datetime.test:
  Separated and extended test of values and warnings produced for bad
  values stored in DATETTIME fields.
mysql-test/t/type_timestamp.test:
  Separated and extended test of values and warnings produced for bad
  values stored in TIMESTAMP fields.
scripts/mysql_create_system_tables.sh:
  Added creation of tables with time zone descriptions.
  Also added descriptions of time zones used in tests.
scripts/mysql_fix_privilege_tables.sql:
  Added mysql.time_zone* tables family.
sql/Makefile.am:
  Added files implementing time zone support to server, also added
  rules for building of mysql_tzinfo_to_sql converter and test_time
  test.
sql/field.cc:
  Now we are using per-thread time zone for TIMESTAMP <-> whatever conversion.
  Fixed generation of warnings for datetime types (DATETIME/TIMESTAMP/DATE/...) and
  any other Field to datetime conversion (now we are generating warnings no in lower
  level functions like in str_to_TIME() but in Field methods. This allows generate
  better and more consistent warnings and to reuse code of str_to_TIME() outside of
  server).
  
  Added 3rd parameter to set_warning() method to be able to not increment cut fields
  but still produce a warning. Also added set_datetime_warning() family of auxiliary 
  methods which allow easier generate datetime related warnings.
  Also replaced occurences of current_thd with table->in_use member, added
  asserts for catching all places there we need to set table->in_use
  accordingly. Renamed fix_datetime() function to number_to_TIME() and
  moved it to sql/time.cc there it fits better.
sql/field.h:
  Added comment about places where we can use table->in_use member
  instead of current_thd.
  Added 3rd parameter to Field::set_warning() method and set_datetime_warning()
  family of methods.
sql/field_conv.cc:
  Field::set_warning() method with 2 arguments was replaced with more 
  generic set_warning() method with 3 arguments.
sql/ha_berkeley.cc:
  Now we set table->in_use for temporary tables so we have to use
  table->tmp_table for checking if table is temporary.
sql/item.cc:
  Replaced calls to str_to_time() and str_to_TIME() funcs with their warning
  generating analogs.
sql/item_create.cc:
  Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_create.h:
  Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_timefunc.cc:
  Added support of per-thread time zone to NOW-like and FROM_UNIXTIME,
  UNIX_TIMESTAMP functions. 
  Added support for CONVERT_TZ function.
  Removed call to str_to_timestamp function which caused non-optimal
  behavior in certain cases. Replaced calls to str_to_time() function 
  with its warning generating analog.
sql/item_timefunc.h:
  Added support of per-thread time zone to NOW-like and
  FROM_UNIXTIME, UNIX_TIMESTAMP functions.
  Added support of CONVERT_TZ function.
sql/lex.h:
  Added support of CONVERT_TZ function.
sql/log.cc:
  Added support for replication of statements depending on time zone.
sql/mysql_priv.h:
  Now including headers with per-thread time zone support functions
  and classes. Added portable replacement of time_t - my_time_t type. 
  Added time zone as one of query distinguishing parameters for
  query cache. 
  Fixed declarations of str_to_TIME, str_to_time and 
  my_system_gmt_sec (former my_gmt_sec) since now they have one more
  out parameter which informs about wrong datetime value or data 
  truncation during conversion.
  Added warning generating version of str_to_TIME() and str_to_time()
  functions.
  Thrown away str_to_datetime/timestamp functions since they are not
  needed any longer. Added number_to_TIME function.
sql/mysqld.cc:
  Added per-thread time zone support initialization.
  Added new startup parameter --default-time-zone.
sql/set_var.cc:
  Added support for per-thread time_zone variable.
  Renamed old timezone variable to system_time_zone.
sql/set_var.h:
  Added support for per-thread time_zone variable.
sql/share/czech/errmsg.txt:
  Added error message for barking when incorrect time zone name or
  specifiaction is provided and for warning about invalid TIMESTAMP
  values (e.g. falling into the spring time-gap).
sql/share/danish/errmsg.txt:
  Added error message for barking when incorrect time zone name or
  specifiaction is provided and for warning about invalid TIMESTAMP
  values (e.g. falling into the spring time-gap).
sql/share/dutch/errmsg.txt:
  Added error message for barking when incorrect time zone name or
  specifiaction is provided and for warning about invalid TIMESTAMP
  values (e.g. falling into the spring time-gap).
sql/share/english/errmsg.txt:
  Added error message for barking when incorrect time zone name or
  specifiaction is provided and for warning about invalid TIMESTAMP
  values (e.g. falling into the spring time-gap).
sql/share/estonian/errmsg.txt:
  Added error message for barking when incorrect time zone name or
  specifiaction is provided and for warning about invalid TIMESTAMP
  values (e.g. falling into the spring time-gap).
sql/share/french/errmsg.txt:
  Added error message for barking when incorrect time zone name or
  specifiaction is provided and for warning about invalid TIMESTAMP
  values (e.g. falling into the spring time-gap).
sql/share/german/errmsg.txt:
  Added error message for barking when incorrect time zone name or
  specifiaction is provided and for warning about invalid TIMESTAMP
  values (e.g. falling into the spring time-gap).
sql/share/greek/errmsg.txt:
  Added error message for barking when incorrect time zone name or
  specifiaction is provided and for warning about invalid TIMESTAMP
  values (e.g. falling into the spring time-gap).
sql/share/hungarian/errmsg.txt:
  Added error message for barking when incorrect time zone name or
  specifiaction is provided and for warning about invalid TIMESTAMP
  values (e.g. falling into the spring time-gap).
sql/share/italian/errmsg.txt:
  Added error message for barking when incorrect time zone name or
  specifiaction is provided and for warning about invalid TIMESTAMP
  values (e.g. falling into the spring time-gap).
sql/share/japanese/errmsg.txt:
  Added error message for barking when incorrect time zone name or
  specifiaction is provided and for warning about invalid TIMESTAMP
  values (e.g. falling into the spring time-gap).
sql/share/korean/errmsg.txt:
  Added error message for barking when incorrect time zone name or
  specifiaction is provided and for warning about invalid TIMESTAMP
  values (e.g. falling into the spring time-gap).
sql/share/norwegian-ny/errmsg.txt:
  Added error message for barking when incorrect time zone name or
  specifiaction is provided and for warning about invalid TIMESTAMP
  values (e.g. falling into the spring time-gap).
sql/share/norwegian/errmsg.txt:
  Added error message for barking when incorrect time zone name or
  specifiaction is provided and for warning about invalid TIMESTAMP
  values (e.g. falling into the spring time-gap).
sql/share/polish/errmsg.txt:
  Added error message for barking when incorrect time zone name or
  specifiaction is provided and for warning about invalid TIMESTAMP
  values (e.g. falling into the spring time-gap).
sql/share/portuguese/errmsg.txt:
  Added error message for barking when incorrect time zone name or
  specifiaction is provided and for warning about invalid TIMESTAMP
  values (e.g. falling into the spring time-gap).
sql/share/romanian/errmsg.txt:
  Added error message for barking when incorrect time zone name or
  specifiaction is provided and for warning about invalid TIMESTAMP
  values (e.g. falling into the spring time-gap).
sql/share/russian/errmsg.txt:
  Added error message for barking when incorrect time zone name or
  specifiaction is provided and for warning about invalid TIMESTAMP
  values (e.g. falling into the spring time-gap).
sql/share/serbian/errmsg.txt:
  Added error message for barking when incorrect time zone name or
  specifiaction is provided and for warning about invalid TIMESTAMP
  values (e.g. falling into the spring time-gap).
sql/share/slovak/errmsg.txt:
  Added error message for barking when incorrect time zone name or
  specifiaction is provided and for warning about invalid TIMESTAMP
  values (e.g. falling into the spring time-gap).
sql/share/spanish/errmsg.txt:
  Added error message for barking when incorrect time zone name or
  specifiaction is provided and for warning about invalid TIMESTAMP
  values (e.g. falling into the spring time-gap).
sql/share/swedish/errmsg.txt:
  Added error message for barking when incorrect time zone name or
  specifiaction is provided and for warning about invalid TIMESTAMP
  values (e.g. falling into the spring time-gap).
sql/share/ukrainian/errmsg.txt:
  Added error message for barking when incorrect time zone name or
  specifiaction is provided and for warning about invalid TIMESTAMP
  values (e.g. falling into the spring time-gap).
sql/slave.cc:
  In order to support replication of statements using time zones in 4.1 we should 
  ensure that both master and slave have same default time zone.
sql/sql_base.cc:
  Now we are setting TABLE::in_use member for all tables (which assume
  calls to Field::store or val_ methods).
sql/sql_cache.cc:
  Added time zone as one more query distinguishing parameter
  for query cache.
sql/sql_class.cc:
  Added THD::time_zone_used variable indicating that this query
  uses per thread time zone.
sql/sql_class.h:
  Added per-thread time zone variable. Added THD::time_zone_used
  variable indicating that this query uses per thread time zone
  so if this is updating query the time zone should be logged to 
  binlog.
sql/sql_insert.cc:
  We should set TABLE::in_use member pointing to thread which is called
  INSERT DELAYED and not to worker thread.
sql/sql_load.cc:
  Field::set_warning() now has one more argument now.
sql/sql_parse.cc:
  Resetting THD::time_zone_used variable in the end of query
  processing.
sql/sql_select.cc:
  Now we are setting TABLE::in_use member for all tables (which assume
  calls to Field::store or val_ methods).
sql/sql_show.cc:
  Now using per thread time zone for extended show tables.
sql/time.cc:
  Added support for per-thread time zones for TIMESTAMP type and
  reworked generation of warnings for TIMESTAMP and DATETIME types.
  (Introduced new TIME_to_timestamp() function. Removed hours 
  normalisation from former my_gmt_sec() since it was not working 
  and not used anywhere now, but breaks parameter constness, added
  to this function generation of warning if we are falling in spring 
  time-gap. Removed str_to_timestamp and str_to_datetime functions 
  which are no longer used. Moved fix_datetime function from
  sql/field.cc to this file as number_to_TIME() function. Added
  out parameter for str_to_TIME and str_to_time functions which
  indicates if value was truncated during conversion, removed direct 
  generation of warnings from this functions.)
sql/unireg.cc:
  Now we are setting TABLE::in_use member for all tables (which assume
    calls to Field::store or val_ methods).
BitKeeper/etc/ignore:
  Added sql/test_time sql/mysql_tzinfo_to_sql libmysqld/tztime.cc to the ignore list
2004-06-18 10:11:31 +04:00