Commit e42120c6 authored by unknown's avatar unknown

Fixed bug #643, which caused intermittent crashes in net_printf() with repeated

syntax errors in stored procedures.


mysql-test/r/sp-error.result:
  New test case for bugfix (#643)
mysql-test/t/sp-error.test:
  New test case for bugfix (#643)
sql/sp_head.cc:
  Forgot to copy a slot from the original lex. (bug #643)
parent 40f41ee1
delete from mysql.proc; delete from mysql.proc;
create procedure syntaxerror(t int);
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
create procedure syntaxerror(t int);
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
create procedure syntaxerror(t int);
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
create procedure proc1() create procedure proc1()
set @x = 42; set @x = 42;
create function func1() returns int create function func1() returns int
......
...@@ -7,6 +7,16 @@ delete from mysql.proc; ...@@ -7,6 +7,16 @@ delete from mysql.proc;
delimiter |; delimiter |;
# This should give three syntax errors (sometimes crashed; bug #643)
# (Unfortunately, this is not a 100% test, on some platforms this
# passed despite the bug.)
--error 1064
create procedure syntaxerror(t int)|
--error 1064
create procedure syntaxerror(t int)|
--error 1064
create procedure syntaxerror(t int)|
# Check that we get the right error, i.e. UDF declaration parses correctly, # Check that we get the right error, i.e. UDF declaration parses correctly,
# but foo.so doesn't exist. # but foo.so doesn't exist.
# QQ This generates an error message containing a misleading errno which # QQ This generates an error message containing a misleading errno which
......
...@@ -376,6 +376,7 @@ sp_head::reset_lex(THD *thd) ...@@ -376,6 +376,7 @@ sp_head::reset_lex(THD *thd)
/* We must reset ptr and end_of_query again */ /* We must reset ptr and end_of_query again */
sublex->ptr= m_lex->ptr; sublex->ptr= m_lex->ptr;
sublex->end_of_query= m_lex->end_of_query; sublex->end_of_query= m_lex->end_of_query;
sublex->tok_start= m_lex->tok_start;
/* And keep the SP stuff too */ /* And keep the SP stuff too */
sublex->sphead= m_lex->sphead; sublex->sphead= m_lex->sphead;
sublex->spcont= m_lex->spcont; sublex->spcont= m_lex->spcont;
......
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