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
aaee1352
Commit
aaee1352
authored
Nov 19, 2004
by
dlenev@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/dlenev/src/mysql-4.1-bg6439
parents
bc0f2ea5
5627dddb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
24 deletions
+33
-24
mysql-test/r/func_time.result
mysql-test/r/func_time.result
+6
-0
mysql-test/t/func_time.test
mysql-test/t/func_time.test
+7
-0
sql/item_timefunc.cc
sql/item_timefunc.cc
+20
-24
No files found.
mysql-test/r/func_time.result
View file @
aaee1352
...
...
@@ -474,6 +474,12 @@ 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)
NULL
select from_unixtime(2145916800);
from_unixtime(2145916800)
NULL
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/t/func_time.test
View file @
aaee1352
...
...
@@ -229,6 +229,13 @@ select @a:=FROM_UNIXTIME(1);
select
unix_timestamp
(
@
a
);
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.
#
select
from_unixtime
(
0
);
select
from_unixtime
(
2145916800
);
#
# Test types from + INTERVAL
#
...
...
sql/item_timefunc.cc
View file @
aaee1352
...
...
@@ -1601,50 +1601,46 @@ void Item_func_from_unixtime::fix_length_and_dec()
String
*
Item_func_from_unixtime
::
val_str
(
String
*
str
)
{
TIME
time_tmp
;
my_time_t
tmp
;
DBUG_ASSERT
(
fixed
==
1
);
tmp
=
(
time_t
)
args
[
0
]
->
val_int
();
if
((
null_value
=
args
[
0
]
->
null_value
))
goto
null_date
;
thd
->
variables
.
time_zone
->
gmt_sec_to_TIME
(
&
time_tmp
,
tmp
);
if
(
get_date
(
&
time_tmp
,
0
))
return
0
;
if
(
str
->
alloc
(
20
*
MY_CHARSET_BIN_MB_MAXLEN
))
goto
null_date
;
{
null_value
=
1
;
return
0
;
}
make_datetime
((
DATE_TIME_FORMAT
*
)
0
,
&
time_tmp
,
str
);
return
str
;
null_date:
null_value
=
1
;
return
0
;
}
longlong
Item_func_from_unixtime
::
val_int
()
{
TIME
time_tmp
;
my_time_t
tmp
;
DBUG_ASSERT
(
fixed
==
1
);
tmp
=
(
time_t
)
(
ulong
)
args
[
0
]
->
val_int
();
if
((
null_value
=
args
[
0
]
->
null_value
))
if
(
get_date
(
&
time_tmp
,
0
))
return
0
;
current_thd
->
variables
.
time_zone
->
gmt_sec_to_TIME
(
&
time_tmp
,
tmp
);
return
(
longlong
)
TIME_to_ulonglong_datetime
(
&
time_tmp
);
}
bool
Item_func_from_unixtime
::
get_date
(
TIME
*
ltime
,
uint
fuzzy_date
__attribute__
((
unused
)))
{
my_time_t
tmp
=
(
my_time_t
)
args
[
0
]
->
val_int
();
if
((
null_value
=
args
[
0
]
->
null_value
))
longlong
tmp
=
args
[
0
]
->
val_int
();
if
((
null_value
=
(
args
[
0
]
->
null_value
||
tmp
<
TIMESTAMP_MIN_VALUE
||
tmp
>
TIMESTAMP_MAX_VALUE
)))
return
1
;
current_thd
->
variables
.
time_zone
->
gmt_sec_to_TIME
(
ltime
,
tmp
);
thd
->
variables
.
time_zone
->
gmt_sec_to_TIME
(
ltime
,
(
my_time_t
)
tmp
);
return
0
;
}
...
...
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