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
093ad36c
Commit
093ad36c
authored
Jan 09, 2009
by
Tatiana A. Nurnberg
Browse files
Options
Browse Files
Download
Plain Diff
auto-merge
parents
4f76ed9b
1dee1dd4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
6 deletions
+29
-6
mysql-test/r/date_formats.result
mysql-test/r/date_formats.result
+10
-0
mysql-test/t/date_formats.test
mysql-test/t/date_formats.test
+12
-0
sql-common/my_time.c
sql-common/my_time.c
+7
-6
No files found.
mysql-test/r/date_formats.result
View file @
093ad36c
...
@@ -590,3 +590,13 @@ select str_to_date('04/30/2004 ', '%m/%d/%Y ');
...
@@ -590,3 +590,13 @@ select str_to_date('04/30/2004 ', '%m/%d/%Y ');
str_to_date('04/30/2004 ', '%m/%d/%Y ')
str_to_date('04/30/2004 ', '%m/%d/%Y ')
2004-04-30
2004-04-30
"End of 4.1 tests"
"End of 4.1 tests"
SELECT DATE_FORMAT("0000-01-01",'%W %d %M %Y') as valid_date;
valid_date
Sunday 01 January 0000
SELECT DATE_FORMAT("0000-02-28",'%W %d %M %Y') as valid_date;
valid_date
Tuesday 28 February 0000
SELECT DATE_FORMAT("2009-01-01",'%W %d %M %Y') as valid_date;
valid_date
Thursday 01 January 2009
"End of 5.0 tests"
mysql-test/t/date_formats.test
View file @
093ad36c
...
@@ -340,3 +340,15 @@ select str_to_date('04/30 /2004', '%m /%d /%Y');
...
@@ -340,3 +340,15 @@ select str_to_date('04/30 /2004', '%m /%d /%Y');
select
str_to_date
(
'04/30/2004 '
,
'%m/%d/%Y '
);
select
str_to_date
(
'04/30/2004 '
,
'%m/%d/%Y '
);
--
echo
"End of 4.1 tests"
--
echo
"End of 4.1 tests"
#
# Bug #41470: DATE_FORMAT() crashes the complete server with a valid date
#
# show that these two do not crash the server:
SELECT
DATE_FORMAT
(
"0000-01-01"
,
'%W %d %M %Y'
)
as
valid_date
;
SELECT
DATE_FORMAT
(
"0000-02-28"
,
'%W %d %M %Y'
)
as
valid_date
;
# show that date within the Gregorian range render correct results: (THU)
SELECT
DATE_FORMAT
(
"2009-01-01"
,
'%W %d %M %Y'
)
as
valid_date
;
--
echo
"End of 5.0 tests"
sql-common/my_time.c
View file @
093ad36c
...
@@ -762,19 +762,20 @@ long calc_daynr(uint year,uint month,uint day)
...
@@ -762,19 +762,20 @@ long calc_daynr(uint year,uint month,uint day)
{
{
long
delsum
;
long
delsum
;
int
temp
;
int
temp
;
int
y
=
year
;
/* may be < 0 temporarily */
DBUG_ENTER
(
"calc_daynr"
);
DBUG_ENTER
(
"calc_daynr"
);
if
(
y
ear
==
0
&&
month
==
0
&&
day
==
0
)
if
(
y
==
0
&&
month
==
0
&&
day
==
0
)
DBUG_RETURN
(
0
);
/* Skip errors */
DBUG_RETURN
(
0
);
/* Skip errors */
delsum
=
(
long
)
(
365L
*
y
ear
+
31
*
(
month
-
1
)
+
day
);
delsum
=
(
long
)
(
365L
*
y
+
31
*
(
month
-
1
)
+
day
);
if
(
month
<=
2
)
if
(
month
<=
2
)
y
ear
--
;
y
--
;
else
else
delsum
-=
(
long
)
(
month
*
4
+
23
)
/
10
;
delsum
-=
(
long
)
(
month
*
4
+
23
)
/
10
;
temp
=
(
int
)
((
y
ear
/
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
ear
+
(
month
<=
2
),
month
,
day
,
delsum
+
year
/
4
-
temp
));
y
+
(
month
<=
2
),
month
,
day
,
delsum
+
y
/
4
-
temp
));
DBUG_RETURN
(
delsum
+
(
int
)
y
ear
/
4
-
temp
);
DBUG_RETURN
(
delsum
+
(
int
)
y
/
4
-
temp
);
}
/* calc_daynr */
}
/* calc_daynr */
...
...
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