Commit a4ff37e9 authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-6421 SQL_ERROR_LOG doesn't log comments in Events.

  Change parser so it saves all the query line to the ';' in the
    sp_instr::m_query.
parent 666b9663
...@@ -90,7 +90,7 @@ create table events_smode_test(ev_name char(10), a date); ...@@ -90,7 +90,7 @@ create table events_smode_test(ev_name char(10), a date);
"This should never insert something" "This should never insert something"
create event ee_16407_2 on schedule every 60 second do create event ee_16407_2 on schedule every 60 second do
begin begin
select get_lock('ee_16407_2', 60) /*ee_16407_2*/; select get_lock('ee_16407_2', 60); /*ee_16407_2*/
select release_lock('ee_16407_2'); select release_lock('ee_16407_2');
insert into events_test.events_smode_test values('ee_16407_2','1980-19-02'); insert into events_test.events_smode_test values('ee_16407_2','1980-19-02');
end| end|
...@@ -99,7 +99,7 @@ ERROR 22007: Incorrect date value: '1980-19-02' for column 'a' at row 1 ...@@ -99,7 +99,7 @@ ERROR 22007: Incorrect date value: '1980-19-02' for column 'a' at row 1
"This is ok" "This is ok"
create event ee_16407_3 on schedule every 60 second do create event ee_16407_3 on schedule every 60 second do
begin begin
select get_lock('ee_16407_2', 60) /*ee_16407_3*/; select get_lock('ee_16407_2', 60); /*ee_16407_3*/
select release_lock('ee_16407_2'); select release_lock('ee_16407_2');
insert into events_test.events_smode_test values ('ee_16407_3','1980-02-19'); insert into events_test.events_smode_test values ('ee_16407_3','1980-02-19');
insert into events_test.events_smode_test values ('ee_16407_3','1980-02-29'); insert into events_test.events_smode_test values ('ee_16407_3','1980-02-29');
...@@ -108,7 +108,7 @@ set sql_mode=""| ...@@ -108,7 +108,7 @@ set sql_mode=""|
"This will insert rows but they will be truncated" "This will insert rows but they will be truncated"
create event ee_16407_4 on schedule every 60 second do create event ee_16407_4 on schedule every 60 second do
begin begin
select get_lock('ee_16407_2', 60) /*ee_16407_4*/; select get_lock('ee_16407_2', 60); /*ee_16407_4*/
select release_lock('ee_16407_2'); select release_lock('ee_16407_2');
insert into events_test.events_smode_test values ('ee_16407_4','10-11-1956'); insert into events_test.events_smode_test values ('ee_16407_4','10-11-1956');
end| end|
...@@ -156,13 +156,13 @@ create procedure ee_16407_5_pendant() begin insert into events_test.events_smode ...@@ -156,13 +156,13 @@ create procedure ee_16407_5_pendant() begin insert into events_test.events_smode
create procedure ee_16407_6_pendant() begin insert into events_test.events_smode_test values('ee_16407_6','2004-02-29'); end| create procedure ee_16407_6_pendant() begin insert into events_test.events_smode_test values('ee_16407_6','2004-02-29'); end|
create event ee_16407_5 on schedule every 60 second do create event ee_16407_5 on schedule every 60 second do
begin begin
select get_lock('ee_16407_5', 60) /*ee_16407_5*/; select get_lock('ee_16407_5', 60); /*ee_16407_5*/
select release_lock('ee_16407_5'); select release_lock('ee_16407_5');
call events_test.ee_16407_5_pendant(); call events_test.ee_16407_5_pendant();
end| end|
create event ee_16407_6 on schedule every 60 second do create event ee_16407_6 on schedule every 60 second do
begin begin
select get_lock('ee_16407_5', 60) /*ee_16407_6*/; select get_lock('ee_16407_5', 60); /*ee_16407_6*/
select release_lock('ee_16407_5'); select release_lock('ee_16407_5');
call events_test.ee_16407_6_pendant(); call events_test.ee_16407_6_pendant();
end| end|
......
...@@ -35,6 +35,15 @@ SET SQL_MODE = ''; ...@@ -35,6 +35,15 @@ SET SQL_MODE = '';
drop table t1; drop table t1;
SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'not_exists' AND TABLE_NAME = 'not_exists'; SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'not_exists' AND TABLE_NAME = 'not_exists';
TABLE_NAME TABLE_NAME
CREATE procedure e1()
BEGIN
START TRANSACTION;
INSERT INTO test.non_exists VALUES (0,0,0) /* e1 */;
COMMIT;
END|
CALL e1();
ERROR 42S02: Table 'test.non_exists' doesn't exist
DROP PROCEDURE e1;
uninstall plugin SQL_ERROR_LOG; uninstall plugin SQL_ERROR_LOG;
Warnings: Warnings:
Warning 1620 Plugin is busy and will be uninstalled on shutdown Warning 1620 Plugin is busy and will be uninstalled on shutdown
...@@ -45,3 +54,4 @@ TIME HOSTNAME ERROR 1000: new message : RESIGNAL SQLSTATE '40000' SET ...@@ -45,3 +54,4 @@ TIME HOSTNAME ERROR 1000: new message : RESIGNAL SQLSTATE '40000' SET
MYSQL_ERRNO = 1000, MYSQL_ERRNO = 1000,
MESSAGE_TEXT = 'new message' MESSAGE_TEXT = 'new message'
TIME HOSTNAME ERROR 1366: Incorrect integer value: 'aa' for column 'id' at row 1 : insert into t1 values ('aa') TIME HOSTNAME ERROR 1366: Incorrect integer value: 'aa' for column 'id' at row 1 : insert into t1 values ('aa')
TIME HOSTNAME ERROR 1146: Table 'test.non_exists' doesn't exist : INSERT INTO test.non_exists VALUES (0,0,0) /* e1 */
...@@ -48,6 +48,24 @@ drop table t1; ...@@ -48,6 +48,24 @@ drop table t1;
SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'not_exists' AND TABLE_NAME = 'not_exists'; SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'not_exists' AND TABLE_NAME = 'not_exists';
#
# MDEV-6421 SQL_ERROR_LOG doesn't log comments in Events
# actually testing SP call is enough for that.
DELIMITER |;
CREATE procedure e1()
BEGIN
START TRANSACTION;
INSERT INTO test.non_exists VALUES (0,0,0) /* e1 */;
COMMIT;
END|
DELIMITER ;|
--error ER_NO_SUCH_TABLE
CALL e1();
DROP PROCEDURE e1;
uninstall plugin SQL_ERROR_LOG; uninstall plugin SQL_ERROR_LOG;
let $MYSQLD_DATADIR= `SELECT @@datadir`; let $MYSQLD_DATADIR= `SELECT @@datadir`;
......
...@@ -305,7 +305,7 @@ create table events_smode_test(ev_name char(10), a date); ...@@ -305,7 +305,7 @@ create table events_smode_test(ev_name char(10), a date);
delimiter |; delimiter |;
create event ee_16407_2 on schedule every 60 second do create event ee_16407_2 on schedule every 60 second do
begin begin
select get_lock('ee_16407_2', 60) /*ee_16407_2*/; select get_lock('ee_16407_2', 60); /*ee_16407_2*/
select release_lock('ee_16407_2'); select release_lock('ee_16407_2');
insert into events_test.events_smode_test values('ee_16407_2','1980-19-02'); insert into events_test.events_smode_test values('ee_16407_2','1980-19-02');
end| end|
...@@ -314,7 +314,7 @@ insert into events_test.events_smode_test values ('test','1980-19-02')| ...@@ -314,7 +314,7 @@ insert into events_test.events_smode_test values ('test','1980-19-02')|
--echo "This is ok" --echo "This is ok"
create event ee_16407_3 on schedule every 60 second do create event ee_16407_3 on schedule every 60 second do
begin begin
select get_lock('ee_16407_2', 60) /*ee_16407_3*/; select get_lock('ee_16407_2', 60); /*ee_16407_3*/
select release_lock('ee_16407_2'); select release_lock('ee_16407_2');
insert into events_test.events_smode_test values ('ee_16407_3','1980-02-19'); insert into events_test.events_smode_test values ('ee_16407_3','1980-02-19');
insert into events_test.events_smode_test values ('ee_16407_3','1980-02-29'); insert into events_test.events_smode_test values ('ee_16407_3','1980-02-29');
...@@ -323,7 +323,7 @@ set sql_mode=""| ...@@ -323,7 +323,7 @@ set sql_mode=""|
--echo "This will insert rows but they will be truncated" --echo "This will insert rows but they will be truncated"
create event ee_16407_4 on schedule every 60 second do create event ee_16407_4 on schedule every 60 second do
begin begin
select get_lock('ee_16407_2', 60) /*ee_16407_4*/; select get_lock('ee_16407_2', 60); /*ee_16407_4*/
select release_lock('ee_16407_2'); select release_lock('ee_16407_2');
insert into events_test.events_smode_test values ('ee_16407_4','10-11-1956'); insert into events_test.events_smode_test values ('ee_16407_4','10-11-1956');
end| end|
...@@ -411,13 +411,13 @@ create procedure ee_16407_5_pendant() begin insert into events_test.events_smode ...@@ -411,13 +411,13 @@ create procedure ee_16407_5_pendant() begin insert into events_test.events_smode
create procedure ee_16407_6_pendant() begin insert into events_test.events_smode_test values('ee_16407_6','2004-02-29'); end| create procedure ee_16407_6_pendant() begin insert into events_test.events_smode_test values('ee_16407_6','2004-02-29'); end|
create event ee_16407_5 on schedule every 60 second do create event ee_16407_5 on schedule every 60 second do
begin begin
select get_lock('ee_16407_5', 60) /*ee_16407_5*/; select get_lock('ee_16407_5', 60); /*ee_16407_5*/
select release_lock('ee_16407_5'); select release_lock('ee_16407_5');
call events_test.ee_16407_5_pendant(); call events_test.ee_16407_5_pendant();
end| end|
create event ee_16407_6 on schedule every 60 second do create event ee_16407_6 on schedule every 60 second do
begin begin
select get_lock('ee_16407_5', 60) /*ee_16407_6*/; select get_lock('ee_16407_5', 60); /*ee_16407_6*/
select release_lock('ee_16407_5'); select release_lock('ee_16407_5');
call events_test.ee_16407_6_pendant(); call events_test.ee_16407_6_pendant();
end| end|
......
...@@ -3696,7 +3696,7 @@ sp_proc_stmt_statement: ...@@ -3696,7 +3696,7 @@ sp_proc_stmt_statement:
if (yychar == YYEMPTY) if (yychar == YYEMPTY)
i->m_query.length= lip->get_ptr() - sp->m_tmp_query; i->m_query.length= lip->get_ptr() - sp->m_tmp_query;
else else
i->m_query.length= lip->get_tok_end() - sp->m_tmp_query; i->m_query.length= lip->get_tok_start() - sp->m_tmp_query;;
if (!(i->m_query.str= strmake_root(thd->mem_root, if (!(i->m_query.str= strmake_root(thd->mem_root,
sp->m_tmp_query, sp->m_tmp_query,
i->m_query.length)) || i->m_query.length)) ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment