mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
WL#1366: Use the schema (db) associated with an SP.
Phase 4 (final): Remove associated stored procedures when a database is dropped. mysql-test/r/sp-security.result: drop database now deletes associated SPs. mysql-test/r/sp.result: drop database now deletes associated SPs. mysql-test/t/sp-security.test: drop database now deletes associated SPs. mysql-test/t/sp.test: drop database now deletes associated SPs. sql/sp.cc: New function for deleting all SPs associated with a database. sql/sp.h: New function for deleting all SPs associated with a database. sql/sp_cache.cc: New function for just invalidating all SP caches (when dropping a database). sql/sp_cache.h: New function for just invalidating all SP caches (when dropping a database). sql/sql_db.cc: When dropping a database, also delete all associated SPs.
This commit is contained in:
@ -97,11 +97,15 @@ s1
|
||||
0
|
||||
2
|
||||
2
|
||||
drop procedure db1_secret.stamp;
|
||||
drop function db1_secret.db;
|
||||
drop procedure db2.p;
|
||||
drop procedure db2.q;
|
||||
use test;
|
||||
select type,db,name from mysql.proc;
|
||||
type db name
|
||||
FUNCTION db1_secret db
|
||||
PROCEDURE db1_secret stamp
|
||||
PROCEDURE db2 p
|
||||
PROCEDURE db2 q
|
||||
drop database db1_secret;
|
||||
drop database db2;
|
||||
select type,db,name from mysql.proc;
|
||||
type db name
|
||||
delete from mysql.user where user='user1' or user='user2';
|
||||
|
@ -786,6 +786,22 @@ select @c1, @c2|
|
||||
12 3
|
||||
delete from t1|
|
||||
drop procedure modes|
|
||||
create database sp_db1|
|
||||
drop database sp_db1|
|
||||
create database sp_db2|
|
||||
use sp_db2|
|
||||
create table t3 ( s char(4), t int )|
|
||||
insert into t3 values ("abcd", 42), ("dcba", 666)|
|
||||
use test|
|
||||
drop database sp_db2|
|
||||
create database sp_db3|
|
||||
use sp_db3|
|
||||
create procedure dummy(out x int)
|
||||
set x = 42|
|
||||
use test|
|
||||
drop database sp_db3|
|
||||
select type,db,name from mysql.proc where db = 'sp_db3'|
|
||||
type db name
|
||||
create procedure bug822(a_id char(16), a_data int)
|
||||
begin
|
||||
declare n int;
|
||||
|
@ -163,11 +163,11 @@ select * from t2;
|
||||
|
||||
# Clean up
|
||||
connection con1root;
|
||||
drop procedure db1_secret.stamp;
|
||||
drop function db1_secret.db;
|
||||
drop procedure db2.p;
|
||||
drop procedure db2.q;
|
||||
use test;
|
||||
select type,db,name from mysql.proc;
|
||||
drop database db1_secret;
|
||||
drop database db2;
|
||||
# Make sure the routines are gone
|
||||
select type,db,name from mysql.proc;
|
||||
# Get rid of the users
|
||||
delete from mysql.user where user='user1' or user='user2';
|
||||
|
@ -905,6 +905,32 @@ delete from t1|
|
||||
drop procedure modes|
|
||||
|
||||
|
||||
# Check that dropping a database without routines works.
|
||||
# (Dropping with routines is tested in sp-security.test)
|
||||
# First an empty db.
|
||||
create database sp_db1|
|
||||
drop database sp_db1|
|
||||
|
||||
# Again, with a table.
|
||||
create database sp_db2|
|
||||
use sp_db2|
|
||||
# Just put something in here...
|
||||
create table t3 ( s char(4), t int )|
|
||||
insert into t3 values ("abcd", 42), ("dcba", 666)|
|
||||
use test|
|
||||
drop database sp_db2|
|
||||
|
||||
# And yet again, with just a procedure.
|
||||
create database sp_db3|
|
||||
use sp_db3|
|
||||
create procedure dummy(out x int)
|
||||
set x = 42|
|
||||
use test|
|
||||
drop database sp_db3|
|
||||
# Check that it's gone
|
||||
select type,db,name from mysql.proc where db = 'sp_db3'|
|
||||
|
||||
|
||||
#
|
||||
# Test cases for old bugs
|
||||
#
|
||||
|
Reference in New Issue
Block a user