2011-06-30 17:37:13 +02:00
|
|
|
/*
|
2011-11-21 18:13:14 +01:00
|
|
|
Copyright (c) 2004, 2011, Oracle and/or its affiliates.
|
2017-03-01 07:27:39 +01:00
|
|
|
Copyright (c) 2017, Monty Program Ab.
|
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 17:08:36 +02:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2006-12-23 20:17:15 +01:00
|
|
|
the Free Software Foundation; version 2 of the License.
|
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 17:08:36 +02:00
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2019-05-11 20:29:06 +02:00
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
|
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 17:08:36 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
This is a private header of sql-common library, containing
|
|
|
|
declarations for my_time.c
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _my_time_h_
|
|
|
|
#define _my_time_h_
|
|
|
|
#include "mysql_time.h"
|
2016-06-18 13:28:34 +02:00
|
|
|
#include "my_decimal_limits.h"
|
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 17:08:36 +02:00
|
|
|
|
|
|
|
C_MODE_START
|
|
|
|
|
2019-08-29 18:33:58 +02:00
|
|
|
extern MYSQL_PLUGIN_IMPORT ulonglong log_10_int[20];
|
2004-08-19 22:40:31 +02:00
|
|
|
extern uchar days_in_month[];
|
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 17:08:36 +02:00
|
|
|
|
2023-09-18 11:05:41 +02:00
|
|
|
#if SIZEOF_VOIDP == 4
|
|
|
|
/* 32 bit system, using old timestamp */
|
2004-08-05 23:16:43 +02:00
|
|
|
#define MY_TIME_T_MAX LONG_MAX
|
|
|
|
#define MY_TIME_T_MIN LONG_MIN
|
2006-11-01 14:47:40 +01:00
|
|
|
#define TIMESTAMP_MAX_YEAR 2038
|
2023-09-11 16:58:22 +02:00
|
|
|
#define TIMESTAMP_MAX_MONTH 1
|
|
|
|
#define TIMESTAMP_MAX_DAY 19
|
2006-11-01 14:47:40 +01:00
|
|
|
#define TIMESTAMP_MAX_VALUE INT_MAX32
|
2011-05-28 04:11:32 +02:00
|
|
|
#define TIMESTAMP_MIN_VALUE 0
|
2023-09-11 16:58:22 +02:00
|
|
|
#else
|
2023-09-18 11:05:41 +02:00
|
|
|
/* 64 bit system. Use 4 byte unsigned timestamp */
|
2023-09-11 16:58:22 +02:00
|
|
|
#define MY_TIME_T_MAX ((longlong) UINT_MAX32)
|
|
|
|
#define MY_TIME_T_MIN 0
|
|
|
|
#define TIMESTAMP_MAX_YEAR 2106
|
|
|
|
#define TIMESTAMP_MIN_VALUE 0
|
|
|
|
#define TIMESTAMP_MAX_VALUE ((longlong) UINT_MAX32)
|
|
|
|
#define TIMESTAMP_MAX_MONTH 2
|
|
|
|
#define TIMESTAMP_MAX_DAY 7
|
2023-09-18 11:05:41 +02:00
|
|
|
#endif /* SIZEOF_VOIDP */
|
2006-11-01 14:47:40 +01:00
|
|
|
|
2023-09-11 16:58:22 +02:00
|
|
|
#define TIMESTAMP_MIN_YEAR (1900 + YY_PART_YEAR - 1)
|
2006-05-16 03:32:24 +02:00
|
|
|
/* two-digit years < this are 20..; >= this are 19.. */
|
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 17:08:36 +02:00
|
|
|
#define YY_PART_YEAR 70
|
|
|
|
|
2011-02-02 17:51:35 +01:00
|
|
|
/*
|
|
|
|
check for valid times only if the range of time_t is greater than
|
|
|
|
the range of my_time_t
|
|
|
|
*/
|
|
|
|
#if SIZEOF_TIME_T > 4 || defined(TIME_T_UNSIGNED)
|
|
|
|
# define IS_TIME_T_VALID_FOR_TIMESTAMP(x) \
|
2023-09-11 16:58:22 +02:00
|
|
|
((ulonglong) (x) <= TIMESTAMP_MAX_VALUE && \
|
|
|
|
((x) >= TIMESTAMP_MIN_VALUE)
|
2011-02-02 17:51:35 +01:00
|
|
|
#else
|
|
|
|
# define IS_TIME_T_VALID_FOR_TIMESTAMP(x) \
|
|
|
|
((x) >= TIMESTAMP_MIN_VALUE)
|
|
|
|
#endif
|
|
|
|
|
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 17:08:36 +02:00
|
|
|
/* Flags to str_to_datetime */
|
2013-07-03 09:46:20 +02:00
|
|
|
|
2018-09-28 12:01:17 +02:00
|
|
|
#define C_TIME_NO_ZERO_IN_DATE (1UL << 23) /* == MODE_NO_ZERO_IN_DATE */
|
|
|
|
#define C_TIME_NO_ZERO_DATE (1UL << 24) /* == MODE_NO_ZERO_DATE */
|
|
|
|
#define C_TIME_INVALID_DATES (1UL << 25) /* == MODE_INVALID_DATES */
|
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 17:08:36 +02:00
|
|
|
|
2017-03-01 07:27:39 +01:00
|
|
|
#define MYSQL_TIME_WARN_TRUNCATED 1U
|
|
|
|
#define MYSQL_TIME_WARN_OUT_OF_RANGE 2U
|
MDEV-17563 Different results using table or view when comparing values of time type
MDEV-17625 Different warnings when comparing a garbage to DATETIME vs TIME
- Splitting processes of data type conversion (to TIME/DATE,DATETIME)
and warning generation.
Warning are now only get collected during conversion (in an "int" variable),
and are pushed in the very end of conversion (not in parallel).
Warnings generated by the low level routines str_to_xxx() and number_to_xxx()
can now be changed at the end, when TIME_FUZZY_DATES is applied,
from "Invalid value" to "Truncated invalid value".
Now "Illegal value" is issued only when the low level routine returned
an error and TIME_FUZZY_DATES was not set. Otherwise, if the low level
routine returned "false" (success), or if NULL was converted to a zero
datetime by TIME_FUZZY_DATES, then "Truncated illegal value"
is issued. This gives better warnings.
- Methods Type_handler::Item_get_date() and
Type_handler::Item_func_hybrid_field_type_get_date() now only
convert and collect warning information, but do not push warnings.
- Changing the return data type for Type_handler::Item_get_date()
and Type_handler::Item_func_hybrid_field_type_get_date() from
"bool" to "void". The conversion result (success vs error) can be
checked by testing ltime->time_type. MYSQL_TIME_{NONE|ERROR}
mean mean error, other values mean success.
- Adding new wrapper methods Type_handler::Item_get_date_with_warn() and
Type_handler::Item_func_hybrid_field_type_get_date_with_warn()
to do conversion followed by raising warnings, and changing
the code to call new Type_handler::***_with_warn() methods.
- Adding a helper class Temporal::Status, a wrapper
for MYSQL_TIME_STATUS with automatic initialization.
- Adding a helper class Temporal::Warn, to collect warnings
but without actually raising them. Moving a part of ErrConv
into a separate class ErrBuff, and deriving both Temporal::Warn
and ErrConv from ErrBuff. The ErrBuff part of Temporal::Warn
is used to collect textual representation of the input data.
- Adding a helper class Temporal::Warn_push. It's used
to collect warning information during conversion, and
automatically pushes warnings to the diagnostics area
on its destructor time (in case of non-zero warning).
- Moving more code from various functions inside class Temporal.
- Adding more Temporal_hybrid constructors and
protected Temporal methods make_from_xxx(),
which convert and only collect warning information, but do not
actually raise warnings.
- Now the low level functions str_to_datetime() and str_to_time()
always set status->warning if the return value is "true" (error).
- Now the low level functions number_to_time() and number_to_datetime()
set the "*was_cut" argument if the return value is "true" (error).
- Adding a few DBUG_ASSERTs to make sure that str_to_xxx() and
number_to_xxx() always set warnings on error.
- Adding new warning flags MYSQL_TIME_WARN_EDOM and MYSQL_TIME_WARN_ZERO_DATE
for the code symmetry. Before this change there was a special
code path for (rc==true && was_cut==0) which was treated by
Field_temporal::store_invalid_with_warning as "zero date violation".
Now was_cut==0 always means that there are no any error/warnings/notes
to be raised, not matter what rc is.
- Using new Temporal_hybrid constructors in combination with
Temporal::Warn_push inside str_to_datetime_with_warn(),
double_to_datetime_with_warn(), int_to_datetime_with_warn(),
Field::get_date(), Item::get_date_from_string(), and a few other places.
- Removing methods Dec_ptr::to_datetime_with_warn(),
Year::to_time_with_warn(), my_decimal::to_datetime_with_warn(),
Dec_ptr::to_datetime_with_warn().
Fixing Sec6::to_time() and Sec6::to_datetime() to
convert and only collect warnings, without raising warnings.
Now warning raising functionality resides in Temporal::Warn_push.
- Adding classes Longlong_hybrid_null and Double_null, to
return both value and the "IS NULL" flag. Adding methods
Item::to_double_null(), to_longlong_hybrid_null(),
Item_func_hybrid_field_type::to_longlong_hybrid_null_op(),
Item_func_hybrid_field_type::to_double_null_op().
Removing separate classes VInt and VInt_op, as they
have been replaced by a single class Longlong_hybrid_null.
- Adding a helper method Temporal::type_name_by_timestamp_type(),
moving a part of make_truncated_value_warning() into it,
and reusing in Temporal::Warn::push_conversion_warnings().
- Removing Item::make_zero_date() and
Item_func_hybrid_field_type::make_zero_mysql_time().
They provided duplicate functionality.
Now this code resides in Temporal::make_fuzzy_date().
The latter is now called for all Item types when data type
conversion (to DATE/TIME/DATETIME) is involved, including
Item_field and Item_direct_view_ref.
This fixes MDEV-17563: Item_direct_view_ref now correctly converts
NULL to a zero date when TIME_FUZZY_DATES says so.
2018-11-07 16:00:14 +01:00
|
|
|
#define MYSQL_TIME_WARN_EDOM 4U
|
|
|
|
#define MYSQL_TIME_WARN_ZERO_DATE 8U
|
2017-03-01 07:27:39 +01:00
|
|
|
#define MYSQL_TIME_NOTE_TRUNCATED 16U
|
2013-08-15 13:24:34 +02:00
|
|
|
|
MDEV-17563 Different results using table or view when comparing values of time type
MDEV-17625 Different warnings when comparing a garbage to DATETIME vs TIME
- Splitting processes of data type conversion (to TIME/DATE,DATETIME)
and warning generation.
Warning are now only get collected during conversion (in an "int" variable),
and are pushed in the very end of conversion (not in parallel).
Warnings generated by the low level routines str_to_xxx() and number_to_xxx()
can now be changed at the end, when TIME_FUZZY_DATES is applied,
from "Invalid value" to "Truncated invalid value".
Now "Illegal value" is issued only when the low level routine returned
an error and TIME_FUZZY_DATES was not set. Otherwise, if the low level
routine returned "false" (success), or if NULL was converted to a zero
datetime by TIME_FUZZY_DATES, then "Truncated illegal value"
is issued. This gives better warnings.
- Methods Type_handler::Item_get_date() and
Type_handler::Item_func_hybrid_field_type_get_date() now only
convert and collect warning information, but do not push warnings.
- Changing the return data type for Type_handler::Item_get_date()
and Type_handler::Item_func_hybrid_field_type_get_date() from
"bool" to "void". The conversion result (success vs error) can be
checked by testing ltime->time_type. MYSQL_TIME_{NONE|ERROR}
mean mean error, other values mean success.
- Adding new wrapper methods Type_handler::Item_get_date_with_warn() and
Type_handler::Item_func_hybrid_field_type_get_date_with_warn()
to do conversion followed by raising warnings, and changing
the code to call new Type_handler::***_with_warn() methods.
- Adding a helper class Temporal::Status, a wrapper
for MYSQL_TIME_STATUS with automatic initialization.
- Adding a helper class Temporal::Warn, to collect warnings
but without actually raising them. Moving a part of ErrConv
into a separate class ErrBuff, and deriving both Temporal::Warn
and ErrConv from ErrBuff. The ErrBuff part of Temporal::Warn
is used to collect textual representation of the input data.
- Adding a helper class Temporal::Warn_push. It's used
to collect warning information during conversion, and
automatically pushes warnings to the diagnostics area
on its destructor time (in case of non-zero warning).
- Moving more code from various functions inside class Temporal.
- Adding more Temporal_hybrid constructors and
protected Temporal methods make_from_xxx(),
which convert and only collect warning information, but do not
actually raise warnings.
- Now the low level functions str_to_datetime() and str_to_time()
always set status->warning if the return value is "true" (error).
- Now the low level functions number_to_time() and number_to_datetime()
set the "*was_cut" argument if the return value is "true" (error).
- Adding a few DBUG_ASSERTs to make sure that str_to_xxx() and
number_to_xxx() always set warnings on error.
- Adding new warning flags MYSQL_TIME_WARN_EDOM and MYSQL_TIME_WARN_ZERO_DATE
for the code symmetry. Before this change there was a special
code path for (rc==true && was_cut==0) which was treated by
Field_temporal::store_invalid_with_warning as "zero date violation".
Now was_cut==0 always means that there are no any error/warnings/notes
to be raised, not matter what rc is.
- Using new Temporal_hybrid constructors in combination with
Temporal::Warn_push inside str_to_datetime_with_warn(),
double_to_datetime_with_warn(), int_to_datetime_with_warn(),
Field::get_date(), Item::get_date_from_string(), and a few other places.
- Removing methods Dec_ptr::to_datetime_with_warn(),
Year::to_time_with_warn(), my_decimal::to_datetime_with_warn(),
Dec_ptr::to_datetime_with_warn().
Fixing Sec6::to_time() and Sec6::to_datetime() to
convert and only collect warnings, without raising warnings.
Now warning raising functionality resides in Temporal::Warn_push.
- Adding classes Longlong_hybrid_null and Double_null, to
return both value and the "IS NULL" flag. Adding methods
Item::to_double_null(), to_longlong_hybrid_null(),
Item_func_hybrid_field_type::to_longlong_hybrid_null_op(),
Item_func_hybrid_field_type::to_double_null_op().
Removing separate classes VInt and VInt_op, as they
have been replaced by a single class Longlong_hybrid_null.
- Adding a helper method Temporal::type_name_by_timestamp_type(),
moving a part of make_truncated_value_warning() into it,
and reusing in Temporal::Warn::push_conversion_warnings().
- Removing Item::make_zero_date() and
Item_func_hybrid_field_type::make_zero_mysql_time().
They provided duplicate functionality.
Now this code resides in Temporal::make_fuzzy_date().
The latter is now called for all Item types when data type
conversion (to DATE/TIME/DATETIME) is involved, including
Item_field and Item_direct_view_ref.
This fixes MDEV-17563: Item_direct_view_ref now correctly converts
NULL to a zero date when TIME_FUZZY_DATES says so.
2018-11-07 16:00:14 +01:00
|
|
|
#define MYSQL_TIME_WARN_WARNINGS (MYSQL_TIME_WARN_TRUNCATED|\
|
|
|
|
MYSQL_TIME_WARN_OUT_OF_RANGE|\
|
|
|
|
MYSQL_TIME_WARN_EDOM|\
|
|
|
|
MYSQL_TIME_WARN_ZERO_DATE)
|
2013-08-15 13:24:34 +02:00
|
|
|
#define MYSQL_TIME_WARN_NOTES (MYSQL_TIME_NOTE_TRUNCATED)
|
|
|
|
|
2014-02-19 11:05:15 +01:00
|
|
|
#define MYSQL_TIME_WARN_HAVE_WARNINGS(x) MY_TEST((x) & MYSQL_TIME_WARN_WARNINGS)
|
|
|
|
#define MYSQL_TIME_WARN_HAVE_NOTES(x) MY_TEST((x) & MYSQL_TIME_WARN_NOTES)
|
2006-10-04 15:13:32 +02:00
|
|
|
|
2018-02-24 18:42:13 +01:00
|
|
|
/* Useful constants */
|
2014-03-06 21:21:25 +01:00
|
|
|
#define SECONDS_IN_24H 86400L
|
|
|
|
|
2018-11-16 16:18:17 +01:00
|
|
|
/* Limits for the INTERVAL data type */
|
|
|
|
|
|
|
|
/* Number of hours between '0001-01-01 00h' and '9999-12-31 23h' */
|
|
|
|
#define TIME_MAX_INTERVAL_HOUR 87649415
|
|
|
|
#define TIME_MAX_INTERVAL_HOUR_CHAR_LENGTH 8
|
|
|
|
|
|
|
|
/* Number of full days between '0001-01-01' and '9999-12-31'*/
|
|
|
|
#define TIME_MAX_INTERVAL_DAY 3652058 /*87649415/24*/
|
|
|
|
#define TIME_MAX_INTERVAL_DAY_CHAR_LENGTH 7
|
|
|
|
|
2006-10-04 15:13:32 +02:00
|
|
|
/* Limits for the TIME data type */
|
|
|
|
#define TIME_MAX_HOUR 838
|
|
|
|
#define TIME_MAX_MINUTE 59
|
|
|
|
#define TIME_MAX_SECOND 59
|
wl#173 - temporal types with sub-second resolution
and collateral changes.
* introduce my_hrtime_t, my_timediff_t, and conversion macros
* inroduce TIME_RESULT, but it can only be returned from Item::cmp_type(),
never from Item::result_type()
* pack_time/unpack_time function for "packed" representation of
MYSQL_TIME in a longlong that can be compared
* ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
* numbers aren't quoted in EXPLAIN EXTENDED
* new column I_S.COLUMNS.DATETIME_PRECISION
* date/time values are compares to anything as date/time, not as strings or numbers.
* old timestamp(X) is no longer supported
* MYSQL_TIME to string conversion functions take precision as an argument
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* Lazy_string class to pass a value (string, number, time) polymorphically down the stack
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
* removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
* introduced Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* in many cases date/time types are treated like other types, not as special cases
* greatly simplified Arg_comparator (regarding date/time/year code)
* SEC_TO_TIME is real function, not integer.
* microsecond precision in NOW, CURTIME, etc
* Item_temporal. All items derived from it only provide get_date, but no val* methods
* replication of NOW(6)
* Protocol::store(time) now takes the precision as an argument
* @@TIMESTAMP is a double
client/mysqlbinlog.cc:
remove unneded casts
include/my_sys.h:
introduce my_hrtime_t, my_timediff_t, and conversion macros
include/my_time.h:
pack_time/unpack_time, etc.
convenience functions to work with MYSQL_TIME::second_part
libmysql/libmysql.c:
str_to_time() is gone. str_to_datetime() does it now.
my_TIME_to_str() takes the precision as an argument
mysql-test/include/ps_conv.inc:
time is not equal to datetime anymore
mysql-test/r/distinct.result:
a test for an old MySQL bug
mysql-test/r/explain.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_default.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_sapdb.result:
when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/func_test.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_time.result:
ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
mysql-test/r/having.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/information_schema.result:
new column I_S.COLUMNS.DATETIME_PRECISION
mysql-test/r/join_outer.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/metadata.result:
TIMESTAMP no longer has zerofill flag
mysql-test/r/range.result:
invalid datetime is not compared with as a string
mysql-test/r/select.result:
NO_ZERO_IN_DATE, etc only affect storage - according to the manual
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/subselect.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/sysdate_is_now.result:
when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/type_blob.result:
TIMESTAMP(N) is not deprecated
mysql-test/r/type_timestamp.result:
old TIMESTAMP(X) semantics is not supported anymore
mysql-test/r/union.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/varbinary.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/t/distinct.test:
test for an old MySQL bug
mysql-test/t/func_time.test:
+- INTERVAL now works with TIME values
mysql-test/t/select.test:
typo
mysql-test/t/subselect.test:
only one error per statement, please
mysql-test/t/system_mysql_db_fix40123.test:
old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50030.test:
old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50117.test:
old timestamp(X) is no longer supported
mysql-test/t/type_blob.test:
old timestamp(X) is no longer supported
mysql-test/t/type_timestamp.test:
old timestamp(X) is no longer supported
mysys/my_getsystime.c:
functions to get the time with microsecond precision
mysys/my_init.c:
move the my_getsystime.c initialization code to my_getsystime.c
mysys/my_static.c:
no need to make these variables extern
mysys/my_static.h:
no need to make these variables extern
scripts/mysql_system_tables.sql:
old timestamp(X) is no longer supported
scripts/mysql_system_tables_fix.sql:
old timestamp(X) is no longer supported
scripts/mysqlhotcopy.sh:
old timestamp(X) is no longer supported
sql-common/my_time.c:
* call str_to_time from str_to_datetime, as appropriate
* date/time to string conversions take precision as an argument
* number_to_time()
* TIME_to_double()
* pack_time() and unpack_time()
sql/event_data_objects.cc:
cast is not needed
my_datetime_to_str() takes precision as an argument
sql/event_db_repository.cc:
avoid dangerous downcast (because the pointer is
not always Field_timestamp, see events_1.test)
sql/event_queue.cc:
avoid silly double-work for cond_wait
(having an endpoint of wait, subtract the current time to get the timeout,
and use set_timespec() macro to fill in struct timespec, by adding the current
time to the timeout)
sql/field.cc:
* remove virtual Field::get_time(), everyone should use only Field::get_date()
* remove lots of #ifdef WORDS_BIGENDIAN
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
sql/field.h:
* remove virtual Field::get_time(), everyone should use only Field::get_date()
* remove lots of #ifdef WORDS_BIGENDIAN
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
* removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
sql/filesort.cc:
TIME_RESULT, cmp_time()
sql/item.cc:
* numbers aren't quoted in EXPLAIN EXTENDED
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* virtual Item::get_time() is gone
* Item_param::field_type() is set correctly
* Item_datetime, for a datetime constant
* time to anything is compared as a time
* Item_cache::print() prints the value is available
* bug fixed in Item_cache_int::val_str()
sql/item.h:
* Item::print_value(), to be used from Item_xxx::print() when needed
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* virtual Item::get_time() is gone
* Item_datetime, for a datetime constant
* better default for cast_to_int_type()
* Item_cache objects now *always* have the field_type() set
sql/item_cmpfunc.cc:
* get_year_value, get_time_value are gone. get_datetime_value does it all
* get_value_a_func, get_value_b_func are gone
* can_compare_as_dates() is gone too, TIME_RESULT is used instead
* cmp_type() instead or result_type() when doing a comparison
* compare_datetime and compate_e_datetime in the comparator_matrix, is_nulls_eq is gone
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
sql/item_cmpfunc.h:
greatly simplified Arg_comparator
sql/item_create.cc:
* fix a bug in error messages in CAST
sql/item_func.cc:
Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
mention all possibitiles in switch over Item_result values, or use default:
sql/item_row.h:
overwrite the default cmp_type() for Item_row,
as no MYSQL_TYPE_xxx value corresponds to ROW_RESULT
sql/item_timefunc.cc:
rewrite make_datetime to support precision argument
SEC_TO_TIME is real function, not integer.
many functions that returned temporal values had duplicate code in val_* methods,
some of them did not have get_date() which resulted in unnecessary date->str->date conversions.
Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
many fixes to set decimals (datetime precision) correctly.
sql/item_timefunc.h:
SEC_TO_TIME is real function, not integer.
many functions that returned temporal values had duplicate code in val_* methods,
some of them did not have get_date() which resulted in unnecessary date->str->date conversions.
Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
many fixes to set decimals (datetime precision) correctly.
sql/log_event.cc:
replication of NOW(6)
sql/log_event.h:
replication of NOW(6)
sql/mysql_priv.h:
Lazy_string class to pass a value (string, number, time) polymorphically down the stack.
make_truncated_value_warning() that uses it.
sql/mysqld.cc:
datetime in Arg_comparator::comparator_matrix
sql/opt_range.cc:
cleanup: don't disable warnings before calling save_in_field_no_warnings()
sql/protocol.cc:
Protocol::store(time) now takes the precision as an argument
sql/protocol.h:
Protocol::store(time) now takes the precision as an argument
sql/rpl_rli.cc:
small cleanup
sql/set_var.cc:
SET TIMESTAMP=double
sql/set_var.h:
@@TIMESTAMP is a double
sql/share/errmsg.txt:
precision and scale are unsigned
sql/slave.cc:
replication of NOW(6)
sql/sp_head.cc:
cleanup
sql/sql_class.cc:
support for NOW(6)
sql/sql_class.h:
support for NOW(6)
sql/sql_insert.cc:
support for NOW(6)
sql/sql_select.cc:
use item->cmp_type().
move a comment where it belongs
sql/sql_show.cc:
new column I_S.COLUMNS.DATETIME_PRECISION
sql/sql_yacc.yy:
TIME(X), DATETIME(X), cast, NOW(X), CURTIME(X), etc
sql/time.cc:
fix date_add_interval() to support MYSQL_TIMESTAMP_TIME argument
storage/myisam/ha_myisam.cc:
TIMESTAMP no longer carries ZEROFIELD flag, still we keep MYI file compatible.
strings/my_vsnprintf.c:
warnings
tests/mysql_client_test.c:
old timestamp(X) does not work anymore
datetime is no longer equal to time
2011-03-01 13:24:36 +01:00
|
|
|
#define TIME_MAX_SECOND_PART 999999
|
2011-05-19 19:01:46 +02:00
|
|
|
#define TIME_SECOND_PART_FACTOR (TIME_MAX_SECOND_PART+1)
|
|
|
|
#define TIME_SECOND_PART_DIGITS 6
|
2011-06-06 20:28:15 +02:00
|
|
|
#define TIME_MAX_VALUE (TIME_MAX_HOUR*10000 + TIME_MAX_MINUTE*100 + TIME_MAX_SECOND)
|
2007-04-04 21:40:47 +02:00
|
|
|
#define TIME_MAX_VALUE_SECONDS (TIME_MAX_HOUR * 3600L + \
|
|
|
|
TIME_MAX_MINUTE * 60L + TIME_MAX_SECOND)
|
2006-10-04 15:13:32 +02:00
|
|
|
|
2013-07-10 10:12:27 +02:00
|
|
|
/*
|
|
|
|
Structure to return status from
|
|
|
|
str_to_datetime(), str_to_time().
|
|
|
|
*/
|
|
|
|
typedef struct st_mysql_time_status
|
|
|
|
{
|
|
|
|
int warnings;
|
|
|
|
uint precision;
|
2018-11-23 16:04:42 +01:00
|
|
|
uint nanoseconds;
|
2013-07-10 10:12:27 +02:00
|
|
|
} MYSQL_TIME_STATUS;
|
|
|
|
|
|
|
|
static inline void my_time_status_init(MYSQL_TIME_STATUS *status)
|
|
|
|
{
|
2018-04-29 16:39:48 +02:00
|
|
|
status->warnings= 0;
|
|
|
|
status->precision= 0;
|
2018-11-23 16:04:42 +01:00
|
|
|
status->nanoseconds= 0;
|
2013-07-10 10:12:27 +02:00
|
|
|
}
|
|
|
|
|
2023-09-18 16:30:22 +02:00
|
|
|
struct my_timeval
|
|
|
|
{
|
|
|
|
longlong tv_sec;
|
|
|
|
ulong tv_usec;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-11-06 19:33:18 +01:00
|
|
|
my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date,
|
2009-12-22 10:35:56 +01:00
|
|
|
ulonglong flags, int *was_cut);
|
MDEV-17351 Wrong results for GREATEST,TIMESTAMP,ADDTIME with an out-of-range TIME-alike argument
Problems:
Functions LEAST() and GREATEST() in TIME context, as well as functions
TIMESTAMP(a,b) and ADDTIME(a,b), returned confusing results when the
input TIME-alike value in a number or in a string was out of the TIME
supported range.
In case of TIMESTAMP(a,b) and ADDTIME(a,b), the second argument
value could get extra unexpected digits. For example, in:
ADDTIME('2001-01-01 00:00:00', 10000000) or
ADDTIME('2001-01-01 00:00:00', '1000:00:00')
the second argument was converted to '838:59:59.999999'
with six fractional digits, which contradicted "decimals"
previously set to 0 in fix_length_and_dec().
These unexpected fractional digits led to confusing function results.
Changes:
1. GREATEST(), LEAST()
- fixing Item_func_min_max::get_time_native()
to respect "decimals" set by fix_length_and_dec().
If a value of some numeric or string time-alike argument
goes outside of the TIME range and gets limited to '838:59:59.999999',
it's now right-truncated to the correct fractional precision.
- fixing, Type_handler_temporal_result::Item_func_min_max_fix_attributes()
to take into account arguments' time_precision() or datetime_precision(),
rather than rely on "decimals" calculated by the generic implementation
in Type_handler::Item_func_min_max_fix_attributes(). This makes
GREATEST() and LEAST() return better data types, with the same
fractional precision with what TIMESTAMP(a,b) and ADDTIME(a,b) return
for the same arguments, and with DATE(a) and TIMESTAMP(a).
2. Item_func_add_time and Item_func_timestamp
It was semantically wrong to apply the limit of the TIME data type
to the argument "b", which plays the role of "INTERVAL DAY TO SECOND" here.
Changing the code to fetch the argument "b" as INTERVAL rather than as TIME.
The low level routine calc_time_diff() now gets the interval
value without limiting to '838:59:59.999999', so in these examples:
ADDTIME('2001-01-01 00:00:00', 10000000)
ADDTIME('2001-01-01 00:00:00', '1000:00:00')
calc_time_diff() gets '1000:00:00' as is. The SQL function result
now gets limited to the supported result data type range
(datetime or time) inside calc_time_diff(), which now calculates
the return value using the real fractional digits that
came directly from the arguments (without the effect of limiting
to the TIME range), so the result does not have any unexpected
fractional digits any more.
Detailed changes in TIMESTAMP() and ADDTIME():
- Adding a new class Interval_DDhhmmssff. It's similar to Time, but:
* does not try to parse datetime format, as it's not needed for
functions TIMESTAMP() and ADDTIME().
* does not cut values to '838:59:59.999999'
The maximum supported Interval_DDhhmmssff's hard limit is
'UINT_MAX32:59:59.999999'. The maximum used soft limit is:
- '87649415:59:59.999999' (in 'hh:mm:ss.ff' format)
- '3652058 23:59:59.999999' (in 'DD hh:mm:ss.ff' format)
which is a difference between:
- TIMESTAMP'0001-01-01 00:00:00' and
- TIMESTAMP'9999-12-31 23:59:59.999999'
(the minimum datetime that supports arithmetic, and the
maximum possible datetime value).
- Fixing get_date() methods in the classes related to functions
ADDTIME(a,b) and TIMESTAMP(a,b) to use the new class Interval_DDhhmmssff
for fetching data from the second argument, instead of get_date().
- Fixing fix_length_and_dec() methods in the classes related
to functions ADDTIME(a,b) and TIMESTAMP(a,b) to use
Interval_DDhhmmssff::fsp(item) instead of item->time_precision()
to get the fractional precision of the second argument correctly.
- Splitting the low level function str_to_time() into smaller pieces
to reuse the code. Adding a new function str_to_DDhhmmssff(), to
parse "INTERVAL DAY TO SECOND" values.
After these changes, functions TIMESTAMP() and ADDTIME()
return much more predictable results, in terms of fractional
digits, and in terms of the overall result.
The full ranges of DATETIME and TIME values are now covered by TIMESTAMP()
and ADDTIME(), so the following can now be calculated:
SELECT ADDTIME(TIMESTAMP'0001-01-01 00:00:00', '87649415:59:59.999999');
-> '9999-12-31 23:59:59.999999'
SELECT TIMESTAMP(DATE'0001-01-01', '87649415:59:59.999999')
-> '9999-12-31 23:59:59.999999'
SELECT ADDTIME(TIME'-838:59:59.999999', '1677:59:59.999998');
-> '838:59:59.999999'
2018-10-08 11:38:01 +02:00
|
|
|
my_bool str_to_DDhhmmssff(const char *str, size_t length, MYSQL_TIME *l_time,
|
|
|
|
ulong max_hour, MYSQL_TIME_STATUS *status);
|
2018-11-14 13:00:38 +01:00
|
|
|
my_bool str_to_datetime_or_date_or_time(const char *str, size_t length,
|
|
|
|
MYSQL_TIME *to, ulonglong flag,
|
2018-11-16 16:18:17 +01:00
|
|
|
MYSQL_TIME_STATUS *status,
|
|
|
|
ulong time_max_hour,
|
|
|
|
ulong time_err_hour);
|
|
|
|
my_bool
|
|
|
|
str_to_datetime_or_date_or_interval_hhmmssff(const char *str, size_t length,
|
|
|
|
MYSQL_TIME *to, ulonglong flag,
|
|
|
|
MYSQL_TIME_STATUS *status,
|
|
|
|
ulong time_max_hour,
|
|
|
|
ulong time_err_hour);
|
|
|
|
my_bool
|
|
|
|
str_to_datetime_or_date_or_interval_day(const char *str, size_t length,
|
|
|
|
MYSQL_TIME *to, ulonglong flag,
|
|
|
|
MYSQL_TIME_STATUS *status,
|
|
|
|
ulong time_max_hour,
|
|
|
|
ulong time_err_hour);
|
2018-11-14 13:00:38 +01:00
|
|
|
my_bool str_to_datetime_or_date(const char *str, size_t length, MYSQL_TIME *to,
|
|
|
|
ulonglong flags, MYSQL_TIME_STATUS *status);
|
|
|
|
|
|
|
|
longlong number_to_datetime_or_date(longlong nr, ulong sec_part,
|
|
|
|
MYSQL_TIME *time_res,
|
|
|
|
ulonglong flags, int *was_cut);
|
|
|
|
int number_to_time_only(my_bool neg, ulonglong nr, ulong sec_part,
|
2018-11-16 16:18:17 +01:00
|
|
|
ulong max_hour, MYSQL_TIME *to, int *was_cut);
|
2018-11-14 13:00:38 +01:00
|
|
|
|
2006-12-14 23:51:37 +01:00
|
|
|
ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *);
|
|
|
|
ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *);
|
|
|
|
ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *);
|
|
|
|
ulonglong TIME_to_ulonglong(const MYSQL_TIME *);
|
wl#173 - temporal types with sub-second resolution
and collateral changes.
* introduce my_hrtime_t, my_timediff_t, and conversion macros
* inroduce TIME_RESULT, but it can only be returned from Item::cmp_type(),
never from Item::result_type()
* pack_time/unpack_time function for "packed" representation of
MYSQL_TIME in a longlong that can be compared
* ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
* numbers aren't quoted in EXPLAIN EXTENDED
* new column I_S.COLUMNS.DATETIME_PRECISION
* date/time values are compares to anything as date/time, not as strings or numbers.
* old timestamp(X) is no longer supported
* MYSQL_TIME to string conversion functions take precision as an argument
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* Lazy_string class to pass a value (string, number, time) polymorphically down the stack
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
* removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
* introduced Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* in many cases date/time types are treated like other types, not as special cases
* greatly simplified Arg_comparator (regarding date/time/year code)
* SEC_TO_TIME is real function, not integer.
* microsecond precision in NOW, CURTIME, etc
* Item_temporal. All items derived from it only provide get_date, but no val* methods
* replication of NOW(6)
* Protocol::store(time) now takes the precision as an argument
* @@TIMESTAMP is a double
client/mysqlbinlog.cc:
remove unneded casts
include/my_sys.h:
introduce my_hrtime_t, my_timediff_t, and conversion macros
include/my_time.h:
pack_time/unpack_time, etc.
convenience functions to work with MYSQL_TIME::second_part
libmysql/libmysql.c:
str_to_time() is gone. str_to_datetime() does it now.
my_TIME_to_str() takes the precision as an argument
mysql-test/include/ps_conv.inc:
time is not equal to datetime anymore
mysql-test/r/distinct.result:
a test for an old MySQL bug
mysql-test/r/explain.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_default.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_sapdb.result:
when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/func_test.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_time.result:
ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
mysql-test/r/having.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/information_schema.result:
new column I_S.COLUMNS.DATETIME_PRECISION
mysql-test/r/join_outer.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/metadata.result:
TIMESTAMP no longer has zerofill flag
mysql-test/r/range.result:
invalid datetime is not compared with as a string
mysql-test/r/select.result:
NO_ZERO_IN_DATE, etc only affect storage - according to the manual
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/subselect.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/sysdate_is_now.result:
when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/type_blob.result:
TIMESTAMP(N) is not deprecated
mysql-test/r/type_timestamp.result:
old TIMESTAMP(X) semantics is not supported anymore
mysql-test/r/union.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/varbinary.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/t/distinct.test:
test for an old MySQL bug
mysql-test/t/func_time.test:
+- INTERVAL now works with TIME values
mysql-test/t/select.test:
typo
mysql-test/t/subselect.test:
only one error per statement, please
mysql-test/t/system_mysql_db_fix40123.test:
old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50030.test:
old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50117.test:
old timestamp(X) is no longer supported
mysql-test/t/type_blob.test:
old timestamp(X) is no longer supported
mysql-test/t/type_timestamp.test:
old timestamp(X) is no longer supported
mysys/my_getsystime.c:
functions to get the time with microsecond precision
mysys/my_init.c:
move the my_getsystime.c initialization code to my_getsystime.c
mysys/my_static.c:
no need to make these variables extern
mysys/my_static.h:
no need to make these variables extern
scripts/mysql_system_tables.sql:
old timestamp(X) is no longer supported
scripts/mysql_system_tables_fix.sql:
old timestamp(X) is no longer supported
scripts/mysqlhotcopy.sh:
old timestamp(X) is no longer supported
sql-common/my_time.c:
* call str_to_time from str_to_datetime, as appropriate
* date/time to string conversions take precision as an argument
* number_to_time()
* TIME_to_double()
* pack_time() and unpack_time()
sql/event_data_objects.cc:
cast is not needed
my_datetime_to_str() takes precision as an argument
sql/event_db_repository.cc:
avoid dangerous downcast (because the pointer is
not always Field_timestamp, see events_1.test)
sql/event_queue.cc:
avoid silly double-work for cond_wait
(having an endpoint of wait, subtract the current time to get the timeout,
and use set_timespec() macro to fill in struct timespec, by adding the current
time to the timeout)
sql/field.cc:
* remove virtual Field::get_time(), everyone should use only Field::get_date()
* remove lots of #ifdef WORDS_BIGENDIAN
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
sql/field.h:
* remove virtual Field::get_time(), everyone should use only Field::get_date()
* remove lots of #ifdef WORDS_BIGENDIAN
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
* removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
sql/filesort.cc:
TIME_RESULT, cmp_time()
sql/item.cc:
* numbers aren't quoted in EXPLAIN EXTENDED
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* virtual Item::get_time() is gone
* Item_param::field_type() is set correctly
* Item_datetime, for a datetime constant
* time to anything is compared as a time
* Item_cache::print() prints the value is available
* bug fixed in Item_cache_int::val_str()
sql/item.h:
* Item::print_value(), to be used from Item_xxx::print() when needed
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* virtual Item::get_time() is gone
* Item_datetime, for a datetime constant
* better default for cast_to_int_type()
* Item_cache objects now *always* have the field_type() set
sql/item_cmpfunc.cc:
* get_year_value, get_time_value are gone. get_datetime_value does it all
* get_value_a_func, get_value_b_func are gone
* can_compare_as_dates() is gone too, TIME_RESULT is used instead
* cmp_type() instead or result_type() when doing a comparison
* compare_datetime and compate_e_datetime in the comparator_matrix, is_nulls_eq is gone
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
sql/item_cmpfunc.h:
greatly simplified Arg_comparator
sql/item_create.cc:
* fix a bug in error messages in CAST
sql/item_func.cc:
Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
mention all possibitiles in switch over Item_result values, or use default:
sql/item_row.h:
overwrite the default cmp_type() for Item_row,
as no MYSQL_TYPE_xxx value corresponds to ROW_RESULT
sql/item_timefunc.cc:
rewrite make_datetime to support precision argument
SEC_TO_TIME is real function, not integer.
many functions that returned temporal values had duplicate code in val_* methods,
some of them did not have get_date() which resulted in unnecessary date->str->date conversions.
Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
many fixes to set decimals (datetime precision) correctly.
sql/item_timefunc.h:
SEC_TO_TIME is real function, not integer.
many functions that returned temporal values had duplicate code in val_* methods,
some of them did not have get_date() which resulted in unnecessary date->str->date conversions.
Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
many fixes to set decimals (datetime precision) correctly.
sql/log_event.cc:
replication of NOW(6)
sql/log_event.h:
replication of NOW(6)
sql/mysql_priv.h:
Lazy_string class to pass a value (string, number, time) polymorphically down the stack.
make_truncated_value_warning() that uses it.
sql/mysqld.cc:
datetime in Arg_comparator::comparator_matrix
sql/opt_range.cc:
cleanup: don't disable warnings before calling save_in_field_no_warnings()
sql/protocol.cc:
Protocol::store(time) now takes the precision as an argument
sql/protocol.h:
Protocol::store(time) now takes the precision as an argument
sql/rpl_rli.cc:
small cleanup
sql/set_var.cc:
SET TIMESTAMP=double
sql/set_var.h:
@@TIMESTAMP is a double
sql/share/errmsg.txt:
precision and scale are unsigned
sql/slave.cc:
replication of NOW(6)
sql/sp_head.cc:
cleanup
sql/sql_class.cc:
support for NOW(6)
sql/sql_class.h:
support for NOW(6)
sql/sql_insert.cc:
support for NOW(6)
sql/sql_select.cc:
use item->cmp_type().
move a comment where it belongs
sql/sql_show.cc:
new column I_S.COLUMNS.DATETIME_PRECISION
sql/sql_yacc.yy:
TIME(X), DATETIME(X), cast, NOW(X), CURTIME(X), etc
sql/time.cc:
fix date_add_interval() to support MYSQL_TIMESTAMP_TIME argument
storage/myisam/ha_myisam.cc:
TIMESTAMP no longer carries ZEROFIELD flag, still we keep MYI file compatible.
strings/my_vsnprintf.c:
warnings
tests/mysql_client_test.c:
old timestamp(X) does not work anymore
datetime is no longer equal to time
2011-03-01 13:24:36 +01:00
|
|
|
double TIME_to_double(const MYSQL_TIME *my_time);
|
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 17:08:36 +02:00
|
|
|
|
2011-03-17 14:13:03 +01:00
|
|
|
int check_time_range(struct st_mysql_time *my_time, uint dec, int *warning);
|
2013-07-10 09:49:17 +02:00
|
|
|
my_bool check_datetime_range(const MYSQL_TIME *ltime);
|
|
|
|
|
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 17:08:36 +02:00
|
|
|
|
2004-07-29 23:25:58 +02:00
|
|
|
long calc_daynr(uint year,uint month,uint day);
|
2004-09-28 19:08:00 +02:00
|
|
|
uint calc_days_in_year(uint year);
|
2007-03-23 21:08:31 +01:00
|
|
|
uint year_2000_handling(uint year);
|
2004-07-29 23:25:58 +02:00
|
|
|
|
2008-04-03 17:32:00 +02:00
|
|
|
void my_init_time(void);
|
2004-07-29 23:25:58 +02:00
|
|
|
|
2006-11-01 14:47:40 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
Function to check sanity of a TIMESTAMP value
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Check if a given MYSQL_TIME value fits in TIMESTAMP range.
|
|
|
|
This function doesn't make precise check, but rather a rough
|
|
|
|
estimate.
|
|
|
|
|
|
|
|
RETURN VALUES
|
2013-03-25 23:03:13 +01:00
|
|
|
TRUE The value seems sane
|
|
|
|
FALSE The MYSQL_TIME value is definitely out of range
|
2006-11-01 14:47:40 +01:00
|
|
|
*/
|
|
|
|
|
2008-02-18 23:29:39 +01:00
|
|
|
static inline my_bool validate_timestamp_range(const MYSQL_TIME *t)
|
2006-11-01 14:47:40 +01:00
|
|
|
{
|
|
|
|
if ((t->year > TIMESTAMP_MAX_YEAR || t->year < TIMESTAMP_MIN_YEAR) ||
|
|
|
|
(t->year == TIMESTAMP_MIN_YEAR && (t->month < 12 || t->day < 31)))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2016-09-03 14:04:17 +02:00
|
|
|
/* Can't include mysqld_error.h, it needs mysys to build, thus hardcode 2 error values here. */
|
2017-04-23 18:39:57 +02:00
|
|
|
#ifndef ER_WARN_DATA_OUT_OF_RANGE
|
2016-09-03 14:04:17 +02:00
|
|
|
#define ER_WARN_DATA_OUT_OF_RANGE 1264
|
|
|
|
#define ER_WARN_INVALID_TIMESTAMP 1299
|
2017-04-23 18:39:57 +02:00
|
|
|
#endif
|
2016-09-03 14:04:17 +02:00
|
|
|
|
2004-07-29 23:25:58 +02:00
|
|
|
my_time_t
|
2011-06-06 20:28:15 +02:00
|
|
|
my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, uint *error_code);
|
2004-07-29 23:25:58 +02:00
|
|
|
|
2004-11-15 13:44:29 +01:00
|
|
|
void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type);
|
2004-09-02 18:16:01 +02:00
|
|
|
|
2004-10-15 22:12:59 +02:00
|
|
|
/*
|
|
|
|
Required buffer length for my_time_to_str, my_date_to_str,
|
|
|
|
my_datetime_to_str and TIME_to_string functions. Note, that the
|
|
|
|
caller is still responsible to check that given TIME structure
|
|
|
|
has values in valid ranges, otherwise size of the buffer could
|
2004-11-15 13:44:29 +01:00
|
|
|
be not enough. We also rely on the fact that even wrong values
|
|
|
|
sent using binary protocol fit in this buffer.
|
2004-10-15 22:12:59 +02:00
|
|
|
*/
|
|
|
|
#define MAX_DATE_STRING_REP_LENGTH 30
|
2016-06-18 13:28:34 +02:00
|
|
|
#define AUTO_SEC_PART_DIGITS DECIMAL_NOT_SPECIFIED
|
2004-10-15 22:12:59 +02:00
|
|
|
|
2018-11-20 10:47:52 +01:00
|
|
|
int my_interval_DDhhmmssff_to_str(const MYSQL_TIME *, char *to, uint digits);
|
2011-05-28 04:11:32 +02:00
|
|
|
int my_time_to_str(const MYSQL_TIME *l_time, char *to, uint digits);
|
2004-10-15 22:12:59 +02:00
|
|
|
int my_date_to_str(const MYSQL_TIME *l_time, char *to);
|
2011-05-28 04:11:32 +02:00
|
|
|
int my_datetime_to_str(const MYSQL_TIME *l_time, char *to, uint digits);
|
|
|
|
int my_TIME_to_str(const MYSQL_TIME *l_time, char *to, uint digits);
|
wl#173 - temporal types with sub-second resolution
and collateral changes.
* introduce my_hrtime_t, my_timediff_t, and conversion macros
* inroduce TIME_RESULT, but it can only be returned from Item::cmp_type(),
never from Item::result_type()
* pack_time/unpack_time function for "packed" representation of
MYSQL_TIME in a longlong that can be compared
* ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
* numbers aren't quoted in EXPLAIN EXTENDED
* new column I_S.COLUMNS.DATETIME_PRECISION
* date/time values are compares to anything as date/time, not as strings or numbers.
* old timestamp(X) is no longer supported
* MYSQL_TIME to string conversion functions take precision as an argument
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* Lazy_string class to pass a value (string, number, time) polymorphically down the stack
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
* removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
* introduced Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* in many cases date/time types are treated like other types, not as special cases
* greatly simplified Arg_comparator (regarding date/time/year code)
* SEC_TO_TIME is real function, not integer.
* microsecond precision in NOW, CURTIME, etc
* Item_temporal. All items derived from it only provide get_date, but no val* methods
* replication of NOW(6)
* Protocol::store(time) now takes the precision as an argument
* @@TIMESTAMP is a double
client/mysqlbinlog.cc:
remove unneded casts
include/my_sys.h:
introduce my_hrtime_t, my_timediff_t, and conversion macros
include/my_time.h:
pack_time/unpack_time, etc.
convenience functions to work with MYSQL_TIME::second_part
libmysql/libmysql.c:
str_to_time() is gone. str_to_datetime() does it now.
my_TIME_to_str() takes the precision as an argument
mysql-test/include/ps_conv.inc:
time is not equal to datetime anymore
mysql-test/r/distinct.result:
a test for an old MySQL bug
mysql-test/r/explain.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_default.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_sapdb.result:
when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/func_test.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_time.result:
ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
mysql-test/r/having.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/information_schema.result:
new column I_S.COLUMNS.DATETIME_PRECISION
mysql-test/r/join_outer.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/metadata.result:
TIMESTAMP no longer has zerofill flag
mysql-test/r/range.result:
invalid datetime is not compared with as a string
mysql-test/r/select.result:
NO_ZERO_IN_DATE, etc only affect storage - according to the manual
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/subselect.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/sysdate_is_now.result:
when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/type_blob.result:
TIMESTAMP(N) is not deprecated
mysql-test/r/type_timestamp.result:
old TIMESTAMP(X) semantics is not supported anymore
mysql-test/r/union.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/varbinary.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/t/distinct.test:
test for an old MySQL bug
mysql-test/t/func_time.test:
+- INTERVAL now works with TIME values
mysql-test/t/select.test:
typo
mysql-test/t/subselect.test:
only one error per statement, please
mysql-test/t/system_mysql_db_fix40123.test:
old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50030.test:
old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50117.test:
old timestamp(X) is no longer supported
mysql-test/t/type_blob.test:
old timestamp(X) is no longer supported
mysql-test/t/type_timestamp.test:
old timestamp(X) is no longer supported
mysys/my_getsystime.c:
functions to get the time with microsecond precision
mysys/my_init.c:
move the my_getsystime.c initialization code to my_getsystime.c
mysys/my_static.c:
no need to make these variables extern
mysys/my_static.h:
no need to make these variables extern
scripts/mysql_system_tables.sql:
old timestamp(X) is no longer supported
scripts/mysql_system_tables_fix.sql:
old timestamp(X) is no longer supported
scripts/mysqlhotcopy.sh:
old timestamp(X) is no longer supported
sql-common/my_time.c:
* call str_to_time from str_to_datetime, as appropriate
* date/time to string conversions take precision as an argument
* number_to_time()
* TIME_to_double()
* pack_time() and unpack_time()
sql/event_data_objects.cc:
cast is not needed
my_datetime_to_str() takes precision as an argument
sql/event_db_repository.cc:
avoid dangerous downcast (because the pointer is
not always Field_timestamp, see events_1.test)
sql/event_queue.cc:
avoid silly double-work for cond_wait
(having an endpoint of wait, subtract the current time to get the timeout,
and use set_timespec() macro to fill in struct timespec, by adding the current
time to the timeout)
sql/field.cc:
* remove virtual Field::get_time(), everyone should use only Field::get_date()
* remove lots of #ifdef WORDS_BIGENDIAN
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
sql/field.h:
* remove virtual Field::get_time(), everyone should use only Field::get_date()
* remove lots of #ifdef WORDS_BIGENDIAN
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
* removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
sql/filesort.cc:
TIME_RESULT, cmp_time()
sql/item.cc:
* numbers aren't quoted in EXPLAIN EXTENDED
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* virtual Item::get_time() is gone
* Item_param::field_type() is set correctly
* Item_datetime, for a datetime constant
* time to anything is compared as a time
* Item_cache::print() prints the value is available
* bug fixed in Item_cache_int::val_str()
sql/item.h:
* Item::print_value(), to be used from Item_xxx::print() when needed
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* virtual Item::get_time() is gone
* Item_datetime, for a datetime constant
* better default for cast_to_int_type()
* Item_cache objects now *always* have the field_type() set
sql/item_cmpfunc.cc:
* get_year_value, get_time_value are gone. get_datetime_value does it all
* get_value_a_func, get_value_b_func are gone
* can_compare_as_dates() is gone too, TIME_RESULT is used instead
* cmp_type() instead or result_type() when doing a comparison
* compare_datetime and compate_e_datetime in the comparator_matrix, is_nulls_eq is gone
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
sql/item_cmpfunc.h:
greatly simplified Arg_comparator
sql/item_create.cc:
* fix a bug in error messages in CAST
sql/item_func.cc:
Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
mention all possibitiles in switch over Item_result values, or use default:
sql/item_row.h:
overwrite the default cmp_type() for Item_row,
as no MYSQL_TYPE_xxx value corresponds to ROW_RESULT
sql/item_timefunc.cc:
rewrite make_datetime to support precision argument
SEC_TO_TIME is real function, not integer.
many functions that returned temporal values had duplicate code in val_* methods,
some of them did not have get_date() which resulted in unnecessary date->str->date conversions.
Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
many fixes to set decimals (datetime precision) correctly.
sql/item_timefunc.h:
SEC_TO_TIME is real function, not integer.
many functions that returned temporal values had duplicate code in val_* methods,
some of them did not have get_date() which resulted in unnecessary date->str->date conversions.
Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
many fixes to set decimals (datetime precision) correctly.
sql/log_event.cc:
replication of NOW(6)
sql/log_event.h:
replication of NOW(6)
sql/mysql_priv.h:
Lazy_string class to pass a value (string, number, time) polymorphically down the stack.
make_truncated_value_warning() that uses it.
sql/mysqld.cc:
datetime in Arg_comparator::comparator_matrix
sql/opt_range.cc:
cleanup: don't disable warnings before calling save_in_field_no_warnings()
sql/protocol.cc:
Protocol::store(time) now takes the precision as an argument
sql/protocol.h:
Protocol::store(time) now takes the precision as an argument
sql/rpl_rli.cc:
small cleanup
sql/set_var.cc:
SET TIMESTAMP=double
sql/set_var.h:
@@TIMESTAMP is a double
sql/share/errmsg.txt:
precision and scale are unsigned
sql/slave.cc:
replication of NOW(6)
sql/sp_head.cc:
cleanup
sql/sql_class.cc:
support for NOW(6)
sql/sql_class.h:
support for NOW(6)
sql/sql_insert.cc:
support for NOW(6)
sql/sql_select.cc:
use item->cmp_type().
move a comment where it belongs
sql/sql_show.cc:
new column I_S.COLUMNS.DATETIME_PRECISION
sql/sql_yacc.yy:
TIME(X), DATETIME(X), cast, NOW(X), CURTIME(X), etc
sql/time.cc:
fix date_add_interval() to support MYSQL_TIMESTAMP_TIME argument
storage/myisam/ha_myisam.cc:
TIMESTAMP no longer carries ZEROFIELD flag, still we keep MYI file compatible.
strings/my_vsnprintf.c:
warnings
tests/mysql_client_test.c:
old timestamp(X) does not work anymore
datetime is no longer equal to time
2011-03-01 13:24:36 +01:00
|
|
|
|
2023-09-18 16:30:22 +02:00
|
|
|
int my_timeval_to_str(const struct my_timeval *tm, char *to, uint dec);
|
2013-07-10 09:49:17 +02:00
|
|
|
|
2011-05-28 04:11:32 +02:00
|
|
|
static inline longlong sec_part_shift(longlong second_part, uint digits)
|
wl#173 - temporal types with sub-second resolution
and collateral changes.
* introduce my_hrtime_t, my_timediff_t, and conversion macros
* inroduce TIME_RESULT, but it can only be returned from Item::cmp_type(),
never from Item::result_type()
* pack_time/unpack_time function for "packed" representation of
MYSQL_TIME in a longlong that can be compared
* ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
* numbers aren't quoted in EXPLAIN EXTENDED
* new column I_S.COLUMNS.DATETIME_PRECISION
* date/time values are compares to anything as date/time, not as strings or numbers.
* old timestamp(X) is no longer supported
* MYSQL_TIME to string conversion functions take precision as an argument
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* Lazy_string class to pass a value (string, number, time) polymorphically down the stack
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
* removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
* introduced Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* in many cases date/time types are treated like other types, not as special cases
* greatly simplified Arg_comparator (regarding date/time/year code)
* SEC_TO_TIME is real function, not integer.
* microsecond precision in NOW, CURTIME, etc
* Item_temporal. All items derived from it only provide get_date, but no val* methods
* replication of NOW(6)
* Protocol::store(time) now takes the precision as an argument
* @@TIMESTAMP is a double
client/mysqlbinlog.cc:
remove unneded casts
include/my_sys.h:
introduce my_hrtime_t, my_timediff_t, and conversion macros
include/my_time.h:
pack_time/unpack_time, etc.
convenience functions to work with MYSQL_TIME::second_part
libmysql/libmysql.c:
str_to_time() is gone. str_to_datetime() does it now.
my_TIME_to_str() takes the precision as an argument
mysql-test/include/ps_conv.inc:
time is not equal to datetime anymore
mysql-test/r/distinct.result:
a test for an old MySQL bug
mysql-test/r/explain.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_default.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_sapdb.result:
when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/func_test.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_time.result:
ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
mysql-test/r/having.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/information_schema.result:
new column I_S.COLUMNS.DATETIME_PRECISION
mysql-test/r/join_outer.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/metadata.result:
TIMESTAMP no longer has zerofill flag
mysql-test/r/range.result:
invalid datetime is not compared with as a string
mysql-test/r/select.result:
NO_ZERO_IN_DATE, etc only affect storage - according to the manual
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/subselect.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/sysdate_is_now.result:
when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/type_blob.result:
TIMESTAMP(N) is not deprecated
mysql-test/r/type_timestamp.result:
old TIMESTAMP(X) semantics is not supported anymore
mysql-test/r/union.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/varbinary.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/t/distinct.test:
test for an old MySQL bug
mysql-test/t/func_time.test:
+- INTERVAL now works with TIME values
mysql-test/t/select.test:
typo
mysql-test/t/subselect.test:
only one error per statement, please
mysql-test/t/system_mysql_db_fix40123.test:
old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50030.test:
old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50117.test:
old timestamp(X) is no longer supported
mysql-test/t/type_blob.test:
old timestamp(X) is no longer supported
mysql-test/t/type_timestamp.test:
old timestamp(X) is no longer supported
mysys/my_getsystime.c:
functions to get the time with microsecond precision
mysys/my_init.c:
move the my_getsystime.c initialization code to my_getsystime.c
mysys/my_static.c:
no need to make these variables extern
mysys/my_static.h:
no need to make these variables extern
scripts/mysql_system_tables.sql:
old timestamp(X) is no longer supported
scripts/mysql_system_tables_fix.sql:
old timestamp(X) is no longer supported
scripts/mysqlhotcopy.sh:
old timestamp(X) is no longer supported
sql-common/my_time.c:
* call str_to_time from str_to_datetime, as appropriate
* date/time to string conversions take precision as an argument
* number_to_time()
* TIME_to_double()
* pack_time() and unpack_time()
sql/event_data_objects.cc:
cast is not needed
my_datetime_to_str() takes precision as an argument
sql/event_db_repository.cc:
avoid dangerous downcast (because the pointer is
not always Field_timestamp, see events_1.test)
sql/event_queue.cc:
avoid silly double-work for cond_wait
(having an endpoint of wait, subtract the current time to get the timeout,
and use set_timespec() macro to fill in struct timespec, by adding the current
time to the timeout)
sql/field.cc:
* remove virtual Field::get_time(), everyone should use only Field::get_date()
* remove lots of #ifdef WORDS_BIGENDIAN
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
sql/field.h:
* remove virtual Field::get_time(), everyone should use only Field::get_date()
* remove lots of #ifdef WORDS_BIGENDIAN
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
* removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
sql/filesort.cc:
TIME_RESULT, cmp_time()
sql/item.cc:
* numbers aren't quoted in EXPLAIN EXTENDED
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* virtual Item::get_time() is gone
* Item_param::field_type() is set correctly
* Item_datetime, for a datetime constant
* time to anything is compared as a time
* Item_cache::print() prints the value is available
* bug fixed in Item_cache_int::val_str()
sql/item.h:
* Item::print_value(), to be used from Item_xxx::print() when needed
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* virtual Item::get_time() is gone
* Item_datetime, for a datetime constant
* better default for cast_to_int_type()
* Item_cache objects now *always* have the field_type() set
sql/item_cmpfunc.cc:
* get_year_value, get_time_value are gone. get_datetime_value does it all
* get_value_a_func, get_value_b_func are gone
* can_compare_as_dates() is gone too, TIME_RESULT is used instead
* cmp_type() instead or result_type() when doing a comparison
* compare_datetime and compate_e_datetime in the comparator_matrix, is_nulls_eq is gone
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
sql/item_cmpfunc.h:
greatly simplified Arg_comparator
sql/item_create.cc:
* fix a bug in error messages in CAST
sql/item_func.cc:
Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
mention all possibitiles in switch over Item_result values, or use default:
sql/item_row.h:
overwrite the default cmp_type() for Item_row,
as no MYSQL_TYPE_xxx value corresponds to ROW_RESULT
sql/item_timefunc.cc:
rewrite make_datetime to support precision argument
SEC_TO_TIME is real function, not integer.
many functions that returned temporal values had duplicate code in val_* methods,
some of them did not have get_date() which resulted in unnecessary date->str->date conversions.
Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
many fixes to set decimals (datetime precision) correctly.
sql/item_timefunc.h:
SEC_TO_TIME is real function, not integer.
many functions that returned temporal values had duplicate code in val_* methods,
some of them did not have get_date() which resulted in unnecessary date->str->date conversions.
Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
many fixes to set decimals (datetime precision) correctly.
sql/log_event.cc:
replication of NOW(6)
sql/log_event.h:
replication of NOW(6)
sql/mysql_priv.h:
Lazy_string class to pass a value (string, number, time) polymorphically down the stack.
make_truncated_value_warning() that uses it.
sql/mysqld.cc:
datetime in Arg_comparator::comparator_matrix
sql/opt_range.cc:
cleanup: don't disable warnings before calling save_in_field_no_warnings()
sql/protocol.cc:
Protocol::store(time) now takes the precision as an argument
sql/protocol.h:
Protocol::store(time) now takes the precision as an argument
sql/rpl_rli.cc:
small cleanup
sql/set_var.cc:
SET TIMESTAMP=double
sql/set_var.h:
@@TIMESTAMP is a double
sql/share/errmsg.txt:
precision and scale are unsigned
sql/slave.cc:
replication of NOW(6)
sql/sp_head.cc:
cleanup
sql/sql_class.cc:
support for NOW(6)
sql/sql_class.h:
support for NOW(6)
sql/sql_insert.cc:
support for NOW(6)
sql/sql_select.cc:
use item->cmp_type().
move a comment where it belongs
sql/sql_show.cc:
new column I_S.COLUMNS.DATETIME_PRECISION
sql/sql_yacc.yy:
TIME(X), DATETIME(X), cast, NOW(X), CURTIME(X), etc
sql/time.cc:
fix date_add_interval() to support MYSQL_TIMESTAMP_TIME argument
storage/myisam/ha_myisam.cc:
TIMESTAMP no longer carries ZEROFIELD flag, still we keep MYI file compatible.
strings/my_vsnprintf.c:
warnings
tests/mysql_client_test.c:
old timestamp(X) does not work anymore
datetime is no longer equal to time
2011-03-01 13:24:36 +01:00
|
|
|
{
|
2011-05-19 19:01:46 +02:00
|
|
|
return second_part / (longlong)log_10_int[TIME_SECOND_PART_DIGITS - digits];
|
wl#173 - temporal types with sub-second resolution
and collateral changes.
* introduce my_hrtime_t, my_timediff_t, and conversion macros
* inroduce TIME_RESULT, but it can only be returned from Item::cmp_type(),
never from Item::result_type()
* pack_time/unpack_time function for "packed" representation of
MYSQL_TIME in a longlong that can be compared
* ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
* numbers aren't quoted in EXPLAIN EXTENDED
* new column I_S.COLUMNS.DATETIME_PRECISION
* date/time values are compares to anything as date/time, not as strings or numbers.
* old timestamp(X) is no longer supported
* MYSQL_TIME to string conversion functions take precision as an argument
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* Lazy_string class to pass a value (string, number, time) polymorphically down the stack
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
* removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
* introduced Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* in many cases date/time types are treated like other types, not as special cases
* greatly simplified Arg_comparator (regarding date/time/year code)
* SEC_TO_TIME is real function, not integer.
* microsecond precision in NOW, CURTIME, etc
* Item_temporal. All items derived from it only provide get_date, but no val* methods
* replication of NOW(6)
* Protocol::store(time) now takes the precision as an argument
* @@TIMESTAMP is a double
client/mysqlbinlog.cc:
remove unneded casts
include/my_sys.h:
introduce my_hrtime_t, my_timediff_t, and conversion macros
include/my_time.h:
pack_time/unpack_time, etc.
convenience functions to work with MYSQL_TIME::second_part
libmysql/libmysql.c:
str_to_time() is gone. str_to_datetime() does it now.
my_TIME_to_str() takes the precision as an argument
mysql-test/include/ps_conv.inc:
time is not equal to datetime anymore
mysql-test/r/distinct.result:
a test for an old MySQL bug
mysql-test/r/explain.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_default.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_sapdb.result:
when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/func_test.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_time.result:
ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
mysql-test/r/having.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/information_schema.result:
new column I_S.COLUMNS.DATETIME_PRECISION
mysql-test/r/join_outer.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/metadata.result:
TIMESTAMP no longer has zerofill flag
mysql-test/r/range.result:
invalid datetime is not compared with as a string
mysql-test/r/select.result:
NO_ZERO_IN_DATE, etc only affect storage - according to the manual
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/subselect.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/sysdate_is_now.result:
when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/type_blob.result:
TIMESTAMP(N) is not deprecated
mysql-test/r/type_timestamp.result:
old TIMESTAMP(X) semantics is not supported anymore
mysql-test/r/union.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/varbinary.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/t/distinct.test:
test for an old MySQL bug
mysql-test/t/func_time.test:
+- INTERVAL now works with TIME values
mysql-test/t/select.test:
typo
mysql-test/t/subselect.test:
only one error per statement, please
mysql-test/t/system_mysql_db_fix40123.test:
old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50030.test:
old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50117.test:
old timestamp(X) is no longer supported
mysql-test/t/type_blob.test:
old timestamp(X) is no longer supported
mysql-test/t/type_timestamp.test:
old timestamp(X) is no longer supported
mysys/my_getsystime.c:
functions to get the time with microsecond precision
mysys/my_init.c:
move the my_getsystime.c initialization code to my_getsystime.c
mysys/my_static.c:
no need to make these variables extern
mysys/my_static.h:
no need to make these variables extern
scripts/mysql_system_tables.sql:
old timestamp(X) is no longer supported
scripts/mysql_system_tables_fix.sql:
old timestamp(X) is no longer supported
scripts/mysqlhotcopy.sh:
old timestamp(X) is no longer supported
sql-common/my_time.c:
* call str_to_time from str_to_datetime, as appropriate
* date/time to string conversions take precision as an argument
* number_to_time()
* TIME_to_double()
* pack_time() and unpack_time()
sql/event_data_objects.cc:
cast is not needed
my_datetime_to_str() takes precision as an argument
sql/event_db_repository.cc:
avoid dangerous downcast (because the pointer is
not always Field_timestamp, see events_1.test)
sql/event_queue.cc:
avoid silly double-work for cond_wait
(having an endpoint of wait, subtract the current time to get the timeout,
and use set_timespec() macro to fill in struct timespec, by adding the current
time to the timeout)
sql/field.cc:
* remove virtual Field::get_time(), everyone should use only Field::get_date()
* remove lots of #ifdef WORDS_BIGENDIAN
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
sql/field.h:
* remove virtual Field::get_time(), everyone should use only Field::get_date()
* remove lots of #ifdef WORDS_BIGENDIAN
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
* removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
sql/filesort.cc:
TIME_RESULT, cmp_time()
sql/item.cc:
* numbers aren't quoted in EXPLAIN EXTENDED
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* virtual Item::get_time() is gone
* Item_param::field_type() is set correctly
* Item_datetime, for a datetime constant
* time to anything is compared as a time
* Item_cache::print() prints the value is available
* bug fixed in Item_cache_int::val_str()
sql/item.h:
* Item::print_value(), to be used from Item_xxx::print() when needed
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* virtual Item::get_time() is gone
* Item_datetime, for a datetime constant
* better default for cast_to_int_type()
* Item_cache objects now *always* have the field_type() set
sql/item_cmpfunc.cc:
* get_year_value, get_time_value are gone. get_datetime_value does it all
* get_value_a_func, get_value_b_func are gone
* can_compare_as_dates() is gone too, TIME_RESULT is used instead
* cmp_type() instead or result_type() when doing a comparison
* compare_datetime and compate_e_datetime in the comparator_matrix, is_nulls_eq is gone
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
sql/item_cmpfunc.h:
greatly simplified Arg_comparator
sql/item_create.cc:
* fix a bug in error messages in CAST
sql/item_func.cc:
Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
mention all possibitiles in switch over Item_result values, or use default:
sql/item_row.h:
overwrite the default cmp_type() for Item_row,
as no MYSQL_TYPE_xxx value corresponds to ROW_RESULT
sql/item_timefunc.cc:
rewrite make_datetime to support precision argument
SEC_TO_TIME is real function, not integer.
many functions that returned temporal values had duplicate code in val_* methods,
some of them did not have get_date() which resulted in unnecessary date->str->date conversions.
Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
many fixes to set decimals (datetime precision) correctly.
sql/item_timefunc.h:
SEC_TO_TIME is real function, not integer.
many functions that returned temporal values had duplicate code in val_* methods,
some of them did not have get_date() which resulted in unnecessary date->str->date conversions.
Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
many fixes to set decimals (datetime precision) correctly.
sql/log_event.cc:
replication of NOW(6)
sql/log_event.h:
replication of NOW(6)
sql/mysql_priv.h:
Lazy_string class to pass a value (string, number, time) polymorphically down the stack.
make_truncated_value_warning() that uses it.
sql/mysqld.cc:
datetime in Arg_comparator::comparator_matrix
sql/opt_range.cc:
cleanup: don't disable warnings before calling save_in_field_no_warnings()
sql/protocol.cc:
Protocol::store(time) now takes the precision as an argument
sql/protocol.h:
Protocol::store(time) now takes the precision as an argument
sql/rpl_rli.cc:
small cleanup
sql/set_var.cc:
SET TIMESTAMP=double
sql/set_var.h:
@@TIMESTAMP is a double
sql/share/errmsg.txt:
precision and scale are unsigned
sql/slave.cc:
replication of NOW(6)
sql/sp_head.cc:
cleanup
sql/sql_class.cc:
support for NOW(6)
sql/sql_class.h:
support for NOW(6)
sql/sql_insert.cc:
support for NOW(6)
sql/sql_select.cc:
use item->cmp_type().
move a comment where it belongs
sql/sql_show.cc:
new column I_S.COLUMNS.DATETIME_PRECISION
sql/sql_yacc.yy:
TIME(X), DATETIME(X), cast, NOW(X), CURTIME(X), etc
sql/time.cc:
fix date_add_interval() to support MYSQL_TIMESTAMP_TIME argument
storage/myisam/ha_myisam.cc:
TIMESTAMP no longer carries ZEROFIELD flag, still we keep MYI file compatible.
strings/my_vsnprintf.c:
warnings
tests/mysql_client_test.c:
old timestamp(X) does not work anymore
datetime is no longer equal to time
2011-03-01 13:24:36 +01:00
|
|
|
}
|
2011-05-28 04:11:32 +02:00
|
|
|
static inline longlong sec_part_unshift(longlong second_part, uint digits)
|
wl#173 - temporal types with sub-second resolution
and collateral changes.
* introduce my_hrtime_t, my_timediff_t, and conversion macros
* inroduce TIME_RESULT, but it can only be returned from Item::cmp_type(),
never from Item::result_type()
* pack_time/unpack_time function for "packed" representation of
MYSQL_TIME in a longlong that can be compared
* ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
* numbers aren't quoted in EXPLAIN EXTENDED
* new column I_S.COLUMNS.DATETIME_PRECISION
* date/time values are compares to anything as date/time, not as strings or numbers.
* old timestamp(X) is no longer supported
* MYSQL_TIME to string conversion functions take precision as an argument
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* Lazy_string class to pass a value (string, number, time) polymorphically down the stack
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
* removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
* introduced Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* in many cases date/time types are treated like other types, not as special cases
* greatly simplified Arg_comparator (regarding date/time/year code)
* SEC_TO_TIME is real function, not integer.
* microsecond precision in NOW, CURTIME, etc
* Item_temporal. All items derived from it only provide get_date, but no val* methods
* replication of NOW(6)
* Protocol::store(time) now takes the precision as an argument
* @@TIMESTAMP is a double
client/mysqlbinlog.cc:
remove unneded casts
include/my_sys.h:
introduce my_hrtime_t, my_timediff_t, and conversion macros
include/my_time.h:
pack_time/unpack_time, etc.
convenience functions to work with MYSQL_TIME::second_part
libmysql/libmysql.c:
str_to_time() is gone. str_to_datetime() does it now.
my_TIME_to_str() takes the precision as an argument
mysql-test/include/ps_conv.inc:
time is not equal to datetime anymore
mysql-test/r/distinct.result:
a test for an old MySQL bug
mysql-test/r/explain.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_default.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_sapdb.result:
when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/func_test.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_time.result:
ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
mysql-test/r/having.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/information_schema.result:
new column I_S.COLUMNS.DATETIME_PRECISION
mysql-test/r/join_outer.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/metadata.result:
TIMESTAMP no longer has zerofill flag
mysql-test/r/range.result:
invalid datetime is not compared with as a string
mysql-test/r/select.result:
NO_ZERO_IN_DATE, etc only affect storage - according to the manual
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/subselect.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/sysdate_is_now.result:
when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/type_blob.result:
TIMESTAMP(N) is not deprecated
mysql-test/r/type_timestamp.result:
old TIMESTAMP(X) semantics is not supported anymore
mysql-test/r/union.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/varbinary.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/t/distinct.test:
test for an old MySQL bug
mysql-test/t/func_time.test:
+- INTERVAL now works with TIME values
mysql-test/t/select.test:
typo
mysql-test/t/subselect.test:
only one error per statement, please
mysql-test/t/system_mysql_db_fix40123.test:
old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50030.test:
old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50117.test:
old timestamp(X) is no longer supported
mysql-test/t/type_blob.test:
old timestamp(X) is no longer supported
mysql-test/t/type_timestamp.test:
old timestamp(X) is no longer supported
mysys/my_getsystime.c:
functions to get the time with microsecond precision
mysys/my_init.c:
move the my_getsystime.c initialization code to my_getsystime.c
mysys/my_static.c:
no need to make these variables extern
mysys/my_static.h:
no need to make these variables extern
scripts/mysql_system_tables.sql:
old timestamp(X) is no longer supported
scripts/mysql_system_tables_fix.sql:
old timestamp(X) is no longer supported
scripts/mysqlhotcopy.sh:
old timestamp(X) is no longer supported
sql-common/my_time.c:
* call str_to_time from str_to_datetime, as appropriate
* date/time to string conversions take precision as an argument
* number_to_time()
* TIME_to_double()
* pack_time() and unpack_time()
sql/event_data_objects.cc:
cast is not needed
my_datetime_to_str() takes precision as an argument
sql/event_db_repository.cc:
avoid dangerous downcast (because the pointer is
not always Field_timestamp, see events_1.test)
sql/event_queue.cc:
avoid silly double-work for cond_wait
(having an endpoint of wait, subtract the current time to get the timeout,
and use set_timespec() macro to fill in struct timespec, by adding the current
time to the timeout)
sql/field.cc:
* remove virtual Field::get_time(), everyone should use only Field::get_date()
* remove lots of #ifdef WORDS_BIGENDIAN
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
sql/field.h:
* remove virtual Field::get_time(), everyone should use only Field::get_date()
* remove lots of #ifdef WORDS_BIGENDIAN
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
* removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
sql/filesort.cc:
TIME_RESULT, cmp_time()
sql/item.cc:
* numbers aren't quoted in EXPLAIN EXTENDED
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* virtual Item::get_time() is gone
* Item_param::field_type() is set correctly
* Item_datetime, for a datetime constant
* time to anything is compared as a time
* Item_cache::print() prints the value is available
* bug fixed in Item_cache_int::val_str()
sql/item.h:
* Item::print_value(), to be used from Item_xxx::print() when needed
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* virtual Item::get_time() is gone
* Item_datetime, for a datetime constant
* better default for cast_to_int_type()
* Item_cache objects now *always* have the field_type() set
sql/item_cmpfunc.cc:
* get_year_value, get_time_value are gone. get_datetime_value does it all
* get_value_a_func, get_value_b_func are gone
* can_compare_as_dates() is gone too, TIME_RESULT is used instead
* cmp_type() instead or result_type() when doing a comparison
* compare_datetime and compate_e_datetime in the comparator_matrix, is_nulls_eq is gone
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
sql/item_cmpfunc.h:
greatly simplified Arg_comparator
sql/item_create.cc:
* fix a bug in error messages in CAST
sql/item_func.cc:
Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
mention all possibitiles in switch over Item_result values, or use default:
sql/item_row.h:
overwrite the default cmp_type() for Item_row,
as no MYSQL_TYPE_xxx value corresponds to ROW_RESULT
sql/item_timefunc.cc:
rewrite make_datetime to support precision argument
SEC_TO_TIME is real function, not integer.
many functions that returned temporal values had duplicate code in val_* methods,
some of them did not have get_date() which resulted in unnecessary date->str->date conversions.
Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
many fixes to set decimals (datetime precision) correctly.
sql/item_timefunc.h:
SEC_TO_TIME is real function, not integer.
many functions that returned temporal values had duplicate code in val_* methods,
some of them did not have get_date() which resulted in unnecessary date->str->date conversions.
Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
many fixes to set decimals (datetime precision) correctly.
sql/log_event.cc:
replication of NOW(6)
sql/log_event.h:
replication of NOW(6)
sql/mysql_priv.h:
Lazy_string class to pass a value (string, number, time) polymorphically down the stack.
make_truncated_value_warning() that uses it.
sql/mysqld.cc:
datetime in Arg_comparator::comparator_matrix
sql/opt_range.cc:
cleanup: don't disable warnings before calling save_in_field_no_warnings()
sql/protocol.cc:
Protocol::store(time) now takes the precision as an argument
sql/protocol.h:
Protocol::store(time) now takes the precision as an argument
sql/rpl_rli.cc:
small cleanup
sql/set_var.cc:
SET TIMESTAMP=double
sql/set_var.h:
@@TIMESTAMP is a double
sql/share/errmsg.txt:
precision and scale are unsigned
sql/slave.cc:
replication of NOW(6)
sql/sp_head.cc:
cleanup
sql/sql_class.cc:
support for NOW(6)
sql/sql_class.h:
support for NOW(6)
sql/sql_insert.cc:
support for NOW(6)
sql/sql_select.cc:
use item->cmp_type().
move a comment where it belongs
sql/sql_show.cc:
new column I_S.COLUMNS.DATETIME_PRECISION
sql/sql_yacc.yy:
TIME(X), DATETIME(X), cast, NOW(X), CURTIME(X), etc
sql/time.cc:
fix date_add_interval() to support MYSQL_TIMESTAMP_TIME argument
storage/myisam/ha_myisam.cc:
TIMESTAMP no longer carries ZEROFIELD flag, still we keep MYI file compatible.
strings/my_vsnprintf.c:
warnings
tests/mysql_client_test.c:
old timestamp(X) does not work anymore
datetime is no longer equal to time
2011-03-01 13:24:36 +01:00
|
|
|
{
|
2011-05-19 19:01:46 +02:00
|
|
|
return second_part * (longlong)log_10_int[TIME_SECOND_PART_DIGITS - digits];
|
wl#173 - temporal types with sub-second resolution
and collateral changes.
* introduce my_hrtime_t, my_timediff_t, and conversion macros
* inroduce TIME_RESULT, but it can only be returned from Item::cmp_type(),
never from Item::result_type()
* pack_time/unpack_time function for "packed" representation of
MYSQL_TIME in a longlong that can be compared
* ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
* numbers aren't quoted in EXPLAIN EXTENDED
* new column I_S.COLUMNS.DATETIME_PRECISION
* date/time values are compares to anything as date/time, not as strings or numbers.
* old timestamp(X) is no longer supported
* MYSQL_TIME to string conversion functions take precision as an argument
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* Lazy_string class to pass a value (string, number, time) polymorphically down the stack
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
* removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
* introduced Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* in many cases date/time types are treated like other types, not as special cases
* greatly simplified Arg_comparator (regarding date/time/year code)
* SEC_TO_TIME is real function, not integer.
* microsecond precision in NOW, CURTIME, etc
* Item_temporal. All items derived from it only provide get_date, but no val* methods
* replication of NOW(6)
* Protocol::store(time) now takes the precision as an argument
* @@TIMESTAMP is a double
client/mysqlbinlog.cc:
remove unneded casts
include/my_sys.h:
introduce my_hrtime_t, my_timediff_t, and conversion macros
include/my_time.h:
pack_time/unpack_time, etc.
convenience functions to work with MYSQL_TIME::second_part
libmysql/libmysql.c:
str_to_time() is gone. str_to_datetime() does it now.
my_TIME_to_str() takes the precision as an argument
mysql-test/include/ps_conv.inc:
time is not equal to datetime anymore
mysql-test/r/distinct.result:
a test for an old MySQL bug
mysql-test/r/explain.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_default.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_sapdb.result:
when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/func_test.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_time.result:
ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
mysql-test/r/having.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/information_schema.result:
new column I_S.COLUMNS.DATETIME_PRECISION
mysql-test/r/join_outer.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/metadata.result:
TIMESTAMP no longer has zerofill flag
mysql-test/r/range.result:
invalid datetime is not compared with as a string
mysql-test/r/select.result:
NO_ZERO_IN_DATE, etc only affect storage - according to the manual
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/subselect.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/sysdate_is_now.result:
when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/type_blob.result:
TIMESTAMP(N) is not deprecated
mysql-test/r/type_timestamp.result:
old TIMESTAMP(X) semantics is not supported anymore
mysql-test/r/union.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/varbinary.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/t/distinct.test:
test for an old MySQL bug
mysql-test/t/func_time.test:
+- INTERVAL now works with TIME values
mysql-test/t/select.test:
typo
mysql-test/t/subselect.test:
only one error per statement, please
mysql-test/t/system_mysql_db_fix40123.test:
old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50030.test:
old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50117.test:
old timestamp(X) is no longer supported
mysql-test/t/type_blob.test:
old timestamp(X) is no longer supported
mysql-test/t/type_timestamp.test:
old timestamp(X) is no longer supported
mysys/my_getsystime.c:
functions to get the time with microsecond precision
mysys/my_init.c:
move the my_getsystime.c initialization code to my_getsystime.c
mysys/my_static.c:
no need to make these variables extern
mysys/my_static.h:
no need to make these variables extern
scripts/mysql_system_tables.sql:
old timestamp(X) is no longer supported
scripts/mysql_system_tables_fix.sql:
old timestamp(X) is no longer supported
scripts/mysqlhotcopy.sh:
old timestamp(X) is no longer supported
sql-common/my_time.c:
* call str_to_time from str_to_datetime, as appropriate
* date/time to string conversions take precision as an argument
* number_to_time()
* TIME_to_double()
* pack_time() and unpack_time()
sql/event_data_objects.cc:
cast is not needed
my_datetime_to_str() takes precision as an argument
sql/event_db_repository.cc:
avoid dangerous downcast (because the pointer is
not always Field_timestamp, see events_1.test)
sql/event_queue.cc:
avoid silly double-work for cond_wait
(having an endpoint of wait, subtract the current time to get the timeout,
and use set_timespec() macro to fill in struct timespec, by adding the current
time to the timeout)
sql/field.cc:
* remove virtual Field::get_time(), everyone should use only Field::get_date()
* remove lots of #ifdef WORDS_BIGENDIAN
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
sql/field.h:
* remove virtual Field::get_time(), everyone should use only Field::get_date()
* remove lots of #ifdef WORDS_BIGENDIAN
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
* removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
sql/filesort.cc:
TIME_RESULT, cmp_time()
sql/item.cc:
* numbers aren't quoted in EXPLAIN EXTENDED
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* virtual Item::get_time() is gone
* Item_param::field_type() is set correctly
* Item_datetime, for a datetime constant
* time to anything is compared as a time
* Item_cache::print() prints the value is available
* bug fixed in Item_cache_int::val_str()
sql/item.h:
* Item::print_value(), to be used from Item_xxx::print() when needed
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* virtual Item::get_time() is gone
* Item_datetime, for a datetime constant
* better default for cast_to_int_type()
* Item_cache objects now *always* have the field_type() set
sql/item_cmpfunc.cc:
* get_year_value, get_time_value are gone. get_datetime_value does it all
* get_value_a_func, get_value_b_func are gone
* can_compare_as_dates() is gone too, TIME_RESULT is used instead
* cmp_type() instead or result_type() when doing a comparison
* compare_datetime and compate_e_datetime in the comparator_matrix, is_nulls_eq is gone
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
sql/item_cmpfunc.h:
greatly simplified Arg_comparator
sql/item_create.cc:
* fix a bug in error messages in CAST
sql/item_func.cc:
Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
mention all possibitiles in switch over Item_result values, or use default:
sql/item_row.h:
overwrite the default cmp_type() for Item_row,
as no MYSQL_TYPE_xxx value corresponds to ROW_RESULT
sql/item_timefunc.cc:
rewrite make_datetime to support precision argument
SEC_TO_TIME is real function, not integer.
many functions that returned temporal values had duplicate code in val_* methods,
some of them did not have get_date() which resulted in unnecessary date->str->date conversions.
Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
many fixes to set decimals (datetime precision) correctly.
sql/item_timefunc.h:
SEC_TO_TIME is real function, not integer.
many functions that returned temporal values had duplicate code in val_* methods,
some of them did not have get_date() which resulted in unnecessary date->str->date conversions.
Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
many fixes to set decimals (datetime precision) correctly.
sql/log_event.cc:
replication of NOW(6)
sql/log_event.h:
replication of NOW(6)
sql/mysql_priv.h:
Lazy_string class to pass a value (string, number, time) polymorphically down the stack.
make_truncated_value_warning() that uses it.
sql/mysqld.cc:
datetime in Arg_comparator::comparator_matrix
sql/opt_range.cc:
cleanup: don't disable warnings before calling save_in_field_no_warnings()
sql/protocol.cc:
Protocol::store(time) now takes the precision as an argument
sql/protocol.h:
Protocol::store(time) now takes the precision as an argument
sql/rpl_rli.cc:
small cleanup
sql/set_var.cc:
SET TIMESTAMP=double
sql/set_var.h:
@@TIMESTAMP is a double
sql/share/errmsg.txt:
precision and scale are unsigned
sql/slave.cc:
replication of NOW(6)
sql/sp_head.cc:
cleanup
sql/sql_class.cc:
support for NOW(6)
sql/sql_class.h:
support for NOW(6)
sql/sql_insert.cc:
support for NOW(6)
sql/sql_select.cc:
use item->cmp_type().
move a comment where it belongs
sql/sql_show.cc:
new column I_S.COLUMNS.DATETIME_PRECISION
sql/sql_yacc.yy:
TIME(X), DATETIME(X), cast, NOW(X), CURTIME(X), etc
sql/time.cc:
fix date_add_interval() to support MYSQL_TIMESTAMP_TIME argument
storage/myisam/ha_myisam.cc:
TIMESTAMP no longer carries ZEROFIELD flag, still we keep MYI file compatible.
strings/my_vsnprintf.c:
warnings
tests/mysql_client_test.c:
old timestamp(X) does not work anymore
datetime is no longer equal to time
2011-03-01 13:24:36 +01:00
|
|
|
}
|
2013-07-10 09:49:17 +02:00
|
|
|
|
|
|
|
/* Date/time rounding and truncation functions */
|
|
|
|
static inline long my_time_fraction_remainder(long nr, uint decimals)
|
|
|
|
{
|
|
|
|
DBUG_ASSERT(decimals <= TIME_SECOND_PART_DIGITS);
|
|
|
|
return nr % (long) log_10_int[TIME_SECOND_PART_DIGITS - decimals];
|
|
|
|
}
|
2020-07-28 15:32:19 +02:00
|
|
|
static inline void my_datetime_trunc(MYSQL_TIME *ltime, uint decimals)
|
|
|
|
{
|
|
|
|
ltime->second_part-= my_time_fraction_remainder(ltime->second_part, decimals);
|
|
|
|
}
|
2013-07-10 09:49:17 +02:00
|
|
|
static inline void my_time_trunc(MYSQL_TIME *ltime, uint decimals)
|
|
|
|
{
|
|
|
|
ltime->second_part-= my_time_fraction_remainder(ltime->second_part, decimals);
|
2020-07-28 15:32:19 +02:00
|
|
|
if (!ltime->second_part && ltime->neg &&
|
|
|
|
!ltime->hour && !ltime->minute && !ltime->second)
|
|
|
|
ltime->neg= FALSE;
|
2013-07-10 09:49:17 +02:00
|
|
|
}
|
2022-04-01 07:07:12 +02:00
|
|
|
#ifdef _WIN32
|
|
|
|
#define suseconds_t long
|
|
|
|
#endif
|
2013-07-10 09:49:17 +02:00
|
|
|
|
2011-03-26 11:59:34 +01:00
|
|
|
#define hrtime_to_my_time(X) ((my_time_t)hrtime_to_time(X))
|
2004-10-15 22:12:59 +02:00
|
|
|
|
2006-10-11 10:17:39 +02:00
|
|
|
/*
|
|
|
|
Available interval types used in any statement.
|
|
|
|
|
|
|
|
'interval_type' must be sorted so that simple intervals comes first,
|
|
|
|
ie year, quarter, month, week, day, hour, etc. The order based on
|
|
|
|
interval size is also important and the intervals should be kept in a
|
|
|
|
large to smaller order. (get_interval_value() depends on this)
|
|
|
|
|
|
|
|
Note: If you change the order of elements in this enum you should fix
|
|
|
|
order of elements in 'interval_type_to_name' and 'interval_names'
|
|
|
|
arrays
|
|
|
|
|
2018-02-19 15:53:31 +01:00
|
|
|
See also interval_type_to_name, get_interval_value, interval_names, append_interval
|
2006-01-18 20:41:22 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
enum interval_type
|
|
|
|
{
|
2006-10-11 10:17:39 +02:00
|
|
|
INTERVAL_YEAR, INTERVAL_QUARTER, INTERVAL_MONTH, INTERVAL_WEEK, INTERVAL_DAY,
|
|
|
|
INTERVAL_HOUR, INTERVAL_MINUTE, INTERVAL_SECOND, INTERVAL_MICROSECOND,
|
2006-01-18 20:41:22 +01:00
|
|
|
INTERVAL_YEAR_MONTH, INTERVAL_DAY_HOUR, INTERVAL_DAY_MINUTE,
|
|
|
|
INTERVAL_DAY_SECOND, INTERVAL_HOUR_MINUTE, INTERVAL_HOUR_SECOND,
|
|
|
|
INTERVAL_MINUTE_SECOND, INTERVAL_DAY_MICROSECOND, INTERVAL_HOUR_MICROSECOND,
|
2006-06-08 23:07:11 +02:00
|
|
|
INTERVAL_MINUTE_MICROSECOND, INTERVAL_SECOND_MICROSECOND, INTERVAL_LAST
|
2006-01-18 20:41:22 +01:00
|
|
|
};
|
|
|
|
|
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 17:08:36 +02:00
|
|
|
C_MODE_END
|
|
|
|
|
|
|
|
#endif /* _my_time_h_ */
|