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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
7ca3749f
Commit
7ca3749f
authored
Jun 29, 2006
by
konstantin@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/opt/local/work/tmp_merge
into mysql.com:/opt/local/work/mysql-5.0-merge
parents
3010430d
49cc2904
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
6 deletions
+25
-6
mysql-test/r/func_sapdb.result
mysql-test/r/func_sapdb.result
+6
-0
mysql-test/r/func_time.result
mysql-test/r/func_time.result
+6
-0
mysql-test/t/func_sapdb.test
mysql-test/t/func_sapdb.test
+2
-0
mysql-test/t/func_time.test
mysql-test/t/func_time.test
+5
-1
sql/item_timefunc.cc
sql/item_timefunc.cc
+6
-5
No files found.
mysql-test/r/func_sapdb.result
View file @
7ca3749f
...
...
@@ -81,6 +81,12 @@ makedate(1997,1)
select makedate(1997,0);
makedate(1997,0)
NULL
select makedate(9999,365);
makedate(9999,365)
9999-12-31
select makedate(9999,366);
makedate(9999,366)
NULL
select addtime("1997-12-31 23:59:59.999999", "1 1:1:1.000002");
addtime("1997-12-31 23:59:59.999999", "1 1:1:1.000002")
1998-01-02 01:01:01.000001
...
...
mysql-test/r/func_time.result
View file @
7ca3749f
...
...
@@ -397,6 +397,12 @@ quarter
SELECT EXTRACT(QUARTER FROM '2004-12-15') AS quarter;
quarter
4
SELECT DATE_SUB(str_to_date('9999-12-31 00:01:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE);
DATE_SUB(str_to_date('9999-12-31 00:01:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE)
9999-12-31 00:00:00
SELECT DATE_ADD(str_to_date('9999-12-30 23:59:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE);
DATE_ADD(str_to_date('9999-12-30 23:59:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE)
9999-12-31 00:00:00
SELECT "1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND;
"1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND
1968-01-20 03:14:08
...
...
mysql-test/t/func_sapdb.test
View file @
7ca3749f
...
...
@@ -43,6 +43,8 @@ select weekofyear("1997-11-30 23:59:59.000001");
select
makedate
(
1997
,
1
);
select
makedate
(
1997
,
0
);
select
makedate
(
9999
,
365
);
select
makedate
(
9999
,
366
);
#Time functions
...
...
mysql-test/t/func_time.test
View file @
7ca3749f
...
...
@@ -158,7 +158,11 @@ SELECT EXTRACT(QUARTER FROM '2004-09-15') AS quarter;
SELECT
EXTRACT
(
QUARTER
FROM
'2004-10-15'
)
AS
quarter
;
SELECT
EXTRACT
(
QUARTER
FROM
'2004-11-15'
)
AS
quarter
;
SELECT
EXTRACT
(
QUARTER
FROM
'2004-12-15'
)
AS
quarter
;
#
# MySQL Bugs: #12356: DATE_SUB or DATE_ADD incorrectly returns null
#
SELECT
DATE_SUB
(
str_to_date
(
'9999-12-31 00:01:00'
,
'%Y-%m-%d %H:%i:%s'
),
INTERVAL
1
MINUTE
);
SELECT
DATE_ADD
(
str_to_date
(
'9999-12-30 23:59:00'
,
'%Y-%m-%d %H:%i:%s'
),
INTERVAL
1
MINUTE
);
#
# Test big intervals (Bug #3498)
...
...
sql/item_timefunc.cc
View file @
7ca3749f
...
...
@@ -27,6 +27,7 @@
/* TODO: Move month and days to language files */
/* Day number for Dec 31st, 9999 */
#define MAX_DAY_NUMBER 3652424L
static
const
char
*
month_names
[]
=
...
...
@@ -408,7 +409,7 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
if
(
yearday
>
0
)
{
uint
days
=
calc_daynr
(
l_time
->
year
,
1
,
1
)
+
yearday
-
1
;
if
(
days
<=
0
||
days
>
=
MAX_DAY_NUMBER
)
if
(
days
<=
0
||
days
>
MAX_DAY_NUMBER
)
goto
err
;
get_date_from_daynr
(
days
,
&
l_time
->
year
,
&
l_time
->
month
,
&
l_time
->
day
);
}
...
...
@@ -454,7 +455,7 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
(
weekday
-
1
);
}
if
(
days
<=
0
||
days
>
=
MAX_DAY_NUMBER
)
if
(
days
<=
0
||
days
>
MAX_DAY_NUMBER
)
goto
err
;
get_date_from_daynr
(
days
,
&
l_time
->
year
,
&
l_time
->
month
,
&
l_time
->
day
);
}
...
...
@@ -2035,7 +2036,7 @@ bool Item_date_add_interval::get_date(TIME *ltime, uint fuzzy_date)
ltime
->
hour
=
(
uint
)
(
sec
/
3600
);
daynr
=
calc_daynr
(
ltime
->
year
,
ltime
->
month
,
1
)
+
days
;
/* Day number from year 0 to 9999-12-31 */
if
((
ulonglong
)
daynr
>
=
MAX_DAY_NUMBER
)
if
((
ulonglong
)
daynr
>
MAX_DAY_NUMBER
)
goto
invalid_date
;
get_date_from_daynr
((
long
)
daynr
,
&
ltime
->
year
,
&
ltime
->
month
,
&
ltime
->
day
);
...
...
@@ -2046,7 +2047,7 @@ bool Item_date_add_interval::get_date(TIME *ltime, uint fuzzy_date)
period
=
(
calc_daynr
(
ltime
->
year
,
ltime
->
month
,
ltime
->
day
)
+
sign
*
(
long
)
interval
.
day
);
/* Daynumber from year 0 to 9999-12-31 */
if
((
ulong
)
period
>
=
MAX_DAY_NUMBER
)
if
((
ulong
)
period
>
MAX_DAY_NUMBER
)
goto
invalid_date
;
get_date_from_daynr
((
long
)
period
,
&
ltime
->
year
,
&
ltime
->
month
,
&
ltime
->
day
);
break
;
...
...
@@ -2570,7 +2571,7 @@ String *Item_func_makedate::val_str(String *str)
days
=
calc_daynr
(
yearnr
,
1
,
1
)
+
daynr
-
1
;
/* Day number from year 0 to 9999-12-31 */
if
(
days
>=
0
&&
days
<
MAX_DAY_NUMBER
)
if
(
days
>=
0
&&
days
<
=
MAX_DAY_NUMBER
)
{
null_value
=
0
;
get_date_from_daynr
(
days
,
&
l_time
.
year
,
&
l_time
.
month
,
&
l_time
.
day
);
...
...
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