diff options
-rw-r--r-- | mysql-test/r/sp-error.result | 4 | ||||
-rw-r--r-- | mysql-test/t/sp-error.test | 98 | ||||
-rw-r--r-- | mysql-test/t/sp-security.test | 4 | ||||
-rw-r--r-- | sql/opt_range.h | 2 | ||||
-rw-r--r-- | sql/sp.cc | 3 | ||||
-rw-r--r-- | sql/sp_head.cc | 7 | ||||
-rw-r--r-- | sql/sql_lex.cc | 4 | ||||
-rw-r--r-- | sql/sql_view.cc | 3 |
8 files changed, 62 insertions, 63 deletions
diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index 2b6f0826326..c34a27cc8f7 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -44,7 +44,7 @@ call foo()| ERROR 42000: PROCEDURE test.foo does not exist drop procedure if exists foo| Warnings: -Warning 1303 PROCEDURE foo does not exist +Warning 1304 PROCEDURE foo does not exist show create procedure foo| ERROR 42000: PROCEDURE foo does not exist create procedure foo() @@ -80,7 +80,7 @@ declare y int; set x = y; end| Warnings: -Warning 1309 Referring to uninitialized variable y +Warning 1310 Referring to uninitialized variable y drop procedure foo| create procedure foo() return 42| diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index 3ca3a4ea677..e1a3a610c9c 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -49,18 +49,18 @@ create function func1() returns int return 42| # Can't create recursively ---error 1301 +--error 1302 create procedure foo() create procedure bar() set @x=3| ---error 1301 +--error 1302 create procedure foo() create function bar() returns double return 2.3| # Already exists ---error 1302 +--error 1303 create procedure proc1() set @x = 42| ---error 1302 +--error 1303 create function func1() returns int return 42| @@ -68,39 +68,39 @@ drop procedure proc1| drop function func1| # Does not exist ---error 1303 +--error 1304 alter procedure foo| ---error 1303 +--error 1304 alter function foo| ---error 1303 +--error 1304 drop procedure foo| ---error 1303 +--error 1304 drop function foo| ---error 1303 +--error 1304 call foo()| drop procedure if exists foo| ---error 1303 +--error 1304 show create procedure foo| # LEAVE/ITERATE with no match ---error 1306 +--error 1307 create procedure foo() foo: loop leave bar; end loop| ---error 1306 +--error 1307 create procedure foo() foo: loop iterate bar; end loop| ---error 1306 +--error 1307 create procedure foo() foo: begin iterate foo; end| # Redefining label ---error 1307 +--error 1308 create procedure foo() foo: loop foo: loop @@ -109,7 +109,7 @@ foo: loop end loop foo| # End label mismatch ---error 1308 +--error 1309 create procedure foo() foo: loop set @x=2; @@ -124,12 +124,12 @@ end| drop procedure foo| # RETURN in FUNCTION only ---error 1311 +--error 1312 create procedure foo() return 42| # Doesn't allow queries in FUNCTIONs (for now :-( ) ---error 1312 +--error 1313 create function foo() returns int begin declare x int; @@ -143,19 +143,19 @@ create procedure p(x int) create function f(x int) returns int return x+42| ---error 1316 +--error 1317 call p()| ---error 1316 +--error 1317 call p(1, 2)| ---error 1316 +--error 1317 select f()| ---error 1316 +--error 1317 select f(1, 2)| drop procedure p| drop function f| ---error 1317 +--error 1318 create procedure p(val int, out res int) begin declare x int default 0; @@ -169,7 +169,7 @@ begin end if; end| ---error 1317 +--error 1318 create procedure p(val int, out res int) begin declare x int default 0; @@ -184,7 +184,7 @@ begin end if; end| ---error 1318 +--error 1319 create function f(val int) returns int begin declare x int; @@ -202,12 +202,12 @@ begin end if; end| ---error 1319 +--error 1320 select f(10)| drop function f| ---error 1320 +--error 1321 create procedure p() begin declare c cursor for insert into test.t1 values ("foo", 42); @@ -216,7 +216,7 @@ begin close c; end| ---error 1321 +--error 1322 create procedure p() begin declare x int; @@ -226,7 +226,7 @@ begin close c; end| ---error 1322 +--error 1323 create procedure p() begin declare c cursor for select * from test.t; @@ -248,7 +248,7 @@ begin open c; close c; end| ---error 1323 +--error 1324 call p()| drop procedure p| @@ -260,11 +260,11 @@ begin close c; close c; end| ---error 1324 +--error 1325 call p()| drop procedure p| ---error 1303 +--error 1304 alter procedure bar3 sql security invoker| --error 1059 alter procedure bar3 name @@ -278,7 +278,7 @@ drop table if exists t1| create table t1 (val int, x float)| insert into t1 values (42, 3.1), (19, 1.2)| ---error 1325 +--error 1326 create procedure p() begin declare x int; @@ -298,7 +298,7 @@ begin fetch c into x; close c; end| ---error 1326 +--error 1327 call p()| drop procedure p| @@ -313,34 +313,34 @@ begin fetch c into x, y, z; close c; end| ---error 1326 +--error 1327 call p()| drop procedure p| ---error 1328 +--error 1329 create procedure p(in x int, x char(10)) begin end| ---error 1328 +--error 1329 create function p(x int, x char(10)) begin end| ---error 1329 +--error 1330 create procedure p() begin declare x float; declare x int; end| ---error 1330 +--error 1331 create procedure p() begin declare c condition for 1064; declare c condition for 1065; end| ---error 1331 +--error 1332 create procedure p() begin declare c cursor for select * from t1; @@ -348,18 +348,18 @@ begin end| # USE is not allowed ---error 1334 +--error 1335 create procedure u() use sptmp| # Enforced standard order of declarations ---error 1335 +--error 1336 create procedure p() begin declare c cursor for select * from t1; declare x int; end| ---error 1335 +--error 1336 create procedure p() begin declare x int; @@ -367,7 +367,7 @@ begin declare foo condition for sqlstate '42S99'; end| ---error 1336 +--error 1337 create procedure p() begin declare x int; @@ -392,13 +392,13 @@ drop procedure bug1965| # # BUG#1966 # ---error 1325 +--error 1326 select 1 into a| # # BUG#336 # ---error 1333 +--error 1334 create procedure bug336(id char(16)) begin declare x int; @@ -408,7 +408,7 @@ end| # # BUG#1654 # ---error 1312 +--error 1313 create function bug1654() returns int return (select sum(t.data) from test.t2 t)| @@ -446,7 +446,7 @@ begin fetch c1 into v1; end| ---error 1324 +--error 1325 call bug2259()| drop procedure bug2259| @@ -502,7 +502,7 @@ begin end case; return 2; end| ---error 1337 +--error 1338 select bug3287()| drop function bug3287| @@ -513,7 +513,7 @@ when 0 then when 1 then insert into test.t1 values (x, 1.1); end case| ---error 1337 +--error 1338 call bug3287(2)| drop procedure bug3287| diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test index b7d183e64c5..d1c9c6c639d 100644 --- a/mysql-test/t/sp-security.test +++ b/mysql-test/t/sp-security.test @@ -60,7 +60,7 @@ select * from db1_secret.t1; # ...and not this --error 1049 create procedure db1_secret.dummy() begin end; ---error 1303 +--error 1304 drop procedure db1_secret.dummy; @@ -80,7 +80,7 @@ select * from db1_secret.t1; # ...and not this --error 1049 create procedure db1_secret.dummy() begin end; ---error 1303 +--error 1304 drop procedure db1_secret.dummy; diff --git a/sql/opt_range.h b/sql/opt_range.h index 90fae043f26..8826705c9a7 100644 --- a/sql/opt_range.h +++ b/sql/opt_range.h @@ -146,7 +146,7 @@ public: QS_TYPE_RANGE_DESC = 2, QS_TYPE_FULLTEXT = 3, QS_TYPE_ROR_INTERSECT = 4, - QS_TYPE_ROR_UNION = 5, + QS_TYPE_ROR_UNION = 5 }; /* Get type of this quick select - one of the QS_TYPE_* values */ diff --git a/sql/sp.cc b/sql/sp.cc index 408d676aebe..4164a27ca5f 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -265,8 +265,7 @@ db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp) */ List<Item> vals= thd->lex->value_list; - mysql_init_query(thd, TRUE); - lex_start(thd, (uchar*)defstr.c_ptr(), defstr.length()); + mysql_init_query(thd, (uchar*)defstr.c_ptr(), defstr.length(), TRUE); thd->lex->value_list= vals; } diff --git a/sql/sp_head.cc b/sql/sp_head.cc index bf2aff8de51..e32aa391b1d 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -690,17 +690,18 @@ sp_head::reset_lex(THD *thd) (void)m_lex.push_front(oldlex); thd->lex= sublex= new st_lex; + /* Reset most stuff. The length arguments doesn't matter here. */ - lex_start(thd, oldlex->buf, oldlex->end_of_query - oldlex->ptr); - sublex->yylineno= oldlex->yylineno; + mysql_init_query(thd,oldlex->buf, oldlex->end_of_query - oldlex->ptr, TRUE); + /* We must reset ptr and end_of_query again */ sublex->ptr= oldlex->ptr; sublex->end_of_query= oldlex->end_of_query; sublex->tok_start= oldlex->tok_start; + sublex->yylineno= oldlex->yylineno; /* And keep the SP stuff too */ sublex->sphead= oldlex->sphead; sublex->spcont= oldlex->spcont; - mysql_init_query(thd, true); // Only init lex sublex->sp_lex_in_use= FALSE; DBUG_VOID_RETURN; } diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 23391f6237f..aa1c44b8e73 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -111,8 +111,8 @@ void lex_start(THD *thd, uchar *buf,uint length) LEX *lex= thd->lex; lex->thd= thd; lex->next_state=MY_LEX_START; - lex->buf= buf; - lex->end_of_query=(lex->ptr=buf)+length; + lex->buf= lex->ptr= buf; + lex->end_of_query=buf+length; lex->yylineno = 1; lex->in_comment=0; lex->length=0; diff --git a/sql/sql_view.cc b/sql/sql_view.cc index ed42c684803..eebf5a20795 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -563,8 +563,7 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table) now Lex placed in statement memory */ table->view= lex= thd->lex= (LEX*) new(&thd->mem_root) st_lex_local; - lex_start(thd, (uchar*)table->query.str, table->query.length); - mysql_init_query(thd, true); + mysql_init_query(thd, (uchar*)table->query.str, table->query.length, TRUE); lex->select_lex.select_number= ++thd->select_number; old_lex->derived_tables|= DERIVED_VIEW; { |