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
05b41fda
Commit
05b41fda
authored
Nov 10, 2007
by
tnurnberg@white.intern.koehntopp.de
Browse files
Options
Browse Files
Download
Plain Diff
Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.1-opt
into mysql.com:/misc/mysql/31990/51-31990
parents
88ad9f19
80a3f89e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
0 deletions
+54
-0
mysql-test/r/cast.result
mysql-test/r/cast.result
+24
-0
mysql-test/t/cast.test
mysql-test/t/cast.test
+22
-0
sql/item_timefunc.cc
sql/item_timefunc.cc
+7
-0
sql/item_timefunc.h
sql/item_timefunc.h
+1
-0
No files found.
mysql-test/r/cast.result
View file @
05b41fda
...
@@ -414,4 +414,28 @@ NULL
...
@@ -414,4 +414,28 @@ NULL
NULL
NULL
20070719
20070719
drop table t1;
drop table t1;
CREATE TABLE t1 (f1 DATE);
INSERT INTO t1 VALUES ('2007-07-19'), (NULL);
SELECT HOUR(f1),
MINUTE(f1),
SECOND(f1) FROM t1;
HOUR(f1) MINUTE(f1) SECOND(f1)
0 0 0
NULL NULL NULL
SELECT HOUR(CAST('2007-07-19' AS DATE)),
MINUTE(CAST('2007-07-19' AS DATE)),
SECOND(CAST('2007-07-19' AS DATE));
HOUR(CAST('2007-07-19' AS DATE)) MINUTE(CAST('2007-07-19' AS DATE)) SECOND(CAST('2007-07-19' AS DATE))
0 0 0
SELECT HOUR(CAST(NULL AS DATE)),
MINUTE(CAST(NULL AS DATE)),
SECOND(CAST(NULL AS DATE));
HOUR(CAST(NULL AS DATE)) MINUTE(CAST(NULL AS DATE)) SECOND(CAST(NULL AS DATE))
NULL NULL NULL
SELECT HOUR(NULL),
MINUTE(NULL),
SECOND(NULL);
HOUR(NULL) MINUTE(NULL) SECOND(NULL)
NULL NULL NULL
DROP TABLE t1;
End of 5.0 tests
End of 5.0 tests
mysql-test/t/cast.test
View file @
05b41fda
...
@@ -246,4 +246,26 @@ INSERT INTO t1(d1) VALUES ('2007-07-19 08:30:00'), (NULL),
...
@@ -246,4 +246,26 @@ INSERT INTO t1(d1) VALUES ('2007-07-19 08:30:00'), (NULL),
SELECT
cast
(
date
(
d1
)
as
signed
)
FROM
t1
;
SELECT
cast
(
date
(
d1
)
as
signed
)
FROM
t1
;
drop
table
t1
;
drop
table
t1
;
#
# Bug #31990: MINUTE() and SECOND() return bogus results when used on a DATE
#
# Show that HH:MM:SS of a DATE are 0, and that it's the same for columns
# and typecasts (NULL in, NULL out).
CREATE
TABLE
t1
(
f1
DATE
);
INSERT
INTO
t1
VALUES
(
'2007-07-19'
),
(
NULL
);
SELECT
HOUR
(
f1
),
MINUTE
(
f1
),
SECOND
(
f1
)
FROM
t1
;
SELECT
HOUR
(
CAST
(
'2007-07-19'
AS
DATE
)),
MINUTE
(
CAST
(
'2007-07-19'
AS
DATE
)),
SECOND
(
CAST
(
'2007-07-19'
AS
DATE
));
SELECT
HOUR
(
CAST
(
NULL
AS
DATE
)),
MINUTE
(
CAST
(
NULL
AS
DATE
)),
SECOND
(
CAST
(
NULL
AS
DATE
));
SELECT
HOUR
(
NULL
),
MINUTE
(
NULL
),
SECOND
(
NULL
);
DROP
TABLE
t1
;
--
echo
End
of
5.0
tests
--
echo
End
of
5.0
tests
sql/item_timefunc.cc
View file @
05b41fda
...
@@ -2586,6 +2586,13 @@ bool Item_date_typecast::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
...
@@ -2586,6 +2586,13 @@ bool Item_date_typecast::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
}
}
bool
Item_date_typecast
::
get_time
(
MYSQL_TIME
*
ltime
)
{
bzero
((
char
*
)
ltime
,
sizeof
(
MYSQL_TIME
));
return
args
[
0
]
->
null_value
;
}
String
*
Item_date_typecast
::
val_str
(
String
*
str
)
String
*
Item_date_typecast
::
val_str
(
String
*
str
)
{
{
DBUG_ASSERT
(
fixed
==
1
);
DBUG_ASSERT
(
fixed
==
1
);
...
...
sql/item_timefunc.h
View file @
05b41fda
...
@@ -778,6 +778,7 @@ class Item_date_typecast :public Item_typecast_maybe_null
...
@@ -778,6 +778,7 @@ class Item_date_typecast :public Item_typecast_maybe_null
const
char
*
func_name
()
const
{
return
"cast_as_date"
;
}
const
char
*
func_name
()
const
{
return
"cast_as_date"
;
}
String
*
val_str
(
String
*
str
);
String
*
val_str
(
String
*
str
);
bool
get_date
(
MYSQL_TIME
*
ltime
,
uint
fuzzy_date
);
bool
get_date
(
MYSQL_TIME
*
ltime
,
uint
fuzzy_date
);
bool
get_time
(
MYSQL_TIME
*
ltime
);
const
char
*
cast_type
()
const
{
return
"date"
;
}
const
char
*
cast_type
()
const
{
return
"date"
;
}
enum_field_types
field_type
()
const
{
return
MYSQL_TYPE_DATE
;
}
enum_field_types
field_type
()
const
{
return
MYSQL_TYPE_DATE
;
}
Field
*
tmp_table_field
(
TABLE
*
table
)
Field
*
tmp_table_field
(
TABLE
*
table
)
...
...
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