Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
2e5063f9
Commit
2e5063f9
authored
Oct 11, 2006
by
Kristofer.Pettersson@naruto
Browse files
Options
Browse Files
Download
Plain Diff
Merge naruto.:C:/cpp/bug21811/my51-bug21811
into naruto.:C:/cpp/mysql-5.1-new-maint
parents
9cb8ea76
3ef964bb
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
63 additions
and
11 deletions
+63
-11
include/my_time.h
include/my_time.h
+15
-5
mysql-test/r/func_date_add.result
mysql-test/r/func_date_add.result
+14
-0
mysql-test/r/func_time.result
mysql-test/r/func_time.result
+2
-2
mysql-test/t/func_date_add.test
mysql-test/t/func_date_add.test
+14
-1
sql/item_timefunc.cc
sql/item_timefunc.cc
+6
-2
sql/time.cc
sql/time.cc
+12
-1
No files found.
include/my_time.h
View file @
2e5063f9
...
@@ -98,14 +98,24 @@ int my_datetime_to_str(const MYSQL_TIME *l_time, char *to);
...
@@ -98,14 +98,24 @@ int my_datetime_to_str(const MYSQL_TIME *l_time, char *to);
int
my_TIME_to_str
(
const
MYSQL_TIME
*
l_time
,
char
*
to
);
int
my_TIME_to_str
(
const
MYSQL_TIME
*
l_time
,
char
*
to
);
/*
/*
The following must be sorted so that simple intervals comes first.
Available interval types used in any statement.
(get_interval_value() depends on this)
'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
See also interval_type_to_name, get_interval_value, interval_names
*/
*/
enum
interval_type
enum
interval_type
{
{
INTERVAL_YEAR
,
INTERVAL_QUARTER
,
INTERVAL_MONTH
,
INTERVAL_
DAY
,
INTERVAL_HOUR
,
INTERVAL_YEAR
,
INTERVAL_QUARTER
,
INTERVAL_MONTH
,
INTERVAL_
WEEK
,
INTERVAL_DAY
,
INTERVAL_
MINUTE
,
INTERVAL_WEEK
,
INTERVAL_SECOND
,
INTERVAL_MICROSECOND
,
INTERVAL_
HOUR
,
INTERVAL_MINUTE
,
INTERVAL_SECOND
,
INTERVAL_MICROSECOND
,
INTERVAL_YEAR_MONTH
,
INTERVAL_DAY_HOUR
,
INTERVAL_DAY_MINUTE
,
INTERVAL_YEAR_MONTH
,
INTERVAL_DAY_HOUR
,
INTERVAL_DAY_MINUTE
,
INTERVAL_DAY_SECOND
,
INTERVAL_HOUR_MINUTE
,
INTERVAL_HOUR_SECOND
,
INTERVAL_DAY_SECOND
,
INTERVAL_HOUR_MINUTE
,
INTERVAL_HOUR_SECOND
,
INTERVAL_MINUTE_SECOND
,
INTERVAL_DAY_MICROSECOND
,
INTERVAL_HOUR_MICROSECOND
,
INTERVAL_MINUTE_SECOND
,
INTERVAL_DAY_MICROSECOND
,
INTERVAL_HOUR_MICROSECOND
,
...
...
mysql-test/r/func_date_add.result
View file @
2e5063f9
...
@@ -71,3 +71,17 @@ NULL
...
@@ -71,3 +71,17 @@ NULL
NULL
NULL
NULL
NULL
drop table t1;
drop table t1;
End of 4.1 tests
SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 DAY;
CAST('2006-09-26' AS DATE) + INTERVAL 1 DAY
2006-09-27
SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 MONTH;
CAST('2006-09-26' AS DATE) + INTERVAL 1 MONTH
2006-10-26
SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 YEAR;
CAST('2006-09-26' AS DATE) + INTERVAL 1 YEAR
2007-09-26
SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 WEEK;
CAST('2006-09-26' AS DATE) + INTERVAL 1 WEEK
2006-10-03
End of 5.0 tests
mysql-test/r/func_time.result
View file @
2e5063f9
...
@@ -612,7 +612,7 @@ date_add(date,INTERVAL "1 1:1:1" DAY_SECOND)
...
@@ -612,7 +612,7 @@ date_add(date,INTERVAL "1 1:1:1" DAY_SECOND)
2003-01-03 01:01:01
2003-01-03 01:01:01
select date_add(date,INTERVAL "1" WEEK) from t1;
select date_add(date,INTERVAL "1" WEEK) from t1;
date_add(date,INTERVAL "1" WEEK)
date_add(date,INTERVAL "1" WEEK)
2003-01-09
00:00:00
2003-01-09
select date_add(date,INTERVAL "1" QUARTER) from t1;
select date_add(date,INTERVAL "1" QUARTER) from t1;
date_add(date,INTERVAL "1" QUARTER)
date_add(date,INTERVAL "1" QUARTER)
2003-04-02
2003-04-02
...
@@ -621,7 +621,7 @@ timestampadd(MINUTE, 1, date)
...
@@ -621,7 +621,7 @@ timestampadd(MINUTE, 1, date)
2003-01-02 00:01:00
2003-01-02 00:01:00
select timestampadd(WEEK, 1, date) from t1;
select timestampadd(WEEK, 1, date) from t1;
timestampadd(WEEK, 1, date)
timestampadd(WEEK, 1, date)
2003-01-09
00:00:00
2003-01-09
select timestampadd(SQL_TSI_SECOND, 1, date) from t1;
select timestampadd(SQL_TSI_SECOND, 1, date) from t1;
timestampadd(SQL_TSI_SECOND, 1, date)
timestampadd(SQL_TSI_SECOND, 1, date)
2003-01-02 00:00:01
2003-01-02 00:00:01
...
...
mysql-test/t/func_date_add.test
View file @
2e5063f9
...
@@ -64,4 +64,17 @@ insert into t1 values (date_add('2000-01-04', INTERVAL NULL DAY));
...
@@ -64,4 +64,17 @@ insert into t1 values (date_add('2000-01-04', INTERVAL NULL DAY));
select
*
from
t1
;
select
*
from
t1
;
drop
table
t1
;
drop
table
t1
;
# End of 4.1 tests
--
echo
End
of
4.1
tests
#
# Bug#21811
#
# Make sure we end up with an appropriate
# date format (DATE) after addition operation
#
SELECT
CAST
(
'2006-09-26'
AS
DATE
)
+
INTERVAL
1
DAY
;
SELECT
CAST
(
'2006-09-26'
AS
DATE
)
+
INTERVAL
1
MONTH
;
SELECT
CAST
(
'2006-09-26'
AS
DATE
)
+
INTERVAL
1
YEAR
;
SELECT
CAST
(
'2006-09-26'
AS
DATE
)
+
INTERVAL
1
WEEK
;
--
echo
End
of
5.0
tests
sql/item_timefunc.cc
View file @
2e5063f9
...
@@ -2030,11 +2030,15 @@ bool Item_date_add_interval::eq(const Item *item, bool binary_cmp) const
...
@@ -2030,11 +2030,15 @@ bool Item_date_add_interval::eq(const Item *item, bool binary_cmp) const
(
date_sub_interval
==
other
->
date_sub_interval
));
(
date_sub_interval
==
other
->
date_sub_interval
));
}
}
/*
'interval_names' reflects the order of the enumeration interval_type.
See item_timefunc.h
*/
static
const
char
*
interval_names
[]
=
static
const
char
*
interval_names
[]
=
{
{
"year"
,
"quarter"
,
"month"
,
"
day"
,
"hour"
,
"year"
,
"quarter"
,
"month"
,
"
week"
,
"day"
,
"
minute"
,
"week
"
,
"second"
,
"microsecond"
,
"
hour"
,
"minute
"
,
"second"
,
"microsecond"
,
"year_month"
,
"day_hour"
,
"day_minute"
,
"year_month"
,
"day_hour"
,
"day_minute"
,
"day_second"
,
"hour_minute"
,
"hour_second"
,
"day_second"
,
"hour_minute"
,
"hour_second"
,
"minute_second"
,
"day_microsecond"
,
"minute_second"
,
"day_microsecond"
,
...
...
sql/time.cc
View file @
2e5063f9
...
@@ -25,14 +25,25 @@
...
@@ -25,14 +25,25 @@
#ifndef TESTTIME
#ifndef TESTTIME
/*
Name description of interval names used in statements.
'interval_type_to_name' is ordered and sorted on interval size and
interval complexity.
Order of elements in 'interval_type_to_name' should correspond to
the order of elements in 'interval_type' enum
See also interval_type, interval_names
*/
LEX_STRING
interval_type_to_name
[
INTERVAL_LAST
]
=
{
LEX_STRING
interval_type_to_name
[
INTERVAL_LAST
]
=
{
{
C_STRING_WITH_LEN
(
"YEAR"
)},
{
C_STRING_WITH_LEN
(
"YEAR"
)},
{
C_STRING_WITH_LEN
(
"QUARTER"
)},
{
C_STRING_WITH_LEN
(
"QUARTER"
)},
{
C_STRING_WITH_LEN
(
"MONTH"
)},
{
C_STRING_WITH_LEN
(
"MONTH"
)},
{
C_STRING_WITH_LEN
(
"WEEK"
)},
{
C_STRING_WITH_LEN
(
"DAY"
)},
{
C_STRING_WITH_LEN
(
"DAY"
)},
{
C_STRING_WITH_LEN
(
"HOUR"
)},
{
C_STRING_WITH_LEN
(
"HOUR"
)},
{
C_STRING_WITH_LEN
(
"MINUTE"
)},
{
C_STRING_WITH_LEN
(
"MINUTE"
)},
{
C_STRING_WITH_LEN
(
"WEEK"
)},
{
C_STRING_WITH_LEN
(
"SECOND"
)},
{
C_STRING_WITH_LEN
(
"SECOND"
)},
{
C_STRING_WITH_LEN
(
"MICROSECOND"
)},
{
C_STRING_WITH_LEN
(
"MICROSECOND"
)},
{
C_STRING_WITH_LEN
(
"YEAR_MONTH"
)},
{
C_STRING_WITH_LEN
(
"YEAR_MONTH"
)},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment