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
21d915c0
Commit
21d915c0
authored
Jan 30, 2007
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into rakia.gmz:/home/kgeorge/mysql/autopush/B25643-5.0-opt
parents
14959243
3cb3a9a1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
3 deletions
+32
-3
mysql-test/r/func_time.result
mysql-test/r/func_time.result
+14
-0
mysql-test/t/func_time.test
mysql-test/t/func_time.test
+12
-0
sql/item_timefunc.cc
sql/item_timefunc.cc
+6
-3
No files found.
mysql-test/r/func_time.result
View file @
21d915c0
...
@@ -1207,3 +1207,17 @@ SET NAMES DEFAULT;
...
@@ -1207,3 +1207,17 @@ SET NAMES DEFAULT;
select str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE;
select str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE;
str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE
str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE
NULL
NULL
CREATE TABLE t1 (a int, t1 time, t2 time, d date, PRIMARY KEY (a));
INSERT INTO t1 VALUES (1, '10:00:00', NULL, NULL),
(2, '11:00:00', '11:15:00', '1972-02-06');
SELECT t1, t2, SEC_TO_TIME( TIME_TO_SEC( t2 ) - TIME_TO_SEC( t1 ) ), QUARTER(d)
FROM t1;
t1 t2 SEC_TO_TIME( TIME_TO_SEC( t2 ) - TIME_TO_SEC( t1 ) ) QUARTER(d)
10:00:00 NULL NULL NULL
11:00:00 11:15:00 00:15:00 1
SELECT t1, t2, SEC_TO_TIME( TIME_TO_SEC( t2 ) - TIME_TO_SEC( t1 ) ), QUARTER(d)
FROM t1 ORDER BY a DESC;
t1 t2 SEC_TO_TIME( TIME_TO_SEC( t2 ) - TIME_TO_SEC( t1 ) ) QUARTER(d)
11:00:00 11:15:00 00:15:00 1
10:00:00 NULL NULL NULL
DROP TABLE t1;
mysql-test/t/func_time.test
View file @
21d915c0
...
@@ -713,3 +713,15 @@ SET NAMES DEFAULT;
...
@@ -713,3 +713,15 @@ SET NAMES DEFAULT;
#
#
select
str_to_date
(
'10:00 PM'
,
'%h:%i %p'
)
+
INTERVAL
10
MINUTE
;
select
str_to_date
(
'10:00 PM'
,
'%h:%i %p'
)
+
INTERVAL
10
MINUTE
;
#
# Bug #25643: SEC_TO_TIME function problem
#
CREATE
TABLE
t1
(
a
int
,
t1
time
,
t2
time
,
d
date
,
PRIMARY
KEY
(
a
));
INSERT
INTO
t1
VALUES
(
1
,
'10:00:00'
,
NULL
,
NULL
),
(
2
,
'11:00:00'
,
'11:15:00'
,
'1972-02-06'
);
SELECT
t1
,
t2
,
SEC_TO_TIME
(
TIME_TO_SEC
(
t2
)
-
TIME_TO_SEC
(
t1
)
),
QUARTER
(
d
)
FROM
t1
;
SELECT
t1
,
t2
,
SEC_TO_TIME
(
TIME_TO_SEC
(
t2
)
-
TIME_TO_SEC
(
t1
)
),
QUARTER
(
d
)
FROM
t1
ORDER
BY
a
DESC
;
DROP
TABLE
t1
;
sql/item_timefunc.cc
View file @
21d915c0
...
@@ -1054,7 +1054,8 @@ longlong Item_func_quarter::val_int()
...
@@ -1054,7 +1054,8 @@ longlong Item_func_quarter::val_int()
{
{
DBUG_ASSERT
(
fixed
==
1
);
DBUG_ASSERT
(
fixed
==
1
);
TIME
ltime
;
TIME
ltime
;
(
void
)
get_arg0_date
(
&
ltime
,
TIME_FUZZY_DATE
);
if
(
get_arg0_date
(
&
ltime
,
TIME_FUZZY_DATE
))
return
0
;
return
(
longlong
)
((
ltime
.
month
+
2
)
/
3
);
return
(
longlong
)
((
ltime
.
month
+
2
)
/
3
);
}
}
...
@@ -1668,6 +1669,7 @@ String *Item_func_sec_to_time::val_str(String *str)
...
@@ -1668,6 +1669,7 @@ String *Item_func_sec_to_time::val_str(String *str)
{
{
DBUG_ASSERT
(
fixed
==
1
);
DBUG_ASSERT
(
fixed
==
1
);
TIME
ltime
;
TIME
ltime
;
longlong
arg_val
=
args
[
0
]
->
val_int
();
if
((
null_value
=
args
[
0
]
->
null_value
)
||
str
->
alloc
(
19
))
if
((
null_value
=
args
[
0
]
->
null_value
)
||
str
->
alloc
(
19
))
{
{
...
@@ -1675,7 +1677,7 @@ String *Item_func_sec_to_time::val_str(String *str)
...
@@ -1675,7 +1677,7 @@ String *Item_func_sec_to_time::val_str(String *str)
return
(
String
*
)
0
;
return
(
String
*
)
0
;
}
}
sec_to_time
(
arg
s
[
0
]
->
val_int
()
,
args
[
0
]
->
unsigned_flag
,
&
ltime
);
sec_to_time
(
arg
_val
,
args
[
0
]
->
unsigned_flag
,
&
ltime
);
make_time
((
DATE_TIME_FORMAT
*
)
0
,
&
ltime
,
str
);
make_time
((
DATE_TIME_FORMAT
*
)
0
,
&
ltime
,
str
);
return
str
;
return
str
;
...
@@ -1686,11 +1688,12 @@ longlong Item_func_sec_to_time::val_int()
...
@@ -1686,11 +1688,12 @@ longlong Item_func_sec_to_time::val_int()
{
{
DBUG_ASSERT
(
fixed
==
1
);
DBUG_ASSERT
(
fixed
==
1
);
TIME
ltime
;
TIME
ltime
;
longlong
arg_val
=
args
[
0
]
->
val_int
();
if
((
null_value
=
args
[
0
]
->
null_value
))
if
((
null_value
=
args
[
0
]
->
null_value
))
return
0
;
return
0
;
sec_to_time
(
arg
s
[
0
]
->
val_int
()
,
args
[
0
]
->
unsigned_flag
,
&
ltime
);
sec_to_time
(
arg
_val
,
args
[
0
]
->
unsigned_flag
,
&
ltime
);
return
(
ltime
.
neg
?
-
1
:
1
)
*
return
(
ltime
.
neg
?
-
1
:
1
)
*
((
ltime
.
hour
)
*
10000
+
ltime
.
minute
*
100
+
ltime
.
second
);
((
ltime
.
hour
)
*
10000
+
ltime
.
minute
*
100
+
ltime
.
second
);
...
...
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