summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2016-01-26 22:33:25 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2016-01-26 22:33:25 +0400
commita4ff37e912ee50d2ccee7fa50a361f9990ac78b4 (patch)
tree2b8d22ae3fa0317b3276736bb80de48e34e382fa
parent666b9663f94c2a4f39d331b28fabd09f2dc43bf2 (diff)
downloadmariadb-git-a4ff37e912ee50d2ccee7fa50a361f9990ac78b4.tar.gz
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.
-rw-r--r--mysql-test/r/events_bugs.result10
-rw-r--r--mysql-test/suite/plugins/r/sql_error_log.result10
-rw-r--r--mysql-test/suite/plugins/t/sql_error_log.test18
-rw-r--r--mysql-test/t/events_bugs.test10
-rw-r--r--sql/sql_yacc.yy2
5 files changed, 39 insertions, 11 deletions
diff --git a/mysql-test/r/events_bugs.result b/mysql-test/r/events_bugs.result
index e3599218aac..f1ff0faaa47 100644
--- a/mysql-test/r/events_bugs.result
+++ b/mysql-test/r/events_bugs.result
@@ -90,7 +90,7 @@ create table events_smode_test(ev_name char(10), a date);
"This should never insert something"
create event ee_16407_2 on schedule every 60 second do
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');
insert into events_test.events_smode_test values('ee_16407_2','1980-19-02');
end|
@@ -99,7 +99,7 @@ ERROR 22007: Incorrect date value: '1980-19-02' for column 'a' at row 1
"This is ok"
create event ee_16407_3 on schedule every 60 second do
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');
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');
@@ -108,7 +108,7 @@ set sql_mode=""|
"This will insert rows but they will be truncated"
create event ee_16407_4 on schedule every 60 second do
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');
insert into events_test.events_smode_test values ('ee_16407_4','10-11-1956');
end|
@@ -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 event ee_16407_5 on schedule every 60 second do
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');
call events_test.ee_16407_5_pendant();
end|
create event ee_16407_6 on schedule every 60 second do
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');
call events_test.ee_16407_6_pendant();
end|
diff --git a/mysql-test/suite/plugins/r/sql_error_log.result b/mysql-test/suite/plugins/r/sql_error_log.result
index 3086b1f2d1f..a583cf91a83 100644
--- a/mysql-test/suite/plugins/r/sql_error_log.result
+++ b/mysql-test/suite/plugins/r/sql_error_log.result
@@ -35,6 +35,15 @@ SET SQL_MODE = '';
drop table t1;
SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'not_exists' AND TABLE_NAME = 'not_exists';
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;
Warnings:
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
MYSQL_ERRNO = 1000,
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 1146: Table 'test.non_exists' doesn't exist : INSERT INTO test.non_exists VALUES (0,0,0) /* e1 */
diff --git a/mysql-test/suite/plugins/t/sql_error_log.test b/mysql-test/suite/plugins/t/sql_error_log.test
index a28e2d2e259..6c83e9655ce 100644
--- a/mysql-test/suite/plugins/t/sql_error_log.test
+++ b/mysql-test/suite/plugins/t/sql_error_log.test
@@ -48,6 +48,24 @@ drop table t1;
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;
let $MYSQLD_DATADIR= `SELECT @@datadir`;
diff --git a/mysql-test/t/events_bugs.test b/mysql-test/t/events_bugs.test
index dc31556998a..5b5123ad295 100644
--- a/mysql-test/t/events_bugs.test
+++ b/mysql-test/t/events_bugs.test
@@ -305,7 +305,7 @@ create table events_smode_test(ev_name char(10), a date);
delimiter |;
create event ee_16407_2 on schedule every 60 second do
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');
insert into events_test.events_smode_test values('ee_16407_2','1980-19-02');
end|
@@ -314,7 +314,7 @@ insert into events_test.events_smode_test values ('test','1980-19-02')|
--echo "This is ok"
create event ee_16407_3 on schedule every 60 second do
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');
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');
@@ -323,7 +323,7 @@ set sql_mode=""|
--echo "This will insert rows but they will be truncated"
create event ee_16407_4 on schedule every 60 second do
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');
insert into events_test.events_smode_test values ('ee_16407_4','10-11-1956');
end|
@@ -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 event ee_16407_5 on schedule every 60 second do
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');
call events_test.ee_16407_5_pendant();
end|
create event ee_16407_6 on schedule every 60 second do
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');
call events_test.ee_16407_6_pendant();
end|
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 8e849d76070..d5a73abc5c6 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -3696,7 +3696,7 @@ sp_proc_stmt_statement:
if (yychar == YYEMPTY)
i->m_query.length= lip->get_ptr() - sp->m_tmp_query;
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,
sp->m_tmp_query,
i->m_query.length)) ||