diff options
-rw-r--r-- | mysql-test/r/sp-error.result | 2 | ||||
-rw-r--r-- | mysql-test/r/sp.result | 12 | ||||
-rw-r--r-- | mysql-test/r/variables.result | 2 | ||||
-rw-r--r-- | mysql-test/t/sp-error.test | 34 | ||||
-rw-r--r-- | mysql-test/t/sp.test | 22 | ||||
-rw-r--r-- | sql/sp.cc | 13 | ||||
-rw-r--r-- | sql/sp_pcontext.cc | 9 |
7 files changed, 56 insertions, 38 deletions
diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index ad1510c27f6..3a15b748316 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -27,7 +27,7 @@ call foo(); PROCEDURE foo does not exist drop procedure if exists foo; Warnings: -Warning 1256 PROCEDURE foo does not exist +Warning 1257 PROCEDURE foo does not exist create procedure foo() foo: loop leave bar; diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 1ff6d1552f4..2c738c47deb 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -327,9 +327,17 @@ drop procedure into_dumpfile; create procedure create_select(x char(16), y int) begin insert into test.t1 values (x, y); -create table test.t2 select * from test.t1; -insert into test.t2 values (concat(x, "2"), y+2); +create table test.t3 select * from test.t1; +insert into test.t3 values (concat(x, "2"), y+2); end; +drop table if exists t3; +call create_select("cs", 90); +select * from t1, t3; +id data id data +cs 90 cs 90 +cs 90 cs2 92 +drop table if exists t3; +delete from t1; drop procedure create_select; create function e() returns double return 2.7182818284590452354; diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index fd9c00c9bca..ae4d90a05ab 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -298,7 +298,7 @@ set sql_log_bin=1; set sql_log_off=1; set sql_log_update=1; Warnings: -Note 1266 The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored. +Note 1267 The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored. set sql_low_priority_updates=1; set sql_max_join_size=200; select @@sql_max_join_size,@@max_join_size; diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index dd9becc631d..dd3bf916260 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -22,48 +22,48 @@ create function func1() returns int return 42| # Can't create recursively ---error 1254 +--error 1255 create procedure foo() create procedure bar() set @x=3| ---error 1254 +--error 1255 create procedure foo() create function bar() returns double return 2.3| # Already exists ---error 1255 +--error 1256 create procedure proc1() set @x = 42| ---error 1255 +--error 1256 create function func1() returns int return 42| # Does not exist ---error 1256 +--error 1257 alter procedure foo| ---error 1256 +--error 1257 alter function foo| ---error 1256 +--error 1257 drop procedure foo| ---error 1256 +--error 1257 drop function foo| ---error 1256 +--error 1257 call foo()| drop procedure if exists foo| # LEAVE/ITERATE with no match ---error 1259 +--error 1260 create procedure foo() foo: loop leave bar; end loop| ---error 1259 +--error 1260 create procedure foo() foo: loop iterate bar; end loop| # Redefining label ---error 1260 +--error 1261 create procedure foo() foo: loop foo: loop @@ -72,14 +72,14 @@ foo: loop end loop foo| # End label mismatch ---error 1261 +--error 1262 create procedure foo() foo: loop set @x=2; end loop bar| # Referring to undef variable ---error 1262 +--error 1263 create procedure foo(out x int) begin declare y int; @@ -87,17 +87,17 @@ begin end| # We require INTO in SELECTs (for now; this might change in the future) ---error 1263 +--error 1264 create procedure foo(x int) select * from test.t1| # RETURN in FUNCTION only ---error 1264 +--error 1265 create procedure foo() return 42| # Doesn't allow queries in FUNCTIONs (for now :-( ) ---error 1265 +--error 1266 create function foo() returns int begin declare x int; diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index a12e06f24b1..294b61514fa 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -390,18 +390,22 @@ drop procedure into_dumpfile| create procedure create_select(x char(16), y int) begin insert into test.t1 values (x, y); - create table test.t2 select * from test.t1; - insert into test.t2 values (concat(x, "2"), y+2); + create table test.t3 select * from test.t1; + insert into test.t3 values (concat(x, "2"), y+2); end| -# This doesn't work right now. It suffers from the same problem as the ones -# above, but the fix caused create.test to hang. :-( -#call create_select("cs", 90)| -#select * from t1, t2| -#delete from t1| -#drop table t2| +--disable_warnings +drop table if exists t3| +--enable_warnings +call create_select("cs", 90)| +select * from t1, t3| +--disable_warnings +drop table if exists t3| +--enable_warnings +delete from t1| drop procedure create_select| + # A minimal, constant FUNCTION. create function e() returns double return 2.7182818284590452354| @@ -574,7 +578,7 @@ begin end| # This isn't the fastest way in the world to compute prime numbers, so -# don't be too ambition. ;-) +# don't be too ambitious. ;-) call ip(200)| # We don't want to select the entire table here, just pick a few # examples. diff --git a/sql/sp.cc b/sql/sp.cc index 2d7e38b47bd..9e0d848b19d 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -306,7 +306,11 @@ sp_add_fun_to_lex(LEX *lex, LEX_STRING fun) while ((fn= li++)) { - if (my_strncasecmp(system_charset_info, fn, fun.str, fun.length) == 0) + uint len= strlen(fn); + + if (my_strnncoll(system_charset_info, + (const uchar *)fn, len, + (const uchar *)fun.str, fun.length) == 0) break; } if (! fn) @@ -389,7 +393,12 @@ sp_find_cached_function(THD *thd, char *name, uint namelen) while ((sp= li++)) { - if (my_strncasecmp(system_charset_info, name, sp->name(), namelen) == 0) + uint len; + const uchar *n= (const uchar *)sp->name(&len); + + if (my_strnncoll(system_charset_info, + (const uchar *)name, namelen, + n, len) == 0) break; } return sp; diff --git a/sql/sp_pcontext.cc b/sql/sp_pcontext.cc index 4d3cf80cd34..3973f05b74b 100644 --- a/sql/sp_pcontext.cc +++ b/sql/sp_pcontext.cc @@ -56,13 +56,10 @@ sp_pcontext::find_pvar(LEX_STRING *name) while (i-- > 0) { sp_pvar_t *p= find_pvar(i); - uint len= (p->name.length > name->length ? - p->name.length : name->length); - if (my_strncasecmp(system_charset_info, - name->str, - p->name.str, - len) == 0) + if (my_strnncoll(system_charset_info, + (const uchar *)name->str, name->length, + (const uchar *)p->name.str, p->name.length) == 0) { return p; } |