Commit b4c9c778 authored by eric@mysql.com's avatar eric@mysql.com

Merge eherman@bk-internal.mysql.com:/home/bk/mysql-5.0

into  mysql.com:/home/eric/mysql-5.0-fed-err
parents 92e2936f f3030c34
...@@ -1072,6 +1072,188 @@ Database (mysqltest3) ...@@ -1072,6 +1072,188 @@ Database (mysqltest3)
mysqltest3 mysqltest3
-------- switch to master ------- -------- switch to master -------
######## CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1" ########
-------- switch to master -------
INSERT INTO t1 SET f1= 15 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
16
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
15
-------- switch to master -------
CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1";
SELECT MAX(f1) FROM t1;
MAX(f1)
16
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
16
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
16
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
16
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SHOW PROCEDURE STATUS LIKE 'p1';
Db mysqltest1
Name p1
Type PROCEDURE
Definer root@localhost
Modified #
Created #
Security_type DEFINER
Comment
-------- switch to slave -------
SHOW PROCEDURE STATUS LIKE 'p1';
Db mysqltest1
Name p1
Type PROCEDURE
Definer @
Modified #
Created #
Security_type DEFINER
Comment
######## ALTER PROCEDURE p1 COMMENT "I have been altered" ########
-------- switch to master -------
INSERT INTO t1 SET f1= 16 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
17
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
16
-------- switch to master -------
ALTER PROCEDURE p1 COMMENT "I have been altered";
SELECT MAX(f1) FROM t1;
MAX(f1)
17
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
17
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
17
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
17
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SHOW PROCEDURE STATUS LIKE 'p1';
Db mysqltest1
Name p1
Type PROCEDURE
Definer root@localhost
Modified #
Created #
Security_type DEFINER
Comment I have been altered
-------- switch to slave -------
SHOW PROCEDURE STATUS LIKE 'p1';
Db mysqltest1
Name p1
Type PROCEDURE
Definer @
Modified #
Created #
Security_type DEFINER
Comment I have been altered
######## DROP PROCEDURE p1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 17 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
18
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
17
-------- switch to master -------
DROP PROCEDURE p1;
SELECT MAX(f1) FROM t1;
MAX(f1)
18
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
18
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
18
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
18
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SHOW PROCEDURE STATUS LIKE 'p1';
-------- switch to slave -------
SHOW PROCEDURE STATUS LIKE 'p1';
DROP DATABASE IF EXISTS mysqltest1; DROP DATABASE IF EXISTS mysqltest1;
DROP DATABASE IF EXISTS mysqltest2; DROP DATABASE IF EXISTS mysqltest2;
DROP DATABASE IF EXISTS mysqltest3; DROP DATABASE IF EXISTS mysqltest3;
...@@ -2210,15 +2210,15 @@ INSERT INTO t1 VALUES ('2005-09-06'); ...@@ -2210,15 +2210,15 @@ INSERT INTO t1 VALUES ('2005-09-06');
CREATE VIEW v1 AS SELECT DAYNAME(date) FROM t1; CREATE VIEW v1 AS SELECT DAYNAME(date) FROM t1;
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View View Create View
v1 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select dayname(`t1`.`date`) AS `DAYNAME(date)` from `t1` v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select dayname(`t1`.`date`) AS `DAYNAME(date)` from `t1`
CREATE VIEW v2 AS SELECT DAYOFWEEK(date) FROM t1; CREATE VIEW v2 AS SELECT DAYOFWEEK(date) FROM t1;
SHOW CREATE VIEW v2; SHOW CREATE VIEW v2;
View Create View View Create View
v2 CREATE ALGORITHM=UNDEFINED VIEW `v2` AS select dayofweek(`t1`.`date`) AS `DAYOFWEEK(date)` from `t1` v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select dayofweek(`t1`.`date`) AS `DAYOFWEEK(date)` from `t1`
CREATE VIEW v3 AS SELECT WEEKDAY(date) FROM t1; CREATE VIEW v3 AS SELECT WEEKDAY(date) FROM t1;
SHOW CREATE VIEW v3; SHOW CREATE VIEW v3;
View Create View View Create View
v3 CREATE ALGORITHM=UNDEFINED VIEW `v3` AS select weekday(`t1`.`date`) AS `WEEKDAY(date)` from `t1` v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select weekday(`t1`.`date`) AS `WEEKDAY(date)` from `t1`
SELECT DAYNAME('2005-09-06'); SELECT DAYNAME('2005-09-06');
DAYNAME('2005-09-06') DAYNAME('2005-09-06')
Tuesday Tuesday
......
...@@ -340,6 +340,57 @@ connection master; ...@@ -340,6 +340,57 @@ connection master;
SELECT '-------- switch to master -------' as ""; SELECT '-------- switch to master -------' as "";
--enable_query_log --enable_query_log
# End of 4.1 tests
###############################################################
# Cases with stored procedures
###############################################################
let $my_stmt= CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1";
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
--vertical_results
--replace_column 5 # 6 #
SHOW PROCEDURE STATUS LIKE 'p1';
--disable_query_log
SELECT '-------- switch to slave -------' as "";
--enable_query_log
connection slave;
--replace_column 5 # 6 #
SHOW PROCEDURE STATUS LIKE 'p1';
connection master;
--horizontal_results
let $my_stmt= ALTER PROCEDURE p1 COMMENT "I have been altered";
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
--vertical_results
--replace_column 5 # 6 #
SHOW PROCEDURE STATUS LIKE 'p1';
--disable_query_log
SELECT '-------- switch to slave -------' as "";
--enable_query_log
connection slave;
--replace_column 5 # 6 #
SHOW PROCEDURE STATUS LIKE 'p1';
connection master;
--horizontal_results
let $my_stmt= DROP PROCEDURE p1;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
--vertical_results
SHOW PROCEDURE STATUS LIKE 'p1';
--disable_query_log
SELECT '-------- switch to slave -------' as "";
--enable_query_log
connection slave;
SHOW PROCEDURE STATUS LIKE 'p1';
connection master;
--horizontal_results
############################################################### ###############################################################
# Cleanup # Cleanup
############################################################### ###############################################################
...@@ -349,4 +400,4 @@ DROP DATABASE IF EXISTS mysqltest2; ...@@ -349,4 +400,4 @@ DROP DATABASE IF EXISTS mysqltest2;
DROP DATABASE IF EXISTS mysqltest3; DROP DATABASE IF EXISTS mysqltest3;
--enable_warnings --enable_warnings
# End of 4.1 tests
...@@ -4029,6 +4029,9 @@ mysql_execute_command(THD *thd) ...@@ -4029,6 +4029,9 @@ mysql_execute_command(THD *thd)
goto error; goto error;
} }
if (end_active_trans(thd))
goto error;
if (!lex->sphead->m_db.str || !lex->sphead->m_db.str[0]) if (!lex->sphead->m_db.str || !lex->sphead->m_db.str[0])
{ {
lex->sphead->m_db.length= strlen(thd->db); lex->sphead->m_db.length= strlen(thd->db);
...@@ -4283,6 +4286,9 @@ mysql_execute_command(THD *thd) ...@@ -4283,6 +4286,9 @@ mysql_execute_command(THD *thd)
sp->m_name.str, sp->m_name.str,
lex->sql_command == SQLCOM_ALTER_PROCEDURE, 0)) lex->sql_command == SQLCOM_ALTER_PROCEDURE, 0))
goto error; goto error;
if (end_active_trans(thd))
goto error;
memcpy(&lex->sp_chistics, &chistics, sizeof(lex->sp_chistics)); memcpy(&lex->sp_chistics, &chistics, sizeof(lex->sp_chistics));
if (!trust_routine_creators && mysql_bin_log.is_open() && if (!trust_routine_creators && mysql_bin_log.is_open() &&
!sp->m_chistics->detistic && !sp->m_chistics->detistic &&
...@@ -4342,6 +4348,9 @@ mysql_execute_command(THD *thd) ...@@ -4342,6 +4348,9 @@ mysql_execute_command(THD *thd)
if (check_routine_access(thd, ALTER_PROC_ACL, db, name, if (check_routine_access(thd, ALTER_PROC_ACL, db, name,
lex->sql_command == SQLCOM_DROP_PROCEDURE, 0)) lex->sql_command == SQLCOM_DROP_PROCEDURE, 0))
goto error; goto error;
if (end_active_trans(thd))
goto error;
#ifndef NO_EMBEDDED_ACCESS_CHECKS #ifndef NO_EMBEDDED_ACCESS_CHECKS
if (sp_automatic_privileges && !opt_noacl && if (sp_automatic_privileges && !opt_noacl &&
sp_revoke_privileges(thd, db, name, sp_revoke_privileges(thd, db, name,
......
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