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
ed93e55b
Commit
ed93e55b
authored
Apr 22, 2014
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-5975 Prepared statements with DATE literals do not honor NO_ZERO_IN_DATE
parent
046ae9f5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
0 deletions
+48
-0
mysql-test/r/temporal_literal.result
mysql-test/r/temporal_literal.result
+28
-0
mysql-test/t/temporal_literal.test
mysql-test/t/temporal_literal.test
+18
-0
sql/item.cc
sql/item.cc
+2
-0
No files found.
mysql-test/r/temporal_literal.result
View file @
ed93e55b
...
...
@@ -613,3 +613,31 @@ t1 CREATE TABLE `t1` (
`TIMESTAMP'2001-01-00 00:00:00'` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
#
# MDEV-5975 Prepared statements with DATE literals do not honor NO_ZERO_IN_DATE
#
SET sql_mode=DEFAULT;
PREPARE stmt FROM "SELECT (SELECT DATE'2001-00-00') AS c";
EXECUTE stmt;
c
2001-00-00
SET sql_mode='no_zero_in_date';
EXECUTE stmt;
c
NULL
Warnings:
Warning 1292 Incorrect datetime value: '2001-00-00'
DEALLOCATE PREPARE stmt;
SET sql_mode=DEFAULT;
PREPARE stmt FROM "SELECT (SELECT TIMESTAMP'2001-00-00 10:20:30') AS c";
EXECUTE stmt;
c
2001-00-00 10:20:30
SET sql_mode='no_zero_in_date';
EXECUTE stmt;
c
NULL
Warnings:
Warning 1292 Incorrect datetime value: '2001-00-00 10:20:30'
DEALLOCATE PREPARE stmt;
SET sql_mode=DEFAULT;
mysql-test/t/temporal_literal.test
View file @
ed93e55b
...
...
@@ -326,3 +326,21 @@ CREATE TABLE t1 AS SELECT
TIMESTAMP
'2001-01-00 00:00:00'
;
SHOW
CREATE
TABLE
t1
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# MDEV-5975 Prepared statements with DATE literals do not honor NO_ZERO_IN_DATE
--
echo
#
SET
sql_mode
=
DEFAULT
;
PREPARE
stmt
FROM
"SELECT (SELECT DATE'2001-00-00') AS c"
;
EXECUTE
stmt
;
SET
sql_mode
=
'no_zero_in_date'
;
EXECUTE
stmt
;
DEALLOCATE
PREPARE
stmt
;
SET
sql_mode
=
DEFAULT
;
PREPARE
stmt
FROM
"SELECT (SELECT TIMESTAMP'2001-00-00 10:20:30') AS c"
;
EXECUTE
stmt
;
SET
sql_mode
=
'no_zero_in_date'
;
EXECUTE
stmt
;
DEALLOCATE
PREPARE
stmt
;
SET
sql_mode
=
DEFAULT
;
sql/item.cc
View file @
ed93e55b
...
...
@@ -6509,6 +6509,7 @@ void Item_date_literal::print(String *str, enum_query_type query_type)
bool
Item_date_literal
::
get_date
(
MYSQL_TIME
*
ltime
,
ulonglong
fuzzy_date
)
{
DBUG_ASSERT
(
fixed
);
fuzzy_date
|=
sql_mode_for_dates
(
current_thd
);
*
ltime
=
cached_time
;
return
(
null_value
=
check_date_with_warn
(
ltime
,
fuzzy_date
,
MYSQL_TIMESTAMP_ERROR
));
...
...
@@ -6528,6 +6529,7 @@ void Item_datetime_literal::print(String *str, enum_query_type query_type)
bool
Item_datetime_literal
::
get_date
(
MYSQL_TIME
*
ltime
,
ulonglong
fuzzy_date
)
{
DBUG_ASSERT
(
fixed
);
fuzzy_date
|=
sql_mode_for_dates
(
current_thd
);
*
ltime
=
cached_time
;
return
(
null_value
=
check_date_with_warn
(
ltime
,
fuzzy_date
,
MYSQL_TIMESTAMP_ERROR
));
...
...
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