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
197bef38
Commit
197bef38
authored
Apr 27, 2011
by
Sergey Glukhov
Browse files
Options
Browse Files
Download
Plain Diff
5.1 -> 5.5 merge
parents
85f6ec59
a60c39a2
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
4 deletions
+25
-4
mysql-test/r/func_time.result
mysql-test/r/func_time.result
+12
-0
mysql-test/t/func_time.test
mysql-test/t/func_time.test
+8
-0
sql-common/my_time.c
sql-common/my_time.c
+2
-1
sql/item_timefunc.cc
sql/item_timefunc.cc
+3
-3
No files found.
mysql-test/r/func_time.result
View file @
197bef38
...
@@ -1377,6 +1377,18 @@ NULL
...
@@ -1377,6 +1377,18 @@ NULL
SELECT ADDDATE(MONTH(FROM_UNIXTIME(NULL)),INTERVAL 1 HOUR);
SELECT ADDDATE(MONTH(FROM_UNIXTIME(NULL)),INTERVAL 1 HOUR);
ADDDATE(MONTH(FROM_UNIXTIME(NULL)),INTERVAL 1 HOUR)
ADDDATE(MONTH(FROM_UNIXTIME(NULL)),INTERVAL 1 HOUR)
NULL
NULL
#
# Bug#11889186 60503: CRASH IN MAKE_DATE_TIME WITH DATE_FORMAT / STR_TO_DATE COMBINATION
#
SELECT DATE_FORMAT('0000-00-11', '%W');
DATE_FORMAT('0000-00-11', '%W')
NULL
SELECT DATE_FORMAT('0000-00-11', '%a');
DATE_FORMAT('0000-00-11', '%a')
NULL
SELECT DATE_FORMAT('0000-00-11', '%w');
DATE_FORMAT('0000-00-11', '%w')
NULL
End of 5.1 tests
End of 5.1 tests
#
#
# Bug#57039: constant subtime expression returns incorrect result.
# Bug#57039: constant subtime expression returns incorrect result.
...
...
mysql-test/t/func_time.test
View file @
197bef38
...
@@ -894,6 +894,14 @@ SELECT CAST((MONTH(FROM_UNIXTIME(@@GLOBAL.SQL_MODE))) AS BINARY(1025));
...
@@ -894,6 +894,14 @@ SELECT CAST((MONTH(FROM_UNIXTIME(@@GLOBAL.SQL_MODE))) AS BINARY(1025));
SELECT
ADDDATE
(
MONTH
(
FROM_UNIXTIME
(
NULL
)),
INTERVAL
1
HOUR
);
SELECT
ADDDATE
(
MONTH
(
FROM_UNIXTIME
(
NULL
)),
INTERVAL
1
HOUR
);
--
echo
#
--
echo
# Bug#11889186 60503: CRASH IN MAKE_DATE_TIME WITH DATE_FORMAT / STR_TO_DATE COMBINATION
--
echo
#
SELECT
DATE_FORMAT
(
'0000-00-11'
,
'%W'
);
SELECT
DATE_FORMAT
(
'0000-00-11'
,
'%a'
);
SELECT
DATE_FORMAT
(
'0000-00-11'
,
'%w'
);
--
echo
End
of
5.1
tests
--
echo
End
of
5.1
tests
--
echo
#
--
echo
#
...
...
sql-common/my_time.c
View file @
197bef38
...
@@ -772,7 +772,7 @@ long calc_daynr(uint year,uint month,uint day)
...
@@ -772,7 +772,7 @@ long calc_daynr(uint year,uint month,uint day)
int
y
=
year
;
/* may be < 0 temporarily */
int
y
=
year
;
/* may be < 0 temporarily */
DBUG_ENTER
(
"calc_daynr"
);
DBUG_ENTER
(
"calc_daynr"
);
if
(
y
==
0
&&
month
==
0
&&
day
==
0
)
if
(
y
==
0
&&
month
==
0
)
DBUG_RETURN
(
0
);
/* Skip errors */
DBUG_RETURN
(
0
);
/* Skip errors */
/* Cast to int to be able to handle month == 0 */
/* Cast to int to be able to handle month == 0 */
delsum
=
(
long
)
(
365
*
y
+
31
*
((
int
)
month
-
1
)
+
(
int
)
day
);
delsum
=
(
long
)
(
365
*
y
+
31
*
((
int
)
month
-
1
)
+
(
int
)
day
);
...
@@ -783,6 +783,7 @@ long calc_daynr(uint year,uint month,uint day)
...
@@ -783,6 +783,7 @@ long calc_daynr(uint year,uint month,uint day)
temp
=
(
int
)
((
y
/
100
+
1
)
*
3
)
/
4
;
temp
=
(
int
)
((
y
/
100
+
1
)
*
3
)
/
4
;
DBUG_PRINT
(
"exit"
,(
"year: %d month: %d day: %d -> daynr: %ld"
,
DBUG_PRINT
(
"exit"
,(
"year: %d month: %d day: %d -> daynr: %ld"
,
y
+
(
month
<=
2
),
month
,
day
,
delsum
+
y
/
4
-
temp
));
y
+
(
month
<=
2
),
month
,
day
,
delsum
+
y
/
4
-
temp
));
DBUG_ASSERT
(
delsum
+
(
int
)
y
/
4
-
temp
>
0
);
DBUG_RETURN
(
delsum
+
(
int
)
y
/
4
-
temp
);
DBUG_RETURN
(
delsum
+
(
int
)
y
/
4
-
temp
);
}
/* calc_daynr */
}
/* calc_daynr */
...
...
sql/item_timefunc.cc
View file @
197bef38
...
@@ -669,7 +669,7 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
...
@@ -669,7 +669,7 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
system_charset_info
);
system_charset_info
);
break
;
break
;
case
'W'
:
case
'W'
:
if
(
type
==
MYSQL_TIMESTAMP_TIME
)
if
(
type
==
MYSQL_TIMESTAMP_TIME
||
!
(
l_time
->
month
||
l_time
->
year
)
)
return
1
;
return
1
;
weekday
=
calc_weekday
(
calc_daynr
(
l_time
->
year
,
l_time
->
month
,
weekday
=
calc_weekday
(
calc_daynr
(
l_time
->
year
,
l_time
->
month
,
l_time
->
day
),
0
);
l_time
->
day
),
0
);
...
@@ -678,7 +678,7 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
...
@@ -678,7 +678,7 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
system_charset_info
);
system_charset_info
);
break
;
break
;
case
'a'
:
case
'a'
:
if
(
type
==
MYSQL_TIMESTAMP_TIME
)
if
(
type
==
MYSQL_TIMESTAMP_TIME
||
!
(
l_time
->
month
||
l_time
->
year
)
)
return
1
;
return
1
;
weekday
=
calc_weekday
(
calc_daynr
(
l_time
->
year
,
l_time
->
month
,
weekday
=
calc_weekday
(
calc_daynr
(
l_time
->
year
,
l_time
->
month
,
l_time
->
day
),
0
);
l_time
->
day
),
0
);
...
@@ -837,7 +837,7 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
...
@@ -837,7 +837,7 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
}
}
break
;
break
;
case
'w'
:
case
'w'
:
if
(
type
==
MYSQL_TIMESTAMP_TIME
)
if
(
type
==
MYSQL_TIMESTAMP_TIME
||
!
(
l_time
->
month
||
l_time
->
year
)
)
return
1
;
return
1
;
weekday
=
calc_weekday
(
calc_daynr
(
l_time
->
year
,
l_time
->
month
,
weekday
=
calc_weekday
(
calc_daynr
(
l_time
->
year
,
l_time
->
month
,
l_time
->
day
),
1
);
l_time
->
day
),
1
);
...
...
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