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
b43b7dc1
Commit
b43b7dc1
authored
Mar 30, 2005
by
monty@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enabled more tests of STR_TO_DATE()
Fixed that datetime gives warning for zero dates in traditional mode
parent
fac67f09
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
45 deletions
+40
-45
mysql-test/r/strict.result
mysql-test/r/strict.result
+14
-0
mysql-test/t/strict.test
mysql-test/t/strict.test
+14
-37
sql/field.cc
sql/field.cc
+11
-7
sql/log_event.h
sql/log_event.h
+1
-1
No files found.
mysql-test/r/strict.result
View file @
b43b7dc1
...
@@ -210,8 +210,12 @@ INSERT INTO t1 (col1) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
...
@@ -210,8 +210,12 @@ INSERT INTO t1 (col1) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect date value: '2004-10-00 15:30:00' for column 'col1' at row 1
ERROR 22007: Incorrect date value: '2004-10-00 15:30:00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect date value: '2004-09-31 15:30:00' for column 'col1' at row 1
ERROR 22007: Incorrect date value: '2004-09-31 15:30:00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_time
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect date value: '2003-02-29 15:30:00' for column 'col1' at row 1
ERROR 22007: Incorrect date value: '2003-02-29 15:30:00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_time
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1
ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
...
@@ -221,8 +225,14 @@ INSERT INTO t1 (col2) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
...
@@ -221,8 +225,14 @@ INSERT INTO t1 (col2) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column 'col2' at row 1
ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_time
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column 'col2' at row 1
ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_time
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
ERROR 22007: Incorrect datetime value: '0000-00-00' for column 'col2' at row 1
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1
ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
...
@@ -231,8 +241,12 @@ INSERT INTO t1 (col3) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
...
@@ -231,8 +241,12 @@ INSERT INTO t1 (col3) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column 'col3' at row 1
ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_time
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column 'col3' at row 1
ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_time
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
ERROR 22007: Incorrect datetime value: '0000-00-00' for column 'col3' at row 1
ERROR 22007: Incorrect datetime value: '0000-00-00' for column 'col3' at row 1
drop table t1;
drop table t1;
...
...
mysql-test/t/strict.test
View file @
b43b7dc1
...
@@ -198,20 +198,12 @@ INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
...
@@ -198,20 +198,12 @@ INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
INSERT
INTO
t1
(
col1
)
VALUES
(
STR_TO_DATE
(
'0.10.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
INSERT
INTO
t1
(
col1
)
VALUES
(
STR_TO_DATE
(
'0.10.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1292
--
error
1292
INSERT
INTO
t1
(
col1
)
VALUES
(
STR_TO_DATE
(
'31.9.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
INSERT
INTO
t1
(
col1
)
VALUES
(
STR_TO_DATE
(
'31.9.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1411
# deactivated because of Bug#5902
INSERT
INTO
t1
(
col1
)
VALUES
(
STR_TO_DATE
(
'32.10.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
# Bug#5902: Traditional mode: STR_TO_DATE changes invalid value rather than rejecting
#--error 1292
#INSERT INTO t1 (col1) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
--
error
1292
--
error
1292
INSERT
INTO
t1
(
col1
)
VALUES
(
STR_TO_DATE
(
'29.02.2003 15.30'
,
'%d.%m.%Y %H.%i'
));
INSERT
INTO
t1
(
col1
)
VALUES
(
STR_TO_DATE
(
'29.02.2003 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1411
# deactivated because of Bug#5902
INSERT
INTO
t1
(
col1
)
VALUES
(
STR_TO_DATE
(
'15.13.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
# Bug#5902: Traditional mode: STR_TO_DATE changes invalid value rather than rejecting
#--error 1292
#INSERT INTO t1 (col1) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i'));
--
error
1292
--
error
1292
INSERT
INTO
t1
(
col1
)
VALUES
(
STR_TO_DATE
(
'00.00.0000'
,
'%d.%m.%Y'
));
INSERT
INTO
t1
(
col1
)
VALUES
(
STR_TO_DATE
(
'00.00.0000'
,
'%d.%m.%Y'
));
...
@@ -227,21 +219,14 @@ INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
...
@@ -227,21 +219,14 @@ INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
INSERT
INTO
t1
(
col2
)
VALUES
(
STR_TO_DATE
(
'0.10.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
INSERT
INTO
t1
(
col2
)
VALUES
(
STR_TO_DATE
(
'0.10.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1292
--
error
1292
INSERT
INTO
t1
(
col2
)
VALUES
(
STR_TO_DATE
(
'31.9.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
INSERT
INTO
t1
(
col2
)
VALUES
(
STR_TO_DATE
(
'31.9.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1411
# deactivated because of Bug#5902
INSERT
INTO
t1
(
col2
)
VALUES
(
STR_TO_DATE
(
'32.10.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
# Bug#5902: Traditional mode: STR_TO_DATE changes invalid value rather than rejecting
#--error 1292
#INSERT INTO t1 (col2) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
--
error
1292
--
error
1292
INSERT
INTO
t1
(
col2
)
VALUES
(
STR_TO_DATE
(
'29.02.2003 15.30'
,
'%d.%m.%Y %H.%i'
));
INSERT
INTO
t1
(
col2
)
VALUES
(
STR_TO_DATE
(
'29.02.2003 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1411
# deactivated because of Bug#5902
INSERT
INTO
t1
(
col2
)
VALUES
(
STR_TO_DATE
(
'15.13.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
# Bug#5902: Traditional mode: STR_TO_DATE changes invalid value rather than rejecting
--
error
1292
#--error 1292
INSERT
INTO
t1
(
col2
)
VALUES
(
STR_TO_DATE
(
'00.00.0000'
,
'%d.%m.%Y'
));
#INSERT INTO t1 (col2) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i'));
#--error 1292
#INSERT INTO t1 (col2) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
## Test INSERT with STR_TO_DATE into TIMESTAMP
## Test INSERT with STR_TO_DATE into TIMESTAMP
# All test cases expected to fail should return
# All test cases expected to fail should return
...
@@ -255,20 +240,12 @@ INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
...
@@ -255,20 +240,12 @@ INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
INSERT
INTO
t1
(
col3
)
VALUES
(
STR_TO_DATE
(
'0.10.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
INSERT
INTO
t1
(
col3
)
VALUES
(
STR_TO_DATE
(
'0.10.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1292
--
error
1292
INSERT
INTO
t1
(
col3
)
VALUES
(
STR_TO_DATE
(
'31.9.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
INSERT
INTO
t1
(
col3
)
VALUES
(
STR_TO_DATE
(
'31.9.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1411
# deactivated because of Bug#5902
INSERT
INTO
t1
(
col3
)
VALUES
(
STR_TO_DATE
(
'32.10.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
# Bug#5902: Traditional mode: STR_TO_DATE changes invalid value rather than rejecting
#--error 1292
#INSERT INTO t1 (col3) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
--
error
1292
--
error
1292
INSERT
INTO
t1
(
col3
)
VALUES
(
STR_TO_DATE
(
'29.02.2003 15.30'
,
'%d.%m.%Y %H.%i'
));
INSERT
INTO
t1
(
col3
)
VALUES
(
STR_TO_DATE
(
'29.02.2003 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1411
# deactivated because of Bug#5902
INSERT
INTO
t1
(
col3
)
VALUES
(
STR_TO_DATE
(
'15.13.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
# Bug#5902: Traditional mode: STR_TO_DATE changes invalid value rather than rejecting
#--error 1292
#INSERT INTO t1 (col3) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i'));
--
error
1292
--
error
1292
INSERT
INTO
t1
(
col3
)
VALUES
(
STR_TO_DATE
(
'00.00.0000'
,
'%d.%m.%Y'
));
INSERT
INTO
t1
(
col3
)
VALUES
(
STR_TO_DATE
(
'00.00.0000'
,
'%d.%m.%Y'
));
...
...
sql/field.cc
View file @
b43b7dc1
...
@@ -4699,15 +4699,19 @@ int Field_datetime::store(const char *from,uint len,CHARSET_INFO *cs)
...
@@ -4699,15 +4699,19 @@ int Field_datetime::store(const char *from,uint len,CHARSET_INFO *cs)
TIME
time_tmp
;
TIME
time_tmp
;
int
error
;
int
error
;
ulonglong
tmp
=
0
;
ulonglong
tmp
=
0
;
enum
enum_mysql_timestamp_type
func_res
;
if
(
str_to_datetime
(
from
,
len
,
&
time_tmp
,
func_res
=
str_to_datetime
(
from
,
len
,
&
time_tmp
,
(
TIME_FUZZY_DATE
|
(
TIME_FUZZY_DATE
|
(
table
->
in_use
->
variables
.
sql_mode
&
(
table
->
in_use
->
variables
.
sql_mode
&
(
MODE_NO_ZERO_IN_DATE
|
MODE_NO_ZERO_DATE
|
(
MODE_NO_ZERO_IN_DATE
|
MODE_NO_ZERO_DATE
|
MODE_INVALID_DATES
))),
MODE_INVALID_DATES
))),
&
error
)
>
MYSQL_TIMESTAMP_ERROR
)
&
error
);
if
((
int
)
func_res
>
(
int
)
MYSQL_TIMESTAMP_ERROR
)
tmp
=
TIME_to_ulonglong_datetime
(
&
time_tmp
);
tmp
=
TIME_to_ulonglong_datetime
(
&
time_tmp
);
else
error
=
1
;
// Fix if invalid zero date
if
(
error
)
if
(
error
)
set_datetime_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
set_datetime_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_DATA_OUT_OF_RANGE
,
ER_WARN_DATA_OUT_OF_RANGE
,
...
...
sql/log_event.h
View file @
b43b7dc1
...
@@ -234,7 +234,7 @@ struct sql_ex_info
...
@@ -234,7 +234,7 @@ struct sql_ex_info
/* these are codes, not offsets; not more than 256 values (1 byte). */
/* these are codes, not offsets; not more than 256 values (1 byte). */
#define Q_FLAGS2_CODE 0
#define Q_FLAGS2_CODE 0
#define Q_SQL_MODE_CODE 1
#define Q_SQL_MODE_CODE 1
#ifdef TO_BE_DELETED
#if
n
def TO_BE_DELETED
/*
/*
Q_CATALOG_CODE is catalog with end zero stored; it is used only by MySQL
Q_CATALOG_CODE is catalog with end zero stored; it is used only by MySQL
5.0.x where 0<=x<=3.
5.0.x where 0<=x<=3.
...
...
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