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
12f54d7d
Commit
12f54d7d
authored
Mar 07, 2014
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
@@old_mode=zero_date_time_cast
parent
68916bca
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
26 additions
and
13 deletions
+26
-13
mysql-test/r/old-mode.result
mysql-test/r/old-mode.result
+1
-0
mysql-test/suite/sys_vars/r/old_mode_basic.result
mysql-test/suite/sys_vars/r/old_mode_basic.result
+6
-2
mysql-test/suite/sys_vars/t/old_mode_basic.test
mysql-test/suite/sys_vars/t/old_mode_basic.test
+4
-1
mysql-test/t/old-mode.test
mysql-test/t/old-mode.test
+3
-3
sql/item.cc
sql/item.cc
+2
-1
sql/sql_class.h
sql/sql_class.h
+3
-2
sql/sql_time.cc
sql/sql_time.cc
+4
-3
sql/sys_vars.cc
sql/sys_vars.cc
+3
-1
No files found.
mysql-test/r/old-mode.result
View file @
12f54d7d
...
@@ -22,6 +22,7 @@ Id User Host db Command Time State Info
...
@@ -22,6 +22,7 @@ Id User Host db Command Time State Info
#
#
# MDEV-5372 Make "CAST(time_expr AS DATETIME)" compatible with the SQL Standard)
# MDEV-5372 Make "CAST(time_expr AS DATETIME)" compatible with the SQL Standard)
#
#
set @@old_mode=zero_date_time_cast;
SELECT CAST(TIME'-10:30:30' AS DATETIME);
SELECT CAST(TIME'-10:30:30' AS DATETIME);
CAST(TIME'-10:30:30' AS DATETIME)
CAST(TIME'-10:30:30' AS DATETIME)
NULL
NULL
...
...
mysql-test/suite/sys_vars/r/old_mode_basic.result
View file @
12f54d7d
...
@@ -111,10 +111,14 @@ SELECT @@global.old_mode;
...
@@ -111,10 +111,14 @@ SELECT @@global.old_mode;
@@global.old_mode
@@global.old_mode
NO_PROGRESS_INFO
NO_PROGRESS_INFO
SET @@global.old_mode = 4;
SET @@global.old_mode = 4;
ERROR 42000: Variable 'old_mode' can't be set to the value of '4'
SELECT @@global.old_mode;
SELECT @@global.old_mode;
@@global.old_mode
@@global.old_mode
NO_PROGRESS_INFO
ZERO_DATE_TIME_CAST
SET @@global.old_mode = 8;
ERROR 42000: Variable 'old_mode' can't be set to the value of '8'
SELECT @@global.old_mode;
@@global.old_mode
ZERO_DATE_TIME_CAST
SET @@global.old_mode = 0.4;
SET @@global.old_mode = 0.4;
ERROR 42000: Incorrect argument type to variable 'old_mode'
ERROR 42000: Incorrect argument type to variable 'old_mode'
'#---------------------FN_DYNVARS_152_08----------------------#'
'#---------------------FN_DYNVARS_152_08----------------------#'
...
...
mysql-test/suite/sys_vars/t/old_mode_basic.test
View file @
12f54d7d
...
@@ -168,10 +168,13 @@ SELECT @@global.old_mode;
...
@@ -168,10 +168,13 @@ SELECT @@global.old_mode;
SET
@@
global
.
old_mode
=
2
;
SET
@@
global
.
old_mode
=
2
;
SELECT
@@
global
.
old_mode
;
SELECT
@@
global
.
old_mode
;
--
Error
ER_WRONG_VALUE_FOR_VAR
SET
@@
global
.
old_mode
=
4
;
SET
@@
global
.
old_mode
=
4
;
SELECT
@@
global
.
old_mode
;
SELECT
@@
global
.
old_mode
;
--
Error
ER_WRONG_VALUE_FOR_VAR
SET
@@
global
.
old_mode
=
8
;
SELECT
@@
global
.
old_mode
;
# use of decimal values
# use of decimal values
--
Error
ER_WRONG_TYPE_FOR_VAR
--
Error
ER_WRONG_TYPE_FOR_VAR
...
...
mysql-test/t/old-mode.test
View file @
12f54d7d
...
@@ -29,7 +29,7 @@ SHOW PROCESSLIST;
...
@@ -29,7 +29,7 @@ SHOW PROCESSLIST;
--
echo
#
--
echo
#
--
echo
# MDEV-5372 Make "CAST(time_expr AS DATETIME)" compatible with the SQL Standard)
--
echo
# MDEV-5372 Make "CAST(time_expr AS DATETIME)" compatible with the SQL Standard)
--
echo
#
--
echo
#
# Checking that "mysqld --old" exposes the 5.5 conversion behaviour
set
@@
old_mode
=
zero_date_time_cast
;
SELECT
CAST
(
TIME
'-10:30:30'
AS
DATETIME
);
SELECT
CAST
(
TIME
'-10:30:30'
AS
DATETIME
);
SELECT
CAST
(
TIME
'10:20:30'
AS
DATETIME
);
SELECT
CAST
(
TIME
'10:20:30'
AS
DATETIME
);
SELECT
CAST
(
TIME
'830:20:30'
AS
DATETIME
);
SELECT
CAST
(
TIME
'830:20:30'
AS
DATETIME
);
...
@@ -53,12 +53,12 @@ SELECT a, CAST(a AS DATETIME), TO_DAYS(a) FROM t1;
...
@@ -53,12 +53,12 @@ SELECT a, CAST(a AS DATETIME), TO_DAYS(a) FROM t1;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
# Note, it was actually a bug that TO_DAYS('830:20:30') returned NULL
# Note, it was actually a bug that TO_DAYS('830:20:30') returned NULL
# for a column, while 3 for an expression. We won't fix this,
# for a column, while 3 for an expression. We won't fix this,
# it's "
mysqld --old
" anyway.
# it's "
old_mode
" anyway.
SELECT
TO_DAYS
(
TIME
'-10:20:30'
);
SELECT
TO_DAYS
(
TIME
'-10:20:30'
);
SELECT
TO_DAYS
(
TIME
'10:20:30'
);
SELECT
TO_DAYS
(
TIME
'10:20:30'
);
SELECT
TO_DAYS
(
TIME
'830:20:30'
);
SELECT
TO_DAYS
(
TIME
'830:20:30'
);
# This is to cover Item_temporal_hybrid_func::fix_temporal_type in
--old
mode:
# This is to cover Item_temporal_hybrid_func::fix_temporal_type in
old_
mode:
CREATE
TABLE
t1
(
a
DATETIME
,
b
TIME
);
CREATE
TABLE
t1
(
a
DATETIME
,
b
TIME
);
INSERT
INTO
t1
VALUES
(
NULL
,
'00:20:12'
);
INSERT
INTO
t1
VALUES
(
NULL
,
'00:20:12'
);
INSERT
INTO
t1
VALUES
(
NULL
,
'-00:20:12'
);
INSERT
INTO
t1
VALUES
(
NULL
,
'-00:20:12'
);
...
...
sql/item.cc
View file @
12f54d7d
...
@@ -248,7 +248,8 @@ bool Item::get_date_with_conversion(MYSQL_TIME *ltime, ulonglong fuzzydate)
...
@@ -248,7 +248,8 @@ bool Item::get_date_with_conversion(MYSQL_TIME *ltime, ulonglong fuzzydate)
and leave it to get_date() to check date.
and leave it to get_date() to check date.
*/
*/
ulonglong
time_flag
=
(
field_type
()
==
MYSQL_TYPE_TIME
&&
ulonglong
time_flag
=
(
field_type
()
==
MYSQL_TYPE_TIME
&&
!
current_thd
->
variables
.
old_mode
)
?
TIME_TIME_ONLY
:
0
;
!
(
current_thd
->
variables
.
old_behavior
&
OLD_MODE_ZERO_DATE_TIME_CAST
))
?
TIME_TIME_ONLY
:
0
;
if
(
get_date
(
ltime
,
fuzzydate
|
time_flag
))
if
(
get_date
(
ltime
,
fuzzydate
|
time_flag
))
return
true
;
return
true
;
if
(
ltime
->
time_type
==
MYSQL_TIMESTAMP_TIME
&&
if
(
ltime
->
time_type
==
MYSQL_TIMESTAMP_TIME
&&
...
...
sql/sql_class.h
View file @
12f54d7d
...
@@ -121,8 +121,9 @@ enum enum_filetype { FILETYPE_CSV, FILETYPE_XML };
...
@@ -121,8 +121,9 @@ enum enum_filetype { FILETYPE_CSV, FILETYPE_XML };
#define MODE_PAD_CHAR_TO_FULL_LENGTH (1ULL << 31)
#define MODE_PAD_CHAR_TO_FULL_LENGTH (1ULL << 31)
/* Bits for different old style modes */
/* Bits for different old style modes */
#define OLD_MODE_NO_DUP_KEY_WARNINGS_WITH_IGNORE 1
#define OLD_MODE_NO_DUP_KEY_WARNINGS_WITH_IGNORE (1 << 0)
#define OLD_MODE_NO_PROGRESS_INFO 2
#define OLD_MODE_NO_PROGRESS_INFO (1 << 1)
#define OLD_MODE_ZERO_DATE_TIME_CAST (1 << 2)
extern
char
internal_table_name
[
2
];
extern
char
internal_table_name
[
2
];
extern
char
empty_c_string
[
1
];
extern
char
empty_c_string
[
1
];
...
...
sql/sql_time.cc
View file @
12f54d7d
...
@@ -1243,7 +1243,7 @@ time_to_datetime_old(THD *thd, const MYSQL_TIME *from, MYSQL_TIME *to)
...
@@ -1243,7 +1243,7 @@ time_to_datetime_old(THD *thd, const MYSQL_TIME *from, MYSQL_TIME *to)
bool
bool
time_to_datetime
(
THD
*
thd
,
const
MYSQL_TIME
*
from
,
MYSQL_TIME
*
to
)
time_to_datetime
(
THD
*
thd
,
const
MYSQL_TIME
*
from
,
MYSQL_TIME
*
to
)
{
{
if
(
thd
->
variables
.
old_
mode
)
if
(
thd
->
variables
.
old_
behavior
&
OLD_MODE_ZERO_DATE_TIME_CAST
)
return
time_to_datetime_old
(
thd
,
from
,
to
);
return
time_to_datetime_old
(
thd
,
from
,
to
);
set_current_date
(
thd
,
to
);
set_current_date
(
thd
,
to
);
mix_date_and_time
(
to
,
from
);
mix_date_and_time
(
to
,
from
);
...
@@ -1266,7 +1266,8 @@ time_to_datetime_with_warn(THD *thd,
...
@@ -1266,7 +1266,8 @@ time_to_datetime_with_warn(THD *thd,
only in the old mode.
only in the old mode.
*/
*/
if
(
time_to_datetime
(
thd
,
from
,
to
)
||
if
(
time_to_datetime
(
thd
,
from
,
to
)
||
(
thd
->
variables
.
old_mode
&&
check_date
(
to
,
fuzzydate
,
&
warn
)))
((
thd
->
variables
.
old_behavior
&&
OLD_MODE_ZERO_DATE_TIME_CAST
)
&&
check_date
(
to
,
fuzzydate
,
&
warn
)))
{
{
ErrConvTime
str
(
from
);
ErrConvTime
str
(
from
);
make_truncated_value_warning
(
thd
,
Sql_condition
::
WARN_LEVEL_WARN
,
make_truncated_value_warning
(
thd
,
Sql_condition
::
WARN_LEVEL_WARN
,
...
...
sql/sys_vars.cc
View file @
12f54d7d
...
@@ -2876,7 +2876,9 @@ static Sys_var_set Sys_sql_mode(
...
@@ -2876,7 +2876,9 @@ static Sys_var_set Sys_sql_mode(
static
const
char
*
old_mode_names
[]
=
static
const
char
*
old_mode_names
[]
=
{
{
"NO_DUP_KEY_WARNINGS_WITH_IGNORE"
,
"NO_PROGRESS_INFO"
,
"NO_DUP_KEY_WARNINGS_WITH_IGNORE"
,
"NO_PROGRESS_INFO"
,
"ZERO_DATE_TIME_CAST"
,
0
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