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
5b9a2f3b
Commit
5b9a2f3b
authored
Sep 14, 2010
by
Marc Alff
Browse files
Options
Browse Files
Download
Plain Diff
Local merge
parents
bb04ac97
dbe1c80f
Changes
33
Show whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
349 additions
and
138 deletions
+349
-138
client/mysqltest.cc
client/mysqltest.cc
+131
-47
libmysqld/lib_sql.cc
libmysqld/lib_sql.cc
+4
-0
mysql-test/include/default_mysqld.cnf
mysql-test/include/default_mysqld.cnf
+6
-0
mysql-test/r/func_time.result
mysql-test/r/func_time.result
+2
-0
mysql-test/r/parser.result
mysql-test/r/parser.result
+4
-0
mysql-test/r/select.result
mysql-test/r/select.result
+6
-6
mysql-test/r/strict.result
mysql-test/r/strict.result
+15
-12
mysql-test/r/type_datetime.result
mysql-test/r/type_datetime.result
+25
-0
mysql-test/suite/perfschema/include/upgrade_check.inc
mysql-test/suite/perfschema/include/upgrade_check.inc
+1
-1
mysql-test/suite/perfschema/r/start_server_no_cond_class.result
...test/suite/perfschema/r/start_server_no_cond_class.result
+4
-4
mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
...-test/suite/perfschema/r/start_server_no_cond_inst.result
+4
-4
mysql-test/suite/perfschema/r/start_server_no_file_class.result
...test/suite/perfschema/r/start_server_no_file_class.result
+4
-4
mysql-test/suite/perfschema/r/start_server_no_file_inst.result
...-test/suite/perfschema/r/start_server_no_file_inst.result
+4
-4
mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
...est/suite/perfschema/r/start_server_no_mutex_class.result
+4
-4
mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
...test/suite/perfschema/r/start_server_no_mutex_inst.result
+3
-3
mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
...st/suite/perfschema/r/start_server_no_rwlock_class.result
+4
-4
mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
...est/suite/perfschema/r/start_server_no_rwlock_inst.result
+3
-3
mysql-test/suite/perfschema/r/start_server_no_thread_class.result
...st/suite/perfschema/r/start_server_no_thread_class.result
+4
-4
mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
...est/suite/perfschema/r/start_server_no_thread_inst.result
+4
-4
mysql-test/suite/perfschema/r/start_server_off.result
mysql-test/suite/perfschema/r/start_server_off.result
+4
-4
mysql-test/suite/perfschema/r/start_server_on.result
mysql-test/suite/perfschema/r/start_server_on.result
+4
-4
mysql-test/t/strict.test
mysql-test/t/strict.test
+12
-12
mysql-test/t/type_datetime.test
mysql-test/t/type_datetime.test
+23
-0
mysys/my_gethwaddr.c
mysys/my_gethwaddr.c
+1
-1
mysys/my_sync.c
mysys/my_sync.c
+14
-7
sql/derror.cc
sql/derror.cc
+2
-0
sql/item_timefunc.cc
sql/item_timefunc.cc
+34
-1
sql/item_timefunc.h
sql/item_timefunc.h
+3
-0
sql/mysqld.cc
sql/mysqld.cc
+1
-0
sql/set_var.cc
sql/set_var.cc
+1
-1
sql/set_var.h
sql/set_var.h
+5
-3
sql/sys_vars.h
sql/sys_vars.h
+1
-1
storage/perfschema/ha_perfschema.cc
storage/perfschema/ha_perfschema.cc
+12
-0
No files found.
client/mysqltest.cc
View file @
5b9a2f3b
...
...
@@ -248,10 +248,14 @@ struct st_connection
my_bool
pending
;
#ifdef EMBEDDED_LIBRARY
pthread_t
tid
;
const
char
*
cur_query
;
int
cur_query_len
;
pthread_mutex_t
mutex
;
pthread_cond_t
cond
;
int
command
,
result
;
pthread_mutex_t
query_mutex
;
pthread_cond_t
query_cond
;
pthread_mutex_t
result_mutex
;
pthread_cond_t
result_cond
;
int
query_done
;
#endif
/*EMBEDDED_LIBRARY*/
};
...
...
@@ -703,67 +707,148 @@ void handle_no_error(struct st_command*);
#ifdef EMBEDDED_LIBRARY
#define EMB_SEND_QUERY 1
#define EMB_READ_QUERY_RESULT 2
#define EMB_END_CONNECTION 3
/* attributes of the query thread */
pthread_attr_t
cn_thd_attrib
;
/*
send_one_query executes query in separate thread, which is
necessary in embedded library to run 'send' in proper way.
This implementation doesn't handle errors returned
by mysql_send_query. It's technically possible, though
I don't see where it is needed.
This procedure represents the connection and actually
runs queries when in the EMBEDDED-SERVER mode.
The run_query_normal() just sends request for running
mysql_send_query and mysql_read_query_result() here.
*/
pthread_handler_t
send_one_query
(
void
*
arg
)
pthread_handler_t
connection_thread
(
void
*
arg
)
{
struct
st_connection
*
cn
=
(
struct
st_connection
*
)
arg
;
mysql_thread_init
();
(
void
)
mysql_send_query
(
&
cn
->
mysql
,
cn
->
cur_query
,
cn
->
cur_query_len
);
while
(
cn
->
command
!=
EMB_END_CONNECTION
)
{
if
(
!
cn
->
command
)
{
pthread_mutex_lock
(
&
cn
->
query_mutex
);
while
(
!
cn
->
command
)
pthread_cond_wait
(
&
cn
->
query_cond
,
&
cn
->
query_mutex
);
pthread_mutex_unlock
(
&
cn
->
query_mutex
);
}
switch
(
cn
->
command
)
{
case
EMB_END_CONNECTION
:
goto
end_thread
;
case
EMB_SEND_QUERY
:
cn
->
result
=
mysql_send_query
(
&
cn
->
mysql
,
cn
->
cur_query
,
cn
->
cur_query_len
);
break
;
case
EMB_READ_QUERY_RESULT
:
cn
->
result
=
mysql_read_query_result
(
&
cn
->
mysql
);
break
;
default:
DBUG_ASSERT
(
0
);
}
cn
->
command
=
0
;
pthread_mutex_lock
(
&
cn
->
result_mutex
);
cn
->
query_done
=
1
;
pthread_cond_signal
(
&
cn
->
result_cond
);
pthread_mutex_unlock
(
&
cn
->
result_mutex
);
}
mysql_thread_end
();
pthread_mutex_lock
(
&
cn
->
mutex
);
end_thread:
cn
->
query_done
=
1
;
pthread_cond_signal
(
&
cn
->
cond
);
pthread_mutex_unlock
(
&
cn
->
mutex
);
mysql_thread_end
();
pthread_exit
(
0
);
return
0
;
}
static
int
do_send_query
(
struct
st_connection
*
cn
,
const
char
*
q
,
int
q_len
,
int
flags
)
static
void
wait_query_thread_done
(
struct
st_connection
*
con
)
{
pthread_t
tid
;
DBUG_ASSERT
(
con
->
tid
);
if
(
!
con
->
query_done
)
{
pthread_mutex_lock
(
&
con
->
result_mutex
);
while
(
!
con
->
query_done
)
pthread_cond_wait
(
&
con
->
result_cond
,
&
con
->
result_mutex
);
pthread_mutex_unlock
(
&
con
->
result_mutex
);
}
}
if
(
flags
&
QUERY_REAP_FLAG
)
return
mysql_send_query
(
&
cn
->
mysql
,
q
,
q_len
);
if
(
pthread_mutex_init
(
&
cn
->
mutex
,
NULL
)
||
pthread_cond_init
(
&
cn
->
cond
,
NULL
))
die
(
"Error in the thread library"
);
static
void
signal_connection_thd
(
struct
st_connection
*
cn
,
int
command
)
{
DBUG_ASSERT
(
cn
->
tid
);
cn
->
query_done
=
0
;
cn
->
command
=
command
;
pthread_mutex_lock
(
&
cn
->
query_mutex
);
pthread_cond_signal
(
&
cn
->
query_cond
);
pthread_mutex_unlock
(
&
cn
->
query_mutex
);
}
/*
Sometimes we try to execute queries when the connection is closed.
It's done to make sure it was closed completely.
So that if our connection is closed (cn->tid == 0), we just return
the mysql_send_query() result which is an error in this case.
*/
static
int
do_send_query
(
struct
st_connection
*
cn
,
const
char
*
q
,
int
q_len
)
{
if
(
!
cn
->
tid
)
return
mysql_send_query
(
&
cn
->
mysql
,
q
,
q_len
);
cn
->
cur_query
=
q
;
cn
->
cur_query_len
=
q_len
;
cn
->
query_done
=
0
;
if
(
pthread_create
(
&
tid
,
&
cn_thd_attrib
,
send_one_query
,
(
void
*
)
cn
))
die
(
"Cannot start new thread for query"
);
signal_connection_thd
(
cn
,
EMB_SEND_QUERY
);
return
0
;
}
static
void
wait_query_thread_end
(
struct
st_connection
*
con
)
static
int
do_read_query_result
(
struct
st_connection
*
cn
)
{
if
(
!
con
->
query_done
)
{
pthread_mutex_lock
(
&
con
->
mutex
);
while
(
!
con
->
query_done
)
pthread_cond_wait
(
&
con
->
cond
,
&
con
->
mutex
);
pthread_mutex_unlock
(
&
con
->
mutex
);
}
DBUG_ASSERT
(
cn
->
tid
);
wait_query_thread_done
(
cn
);
signal_connection_thd
(
cn
,
EMB_READ_QUERY_RESULT
);
wait_query_thread_done
(
cn
);
return
cn
->
result
;
}
static
void
emb_close_connection
(
struct
st_connection
*
cn
)
{
if
(
!
cn
->
tid
)
return
;
wait_query_thread_done
(
cn
);
signal_connection_thd
(
cn
,
EMB_END_CONNECTION
);
pthread_join
(
cn
->
tid
,
NULL
);
cn
->
tid
=
0
;
pthread_mutex_destroy
(
&
cn
->
query_mutex
);
pthread_cond_destroy
(
&
cn
->
query_cond
);
pthread_mutex_destroy
(
&
cn
->
result_mutex
);
pthread_cond_destroy
(
&
cn
->
result_cond
);
}
static
void
init_connection_thd
(
struct
st_connection
*
cn
)
{
cn
->
query_done
=
1
;
cn
->
command
=
0
;
if
(
pthread_mutex_init
(
&
cn
->
query_mutex
,
NULL
)
||
pthread_cond_init
(
&
cn
->
query_cond
,
NULL
)
||
pthread_mutex_init
(
&
cn
->
result_mutex
,
NULL
)
||
pthread_cond_init
(
&
cn
->
result_cond
,
NULL
)
||
pthread_create
(
&
cn
->
tid
,
&
cn_thd_attrib
,
connection_thread
,
(
void
*
)
cn
))
die
(
"Error in the thread library"
);
}
#else
/*EMBEDDED_LIBRARY*/
#define do_send_query(cn,q,q_len,flags) mysql_send_query(&cn->mysql, q, q_len)
#define do_send_query(cn,q,q_len) mysql_send_query(&cn->mysql, q, q_len)
#define do_read_query_result(cn) mysql_read_query_result(&cn->mysql)
#endif
/*EMBEDDED_LIBRARY*/
...
...
@@ -1106,6 +1191,9 @@ void close_connections()
DBUG_ENTER
(
"close_connections"
);
for
(
--
next_con
;
next_con
>=
connections
;
--
next_con
)
{
#ifdef EMBEDDED_LIBRARY
emb_close_connection
(
next_con
);
#endif
if
(
next_con
->
stmt
)
mysql_stmt_close
(
next_con
->
stmt
);
next_con
->
stmt
=
0
;
...
...
@@ -4866,7 +4954,7 @@ void do_close_connection(struct st_command *command)
we need to check if the query's thread was finished and probably wait
(embedded-server specific)
*/
wait_query_thread_end
(
con
);
emb_close_connection
(
con
);
#endif
/*EMBEDDED_LIBRARY*/
if
(
con
->
stmt
)
mysql_stmt_close
(
con
->
stmt
);
...
...
@@ -5216,8 +5304,9 @@ void do_connect(struct st_command *command)
}
#ifdef EMBEDDED_LIBRARY
con_slot
->
query_done
=
1
;
#endif
init_connection_thd
(
con_slot
);
#endif
/*EMBEDDED_LIBRARY*/
if
(
!
mysql_init
(
&
con_slot
->
mysql
))
die
(
"Failed on mysql_init()"
);
...
...
@@ -6768,21 +6857,13 @@ void run_query_normal(struct st_connection *cn, struct st_command *command,
/*
Send the query
*/
if
(
do_send_query
(
cn
,
query
,
query_len
,
flags
))
if
(
do_send_query
(
cn
,
query
,
query_len
))
{
handle_error
(
command
,
mysql_errno
(
mysql
),
mysql_error
(
mysql
),
mysql_sqlstate
(
mysql
),
ds
);
goto
end
;
}
}
#ifdef EMBEDDED_LIBRARY
/*
Here we handle 'reap' command, so we need to check if the
query's thread was finished and probably wait
*/
else
if
(
flags
&
QUERY_REAP_FLAG
)
wait_query_thread_end
(
cn
);
#endif
/*EMBEDDED_LIBRARY*/
if
(
!
(
flags
&
QUERY_REAP_FLAG
))
{
cn
->
pending
=
TRUE
;
...
...
@@ -6795,7 +6876,7 @@ void run_query_normal(struct st_connection *cn, struct st_command *command,
When on first result set, call mysql_read_query_result to retrieve
answer to the query sent earlier
*/
if
((
counter
==
0
)
&&
mysql_read_query_result
(
mysql
))
if
((
counter
==
0
)
&&
do_read_query_result
(
cn
))
{
handle_error
(
command
,
mysql_errno
(
mysql
),
mysql_error
(
mysql
),
mysql_sqlstate
(
mysql
),
ds
);
...
...
@@ -7970,6 +8051,9 @@ int main(int argc, char **argv)
ps_protocol_enabled
=
1
;
st_connection
*
con
=
connections
;
#ifdef EMBEDDED_LIBRARY
init_connection_thd
(
con
);
#endif
/*EMBEDDED_LIBRARY*/
if
(
!
(
mysql_init
(
&
con
->
mysql
)))
die
(
"Failed in mysql_init()"
);
if
(
opt_connect_timeout
)
...
...
libmysqld/lib_sql.cc
View file @
5b9a2f3b
...
...
@@ -481,6 +481,10 @@ int init_embedded_server(int argc, char **argv, char **groups)
char
*
fake_argv
[]
=
{
(
char
*
)
""
,
0
};
const
char
*
fake_groups
[]
=
{
"server"
,
"embedded"
,
0
};
my_bool
acl_error
;
if
(
my_thread_init
())
return
1
;
if
(
argc
)
{
argcp
=
&
argc
;
...
...
mysql-test/include/default_mysqld.cnf
View file @
5b9a2f3b
...
...
@@ -43,5 +43,11 @@ log-bin=mysqld-bin
# Run tests with the performance schema instrumentation
loose-enable-performance-schema
# Run tests with a small number of instrumented objects
# to limit memory consumption with MTR
loose-performance-schema-max-mutex-instances=10000
loose-performance-schema-max-rwlock-instances=10000
loose-performance-schema-max-table-instances=500
loose-performance-schema-max-table-handles=1000
binlog-direct-non-transactional-updates
mysql-test/r/func_time.result
View file @
5b9a2f3b
...
...
@@ -1200,6 +1200,8 @@ set time_zone= @@global.time_zone;
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
NULL
Warnings:
Warning 1411 Incorrect datetime value: '10:00 PM' for function str_to_date
create table t1 (field DATE);
insert into t1 values ('2006-11-06');
select * from t1 where field < '2006-11-06 04:08:36.0';
...
...
mysql-test/r/parser.result
View file @
5b9a2f3b
...
...
@@ -556,9 +556,13 @@ DROP TABLE IF EXISTS t1;
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
NULL
Warnings:
Warning 1411 Incorrect datetime value: '10:00 PM' for function str_to_date
SELECT STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL (INTERVAL(1,2,3) + 1) MINUTE;
STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL (INTERVAL(1,2,3) + 1) MINUTE
NULL
Warnings:
Warning 1411 Incorrect datetime value: '10:00 PM' for function str_to_date
SELECT "1997-12-31 23:59:59" + INTERVAL 1 SECOND;
"1997-12-31 23:59:59" + INTERVAL 1 SECOND
1998-01-01 00:00:00
...
...
mysql-test/r/select.result
View file @
5b9a2f3b
...
...
@@ -4171,9 +4171,10 @@ str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01 00:00:00'
set SQL_MODE=TRADITIONAL;
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34';
str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'
0
NULL
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007-10-00 12:34'
Warning 1411 Incorrect datetime value: '2007-10-00 12:34' for function str_to_date
select str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34';
str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'
0
...
...
@@ -4181,17 +4182,16 @@ Warnings:
Warning 1292 Truncated incorrect datetime value: '2007-10-00 12:34'
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34';
str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34'
0
NULL
Warnings:
Warning 1
292 Truncated incorrect datetime value: '2007-10-00 12:34:00'
Warning 1
411 Incorrect datetime value: '2007-10-00 12:34' for function str_to_date
select str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01'
and '2007/10/20';
str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01'
and '2007/10/20'
0
NULL
Warnings:
Warning 1292 Incorrect datetime value: '2007-10-00' for column '2007/09/01' at row 1
Warning 1292 Incorrect datetime value: '2007-10-00' for column '2007/10/20' at row 1
Warning 1411 Incorrect datetime value: '2007-10-00' for function str_to_date
set SQL_MODE=DEFAULT;
select str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20';
str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20'
...
...
mysql-test/r/strict.result
View file @
5b9a2f3b
...
...
@@ -206,12 +206,11 @@ INSERT INTO t1 (col1) VALUES (STR_TO_DATE('15.10.2004','%d.%m.%Y'));
INSERT INTO t1 (col2) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col3) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
Warnings:
Note 1265 Data truncated for column 'col1' at row 1
ERROR HY000: Incorrect datetime value: '31.10.0000 15.30' for function str_to_date
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
ERROR
22007: Incorrect date value: '2004-00-31 15:30:00' for column 'col1' at row 1
ERROR
HY000: Incorrect datetime value: '31.0.2004 15.30' for function str_to_date
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
HY000: Incorrect datetime value: '0.10.2004 15.30' for function str_to_date
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
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
...
...
@@ -221,12 +220,13 @@ ERROR 22007: Incorrect date value: '2003-02-29 15:30:00' for column 'col1' at ro
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_date
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
HY000: Incorrect datetime value: '00.00.0000' for function str_to_date
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '31.10.0000 15.30' for function str_to_date
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
ERROR
22007: Incorrect datetime value: '2004-00-31 15:30:00' for column 'col2' at row 1
ERROR
HY000: Incorrect datetime value: '31.0.2004 15.30' for function str_to_date
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
HY000: Incorrect datetime value: '0.10.2004 15.30' for function str_to_date
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
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
...
...
@@ -236,13 +236,13 @@ ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column 'col2' a
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_date
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
ERROR
HY000: Incorrect datetime value: '00.00.0000' for function str_to_date
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
HY000: Incorrect datetime value: '31.10.0000 15.30' for function str_to_date
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
ERROR
22007: Incorrect datetime value: '2004-00-31 15:30:00' for column 'col3' at row 1
ERROR
HY000: Incorrect datetime value: '31.0.2004 15.30' for function str_to_date
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
HY000: Incorrect datetime value: '0.10.2004 15.30' for function str_to_date
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
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
...
...
@@ -252,7 +252,7 @@ ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column 'col3' a
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_date
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
HY000: Incorrect datetime value: '00.00.0000' for function str_to_date
drop table t1;
CREATE TABLE t1 (col1 date, col2 datetime, col3 timestamp);
INSERT INTO t1 (col1) VALUES (CAST('2004-10-15' AS DATE));
...
...
@@ -1108,6 +1108,9 @@ Warnings:
Warning 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date
Warning 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date
Warning 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date
Warning 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date
Warning 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date
Warning 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date
drop table t1;
create table t1 (col1 char(3), col2 integer);
insert into t1 (col1) values (cast(1000 as char(3)));
...
...
mysql-test/r/type_datetime.result
View file @
5b9a2f3b
...
...
@@ -655,5 +655,30 @@ Note 1003 select `test`.`t1`.`Id` AS `Id`,`test`.`t1`.`AtTime` AS `AtTime` from
DROP TABLE t1;
SET NAMES latin1;
#
# Bug#56271: Wrong comparison result with STR_TO_DATE function
#
CREATE TABLE t1 (
`year` int(4) NOT NULL,
`month` int(2) NOT NULL
);
INSERT INTO t1 VALUES (2010,3),(2010,4),(2009,8),(2008,9);
SELECT *
FROM t1
WHERE STR_TO_DATE(CONCAT_WS('/01/',`month`,`year`), '%m/%d/%Y') >=
STR_TO_DATE('1/1/2010', '%m/%d/%Y');
year month
2010 3
2010 4
create table t2(f1 datetime primary key);
insert into t2 select STR_TO_DATE(CONCAT_WS('/01/',`month`,`year`), '%m/%d/%Y') from t1;
select * from t2 where f1=STR_TO_DATE('4/1/2010', '%m/%d/%Y');
f1
2010-04-01 00:00:00
t2 should be const
explain select * from t2 where f1=STR_TO_DATE('4/1/2010', '%m/%d/%Y');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 const PRIMARY PRIMARY 8 const 1 Using index
DROP TABLE t1,t2;
#
# End of 5.5 tests
#
mysql-test/suite/perfschema/include/upgrade_check.inc
View file @
5b9a2f3b
...
...
@@ -18,7 +18,7 @@
#
--
error
1
--
exec
$MYSQL_UPGRADE
--
skip
-
verbose
>
$out_file
2
>
$err_file
--
exec
$MYSQL_UPGRADE
--
skip
-
verbose
--
force
>
$out_file
2
>
$err_file
# Verify that mysql_upgrade complained about the performance_schema
--
cat_file
$err_file
...
...
mysql-test/suite/perfschema/r/start_server_no_cond_class.result
View file @
5b9a2f3b
...
...
@@ -45,11 +45,11 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
performance_schema_max_mutex_instances 10000
00
performance_schema_max_mutex_instances 10000
performance_schema_max_rwlock_classes 30
performance_schema_max_rwlock_instances 10000
00
performance_schema_max_table_handles 1000
00
performance_schema_max_table_instances 500
00
performance_schema_max_rwlock_instances 10000
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
performance_schema_max_thread_instances 1000
show engine PERFORMANCE_SCHEMA status;
...
...
mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
View file @
5b9a2f3b
...
...
@@ -45,11 +45,11 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
performance_schema_max_mutex_instances 10000
00
performance_schema_max_mutex_instances 10000
performance_schema_max_rwlock_classes 30
performance_schema_max_rwlock_instances 10000
00
performance_schema_max_table_handles 1000
00
performance_schema_max_table_instances 500
00
performance_schema_max_rwlock_instances 10000
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
performance_schema_max_thread_instances 1000
show engine PERFORMANCE_SCHEMA status;
...
...
mysql-test/suite/perfschema/r/start_server_no_file_class.result
View file @
5b9a2f3b
...
...
@@ -45,11 +45,11 @@ performance_schema_max_file_classes 0
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
performance_schema_max_mutex_instances 10000
00
performance_schema_max_mutex_instances 10000
performance_schema_max_rwlock_classes 30
performance_schema_max_rwlock_instances 10000
00
performance_schema_max_table_handles 1000
00
performance_schema_max_table_instances 500
00
performance_schema_max_rwlock_instances 10000
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
performance_schema_max_thread_instances 1000
show engine PERFORMANCE_SCHEMA status;
...
...
mysql-test/suite/perfschema/r/start_server_no_file_inst.result
View file @
5b9a2f3b
...
...
@@ -45,11 +45,11 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 0
performance_schema_max_mutex_classes 200
performance_schema_max_mutex_instances 10000
00
performance_schema_max_mutex_instances 10000
performance_schema_max_rwlock_classes 30
performance_schema_max_rwlock_instances 10000
00
performance_schema_max_table_handles 1000
00
performance_schema_max_table_instances 500
00
performance_schema_max_rwlock_instances 10000
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
performance_schema_max_thread_instances 1000
show engine PERFORMANCE_SCHEMA status;
...
...
mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
View file @
5b9a2f3b
...
...
@@ -45,11 +45,11 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 0
performance_schema_max_mutex_instances 10000
00
performance_schema_max_mutex_instances 10000
performance_schema_max_rwlock_classes 30
performance_schema_max_rwlock_instances 10000
00
performance_schema_max_table_handles 1000
00
performance_schema_max_table_instances 500
00
performance_schema_max_rwlock_instances 10000
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
performance_schema_max_thread_instances 1000
show engine PERFORMANCE_SCHEMA status;
...
...
mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
View file @
5b9a2f3b
...
...
@@ -47,9 +47,9 @@ performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
performance_schema_max_mutex_instances 0
performance_schema_max_rwlock_classes 30
performance_schema_max_rwlock_instances 10000
00
performance_schema_max_table_handles 1000
00
performance_schema_max_table_instances 500
00
performance_schema_max_rwlock_instances 10000
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
performance_schema_max_thread_instances 1000
show engine PERFORMANCE_SCHEMA status;
...
...
mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
View file @
5b9a2f3b
...
...
@@ -45,11 +45,11 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
performance_schema_max_mutex_instances 10000
00
performance_schema_max_mutex_instances 10000
performance_schema_max_rwlock_classes 0
performance_schema_max_rwlock_instances 10000
00
performance_schema_max_table_handles 1000
00
performance_schema_max_table_instances 500
00
performance_schema_max_rwlock_instances 10000
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
performance_schema_max_thread_instances 1000
show engine PERFORMANCE_SCHEMA status;
...
...
mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
View file @
5b9a2f3b
...
...
@@ -45,11 +45,11 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
performance_schema_max_mutex_instances 10000
00
performance_schema_max_mutex_instances 10000
performance_schema_max_rwlock_classes 30
performance_schema_max_rwlock_instances 0
performance_schema_max_table_handles 1000
00
performance_schema_max_table_instances 500
00
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
performance_schema_max_thread_instances 1000
show engine PERFORMANCE_SCHEMA status;
...
...
mysql-test/suite/perfschema/r/start_server_no_thread_class.result
View file @
5b9a2f3b
...
...
@@ -45,11 +45,11 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
performance_schema_max_mutex_instances 10000
00
performance_schema_max_mutex_instances 10000
performance_schema_max_rwlock_classes 30
performance_schema_max_rwlock_instances 10000
00
performance_schema_max_table_handles 1000
00
performance_schema_max_table_instances 500
00
performance_schema_max_rwlock_instances 10000
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 0
performance_schema_max_thread_instances 1000
show engine PERFORMANCE_SCHEMA status;
...
...
mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
View file @
5b9a2f3b
...
...
@@ -45,11 +45,11 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
performance_schema_max_mutex_instances 10000
00
performance_schema_max_mutex_instances 10000
performance_schema_max_rwlock_classes 30
performance_schema_max_rwlock_instances 10000
00
performance_schema_max_table_handles 1000
00
performance_schema_max_table_instances 500
00
performance_schema_max_rwlock_instances 10000
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
performance_schema_max_thread_instances 0
show engine PERFORMANCE_SCHEMA status;
...
...
mysql-test/suite/perfschema/r/start_server_off.result
View file @
5b9a2f3b
...
...
@@ -45,11 +45,11 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
performance_schema_max_mutex_instances 10000
00
performance_schema_max_mutex_instances 10000
performance_schema_max_rwlock_classes 30
performance_schema_max_rwlock_instances 10000
00
performance_schema_max_table_handles 1000
00
performance_schema_max_table_instances 500
00
performance_schema_max_rwlock_instances 10000
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
performance_schema_max_thread_instances 1000
show engine PERFORMANCE_SCHEMA status;
...
...
mysql-test/suite/perfschema/r/start_server_on.result
View file @
5b9a2f3b
...
...
@@ -45,11 +45,11 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
performance_schema_max_mutex_instances 10000
00
performance_schema_max_mutex_instances 10000
performance_schema_max_rwlock_classes 30
performance_schema_max_rwlock_instances 10000
00
performance_schema_max_table_handles 1000
00
performance_schema_max_table_instances 500
00
performance_schema_max_rwlock_instances 10000
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
performance_schema_max_thread_classes 50
performance_schema_max_thread_instances 1000
show engine PERFORMANCE_SCHEMA status;
...
...
mysql-test/t/strict.test
View file @
5b9a2f3b
...
...
@@ -192,11 +192,11 @@ INSERT INTO t1 (col3) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i'));
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid date value>
--
error
1411
INSERT
INTO
t1
(
col1
)
VALUES
(
STR_TO_DATE
(
'31.10.0000 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1292
--
error
1411
INSERT
INTO
t1
(
col1
)
VALUES
(
STR_TO_DATE
(
'31.0.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1
292
--
error
1
411
INSERT
INTO
t1
(
col1
)
VALUES
(
STR_TO_DATE
(
'0.10.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1292
INSERT
INTO
t1
(
col1
)
VALUES
(
STR_TO_DATE
(
'31.9.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
...
...
@@ -206,18 +206,18 @@ INSERT INTO t1 (col1) VALUES(STR_TO_DATE('32.10.2004 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
INSERT
INTO
t1
(
col1
)
VALUES
(
STR_TO_DATE
(
'15.13.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1
292
--
error
1
411
INSERT
INTO
t1
(
col1
)
VALUES
(
STR_TO_DATE
(
'00.00.0000'
,
'%d.%m.%Y'
));
## Test INSERT with STR_TO_DATE into DATETIME
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value>
--
error
1411
INSERT
INTO
t1
(
col2
)
VALUES
(
STR_TO_DATE
(
'31.10.0000 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1292
--
error
1411
INSERT
INTO
t1
(
col2
)
VALUES
(
STR_TO_DATE
(
'31.0.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1
292
--
error
1
411
INSERT
INTO
t1
(
col2
)
VALUES
(
STR_TO_DATE
(
'0.10.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1292
INSERT
INTO
t1
(
col2
)
VALUES
(
STR_TO_DATE
(
'31.9.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
...
...
@@ -227,18 +227,18 @@ INSERT INTO t1 (col2) VALUES(STR_TO_DATE('32.10.2004 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
INSERT
INTO
t1
(
col2
)
VALUES
(
STR_TO_DATE
(
'15.13.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1
292
--
error
1
411
INSERT
INTO
t1
(
col2
)
VALUES
(
STR_TO_DATE
(
'00.00.0000'
,
'%d.%m.%Y'
));
## Test INSERT with STR_TO_DATE into TIMESTAMP
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value>
--
error
1
292
--
error
1
411
INSERT
INTO
t1
(
col3
)
VALUES
(
STR_TO_DATE
(
'31.10.0000 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1
292
--
error
1
411
INSERT
INTO
t1
(
col3
)
VALUES
(
STR_TO_DATE
(
'31.0.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1
292
--
error
1
411
INSERT
INTO
t1
(
col3
)
VALUES
(
STR_TO_DATE
(
'0.10.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1292
INSERT
INTO
t1
(
col3
)
VALUES
(
STR_TO_DATE
(
'31.9.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
...
...
@@ -248,7 +248,7 @@ INSERT INTO t1 (col3) VALUES(STR_TO_DATE('32.10.2004 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
INSERT
INTO
t1
(
col3
)
VALUES
(
STR_TO_DATE
(
'15.13.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1
292
--
error
1
411
INSERT
INTO
t1
(
col3
)
VALUES
(
STR_TO_DATE
(
'00.00.0000'
,
'%d.%m.%Y'
));
drop
table
t1
;
...
...
mysql-test/t/type_datetime.test
View file @
5b9a2f3b
...
...
@@ -461,6 +461,29 @@ EXPLAIN EXTENDED SELECT * FROM t1 FORCE INDEX(attime) WHERE AtTime = '2010-02-22
DROP
TABLE
t1
;
SET
NAMES
latin1
;
--
echo
#
--
echo
# Bug#56271: Wrong comparison result with STR_TO_DATE function
--
echo
#
CREATE
TABLE
t1
(
`year`
int
(
4
)
NOT
NULL
,
`month`
int
(
2
)
NOT
NULL
);
INSERT
INTO
t1
VALUES
(
2010
,
3
),(
2010
,
4
),(
2009
,
8
),(
2008
,
9
);
SELECT
*
FROM
t1
WHERE
STR_TO_DATE
(
CONCAT_WS
(
'/01/'
,
`month`
,
`year`
),
'%m/%d/%Y'
)
>=
STR_TO_DATE
(
'1/1/2010'
,
'%m/%d/%Y'
);
create
table
t2
(
f1
datetime
primary
key
);
insert
into
t2
select
STR_TO_DATE
(
CONCAT_WS
(
'/01/'
,
`month`
,
`year`
),
'%m/%d/%Y'
)
from
t1
;
select
*
from
t2
where
f1
=
STR_TO_DATE
(
'4/1/2010'
,
'%m/%d/%Y'
);
--
echo
t2
should
be
const
explain
select
*
from
t2
where
f1
=
STR_TO_DATE
(
'4/1/2010'
,
'%m/%d/%Y'
);
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# End of 5.5 tests
--
echo
#
mysys/my_gethwaddr.c
View file @
5b9a2f3b
...
...
@@ -64,7 +64,7 @@ my_bool my_gethwaddr(uchar *to)
if
(
ifm
->
ifm_type
==
RTM_IFINFO
)
{
sdl
=
(
struct
sockaddr_dl
*
)(
ifm
+
1
);
addr
=
LLADDR
(
sdl
);
addr
=
(
uchar
*
)
LLADDR
(
sdl
);
res
=
memcpy_and_test
(
to
,
addr
,
ETHER_ADDR_LEN
);
}
}
...
...
mysys/my_sync.c
View file @
5b9a2f3b
...
...
@@ -100,9 +100,9 @@ static const char cur_dir_name[]= {FN_CURLIB, 0};
RETURN
0 if ok, !=0 if error
*/
#ifdef NEED_EXPLICIT_SYNC_DIR
int
my_sync_dir
(
const
char
*
dir_name
,
myf
my_flags
)
{
#ifdef NEED_EXPLICIT_SYNC_DIR
File
dir_fd
;
int
res
=
0
;
const
char
*
correct_dir_name
;
...
...
@@ -124,10 +124,14 @@ int my_sync_dir(const char *dir_name, myf my_flags)
else
res
=
1
;
DBUG_RETURN
(
res
);
#else
}
#else
/* NEED_EXPLICIT_SYNC_DIR */
int
my_sync_dir
(
const
char
*
dir_name
__attribute__
((
unused
)),
myf
my_flags
__attribute__
((
unused
)))
{
return
0
;
#endif
}
#endif
/* NEED_EXPLICIT_SYNC_DIR */
/*
...
...
@@ -141,15 +145,18 @@ int my_sync_dir(const char *dir_name, myf my_flags)
RETURN
0 if ok, !=0 if error
*/
#ifdef NEED_EXPLICIT_SYNC_DIR
int
my_sync_dir_by_file
(
const
char
*
file_name
,
myf
my_flags
)
{
#ifdef NEED_EXPLICIT_SYNC_DIR
char
dir_name
[
FN_REFLEN
];
size_t
dir_name_length
;
dirname_part
(
dir_name
,
file_name
,
&
dir_name_length
);
return
my_sync_dir
(
dir_name
,
my_flags
);
#else
}
#else
/* NEED_EXPLICIT_SYNC_DIR */
int
my_sync_dir_by_file
(
const
char
*
file_name
__attribute__
((
unused
)),
myf
my_flags
__attribute__
((
unused
)))
{
return
0
;
#endif
}
#endif
/* NEED_EXPLICIT_SYNC_DIR */
sql/derror.cc
View file @
5b9a2f3b
...
...
@@ -35,6 +35,8 @@ static void init_myfunc_errs(void);
C_MODE_START
static
const
char
**
get_server_errmsgs
()
{
if
(
!
current_thd
)
return
DEFAULT_ERRMSGS
;
return
CURRENT_THD_ERRMSGS
;
}
C_MODE_END
...
...
sql/item_timefunc.cc
View file @
5b9a2f3b
...
...
@@ -3368,6 +3368,8 @@ void Item_func_str_to_date::fix_length_and_dec()
cached_field_type
=
MYSQL_TYPE_DATETIME
;
max_length
=
MAX_DATETIME_FULL_WIDTH
*
MY_CHARSET_BIN_MB_MAXLEN
;
cached_timestamp_type
=
MYSQL_TIMESTAMP_NONE
;
sql_mode
=
(
current_thd
->
variables
.
sql_mode
&
(
MODE_NO_ZERO_IN_DATE
|
MODE_NO_ZERO_DATE
));
if
((
const_item
=
args
[
1
]
->
const_item
()))
{
char
format_buff
[
64
];
...
...
@@ -3433,6 +3435,14 @@ bool Item_func_str_to_date::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
return
0
;
null_date:
if
(
fuzzy_date
&
TIME_NO_ZERO_DATE
)
{
char
buff
[
128
];
strmake
(
buff
,
val
->
ptr
(),
min
(
val
->
length
(),
sizeof
(
buff
)
-
1
));
push_warning_printf
(
current_thd
,
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WRONG_VALUE_FOR_TYPE
,
ER
(
ER_WRONG_VALUE_FOR_TYPE
),
"datetime"
,
buff
,
"str_to_date"
);
}
return
(
null_value
=
1
);
}
...
...
@@ -3442,7 +3452,7 @@ String *Item_func_str_to_date::val_str(String *str)
DBUG_ASSERT
(
fixed
==
1
);
MYSQL_TIME
ltime
;
if
(
Item_func_str_to_date
::
get_date
(
&
ltime
,
TIME_FUZZY_DATE
))
if
(
Item_func_str_to_date
::
get_date
(
&
ltime
,
TIME_FUZZY_DATE
|
sql_mode
))
return
0
;
if
(
!
make_datetime
((
const_item
?
cached_format_type
:
...
...
@@ -3453,6 +3463,29 @@ String *Item_func_str_to_date::val_str(String *str)
}
longlong
Item_func_str_to_date
::
val_int
()
{
DBUG_ASSERT
(
fixed
==
1
);
MYSQL_TIME
ltime
;
if
(
Item_func_str_to_date
::
get_date
(
&
ltime
,
TIME_FUZZY_DATE
|
sql_mode
))
return
0
;
if
(
const_item
)
{
switch
(
cached_field_type
)
{
case
MYSQL_TYPE_DATE
:
return
TIME_to_ulonglong_date
(
&
ltime
);
case
MYSQL_TYPE_TIME
:
return
TIME_to_ulonglong_time
(
&
ltime
);
default:
return
TIME_to_ulonglong_datetime
(
&
ltime
);
}
}
return
TIME_to_ulonglong_datetime
(
&
ltime
);
}
bool
Item_func_last_day
::
get_date
(
MYSQL_TIME
*
ltime
,
uint
fuzzy_date
)
{
if
(
get_arg0_date
(
ltime
,
fuzzy_date
&
~
TIME_FUZZY_DATE
)
||
...
...
sql/item_timefunc.h
View file @
5b9a2f3b
...
...
@@ -1039,6 +1039,7 @@ class Item_func_str_to_date :public Item_str_func
date_time_format_types
cached_format_type
;
timestamp_type
cached_timestamp_type
;
bool
const_item
;
ulonglong
sql_mode
;
public:
Item_func_str_to_date
(
Item
*
a
,
Item
*
b
)
:
Item_str_func
(
a
,
b
),
const_item
(
false
)
...
...
@@ -1052,6 +1053,8 @@ class Item_func_str_to_date :public Item_str_func
{
return
tmp_table_field_from_field_type
(
table
,
1
);
}
longlong
val_int
();
bool
result_as_longlong
()
{
return
TRUE
;
}
};
...
...
sql/mysqld.cc
View file @
5b9a2f3b
...
...
@@ -1492,6 +1492,7 @@ void clean_up(bool print_message)
cleanup_errmsgs
();
MYSQL_CALLBACK
(
thread_scheduler
,
end
,
());
finish_client_errs
();
(
void
)
my_error_unregister
(
ER_ERROR_FIRST
,
ER_ERROR_LAST
);
// finish server errs
DBUG_PRINT
(
"quit"
,
(
"Error messages freed"
));
/* Tell main we are ready */
logger
.
cleanup_end
();
...
...
sql/set_var.cc
View file @
5b9a2f3b
...
...
@@ -108,7 +108,7 @@ void sys_var_end()
my_hash_free
(
&
system_variable_hash
);
for
(
sys_var
*
var
=
all_sys_vars
.
first
;
var
;
var
=
var
->
next
)
var
->
~
sys_var
();
var
->
cleanup
();
DBUG_VOID_RETURN
;
}
...
...
sql/set_var.h
View file @
5b9a2f3b
...
...
@@ -91,11 +91,13 @@ class sys_var
longlong
def_val
,
PolyLock
*
lock
,
enum
binlog_status_enum
binlog_status_arg
,
on_check_function
on_check_func
,
on_update_function
on_update_func
,
uint
deprecated_version
,
const
char
*
substitute
,
int
parse_flag
);
virtual
~
sys_var
()
{}
/**
The instance should only be destroyed on shutdown, as it doesn't unlink
itself from the chain.
All the cleanup procedures should be performed here
*/
virtual
~
sys_var
()
{}
virtual
void
cleanup
()
{}
/**
downcast for sys_var_pluginvar. Returns this if it's an instance
of sys_var_pluginvar, and 0 otherwise.
...
...
sql/sys_vars.h
View file @
5b9a2f3b
...
...
@@ -385,7 +385,7 @@ class Sys_var_charptr: public sys_var
DBUG_ASSERT
(
scope
()
==
GLOBAL
);
DBUG_ASSERT
(
size
==
sizeof
(
char
*
));
}
~
Sys_var_charptr
()
void
cleanup
()
{
if
(
flags
&
ALLOCATED
)
my_free
(
global_var
(
char
*
));
...
...
storage/perfschema/ha_perfschema.cc
View file @
5b9a2f3b
...
...
@@ -20,6 +20,7 @@
#include "my_global.h"
#include "my_pthread.h"
#include "my_atomic.h"
#include "sql_plugin.h"
#include "mysql/plugin.h"
#include "ha_perfschema.h"
...
...
@@ -28,6 +29,17 @@
#include "pfs_instr_class.h"
#include "pfs_instr.h"
#ifdef MY_ATOMIC_MODE_DUMMY
/*
The performance schema can can not function with MY_ATOMIC_MODE_DUMMY,
a fully functional implementation of MY_ATOMIC should be used instead.
If the build fails with this error message:
- either use a different ./configure --with-atomic-ops option
- or do not build with the performance schema.
*/
#error "The performance schema needs a functional MY_ATOMIC implementation."
#endif
handlerton
*
pfs_hton
=
NULL
;
static
handler
*
pfs_create_handler
(
handlerton
*
hton
,
...
...
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