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
4ef7ac5c
Commit
4ef7ac5c
authored
Dec 30, 2004
by
dlenev@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Manual merge of fix for bugs of #7297 and #7515 into 4.1 tree.
parents
e0280694
2600fb3b
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
9 deletions
+39
-9
mysql-test/r/func_time.result
mysql-test/r/func_time.result
+5
-2
mysql-test/r/type_datetime.result
mysql-test/r/type_datetime.result
+10
-0
mysql-test/t/func_time.test
mysql-test/t/func_time.test
+6
-2
mysql-test/t/type_datetime.test
mysql-test/t/type_datetime.test
+12
-0
sql/item_timefunc.cc
sql/item_timefunc.cc
+6
-5
No files found.
mysql-test/r/func_time.result
View file @
4ef7ac5c
...
...
@@ -474,12 +474,15 @@ unix_timestamp(@a)
select unix_timestamp('1969-12-01 19:00:01');
unix_timestamp('1969-12-01 19:00:01')
0
select from_unixtime(
0
);
from_unixtime(
0
)
select from_unixtime(
-1
);
from_unixtime(
-1
)
NULL
select from_unixtime(2145916800);
from_unixtime(2145916800)
NULL
select from_unixtime(0);
from_unixtime(0)
1970-01-01 03:00:00
CREATE TABLE t1 (datetime datetime, timestamp timestamp, date date, time time);
INSERT INTO t1 values ("2001-01-02 03:04:05", "2002-01-02 03:04:05", "2003-01-02", "06:07:08");
SELECT * from t1;
...
...
mysql-test/r/type_datetime.result
View file @
4ef7ac5c
...
...
@@ -143,3 +143,13 @@ t
0000-00-00 00:00:00
2003-01-01 00:00:00
drop table t1;
create table t1 (dt datetime);
insert into t1 values ("12-00-00"), ("00-00-00 01:00:00");
insert into t1 values ("00-00-00"), ("00-00-00 00:00:00");
select * from t1;
dt
2012-00-00 00:00:00
2000-00-00 01:00:00
0000-00-00 00:00:00
0000-00-00 00:00:00
drop table t1;
mysql-test/t/func_time.test
View file @
4ef7ac5c
...
...
@@ -231,10 +231,14 @@ select unix_timestamp('1969-12-01 19:00:01');
#
# Test for bug #6439 "unix_timestamp() function returns wrong datetime
# values for too big argument". It should return error instead.
# values for too big argument" and bug #7515 "from_unixtime(0) now
# returns NULL instead of the epoch". unix_timestamp() should return error
# for too big or negative argument. It should return Epoch value for zero
# argument since it seems that many user's rely on this fact.
#
select
from_unixtime
(
0
);
select
from_unixtime
(
-
1
);
select
from_unixtime
(
2145916800
);
select
from_unixtime
(
0
);
#
# Test types from + INTERVAL
...
...
mysql-test/t/type_datetime.test
View file @
4ef7ac5c
...
...
@@ -89,3 +89,15 @@ delete from t1;
insert
into
t1
values
(
"0000-00-00 00:00:00 some trailer"
),(
"2003-01-01 00:00:00 some trailer"
);
select
*
from
t1
;
drop
table
t1
;
#
# Test for bug #7297 "Two digit year should be interpreted correctly even
# with zero month and day"
#
create
table
t1
(
dt
datetime
);
# These dates should be treated as dates in 21st century
insert
into
t1
values
(
"12-00-00"
),
(
"00-00-00 01:00:00"
);
# Zero dates are still special :/
insert
into
t1
values
(
"00-00-00"
),
(
"00-00-00 00:00:00"
);
select
*
from
t1
;
drop
table
t1
;
sql/item_timefunc.cc
View file @
4ef7ac5c
...
...
@@ -1636,11 +1636,12 @@ longlong Item_func_from_unixtime::val_int()
bool
Item_func_from_unixtime
::
get_date
(
TIME
*
ltime
,
uint
fuzzy_date
__attribute__
((
unused
)))
{
longlong
tmp
=
args
[
0
]
->
val_int
();
if
((
null_value
=
(
args
[
0
]
->
null_value
||
tmp
<
TIMESTAMP_MIN_VALUE
||
tmp
>
TIMESTAMP_MAX_VALUE
)))
ulonglong
tmp
=
(
ulonglong
)(
args
[
0
]
->
val_int
());
/*
"tmp > TIMESTAMP_MAX_VALUE" check also covers case of negative
from_unixtime() argument since tmp is unsigned.
*/
if
((
null_value
=
(
args
[
0
]
->
null_value
||
tmp
>
TIMESTAMP_MAX_VALUE
)))
return
1
;
thd
->
variables
.
time_zone
->
gmt_sec_to_TIME
(
ltime
,
(
my_time_t
)
tmp
);
...
...
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