From 0416b69da6da17747cc8571b5cd040b25aa81d16 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 3 Oct 2006 17:07:30 +0400 Subject: [PATCH] After merge fix. mysql-test/extra/rpl_tests/rpl_insert_id.test: Enhance test for bug#21726 to cover statement-based replication of function calls. sql/sql_class.cc: Fix typo and whitespace. --- mysql-test/extra/rpl_tests/rpl_insert_id.test | 17 +++++++++++++++++ sql/sql_class.cc | 4 +++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/mysql-test/extra/rpl_tests/rpl_insert_id.test b/mysql-test/extra/rpl_tests/rpl_insert_id.test index 6d38760a849..33194270d37 100644 --- a/mysql-test/extra/rpl_tests/rpl_insert_id.test +++ b/mysql-test/extra/rpl_tests/rpl_insert_id.test @@ -337,6 +337,7 @@ DROP TABLE t1, t2; DROP PROCEDURE IF EXISTS p1; DROP FUNCTION IF EXISTS f1; DROP FUNCTION IF EXISTS f2; +DROP FUNCTION IF EXISTS f3; DROP TABLE IF EXISTS t1, t2; --enable_warnings @@ -366,6 +367,12 @@ END | CREATE FUNCTION f2() RETURNS INT NOT DETERMINISTIC RETURN LAST_INSERT_ID() | + +CREATE FUNCTION f3() RETURNS INT MODIFIES SQL DATA +BEGIN + INSERT INTO t2 (i) VALUES (LAST_INSERT_ID()); + RETURN 0; +END | delimiter ;| INSERT INTO t1 VALUES (NULL, -1); @@ -380,6 +387,15 @@ INSERT INTO t1 VALUES (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID(5)), INSERT INTO t1 VALUES (NULL, 0), (NULL, LAST_INSERT_ID()); UPDATE t1 SET j= -1 WHERE i IS NULL; +# Test statement-based replication of function calls. +INSERT INTO t1 (i) VALUES (NULL); + +connection master1; +INSERT INTO t1 (i) VALUES (NULL); + +connection master; +SELECT f3(); + SELECT * FROM t1; SELECT * FROM t2; @@ -391,6 +407,7 @@ connection master; DROP PROCEDURE p1; DROP FUNCTION f1; DROP FUNCTION f2; +DROP FUNCTION f3; DROP TABLE t1, t2; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index f9b08bc82e1..3fd0e621422 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -637,7 +637,7 @@ bool THD::store_globals() THD::cleanup_after_query() DESCRIPTION - This function is used to reset thread data to it's default state. + This function is used to reset thread data to its default state. NOTE This function is not suitable for setting thread data to some @@ -645,6 +645,7 @@ bool THD::store_globals() different master threads may overwrite data of each other on slave. */ + void THD::cleanup_after_query() { if (!in_sub_stmt) /* stored functions and triggers are a special case */ @@ -668,6 +669,7 @@ void THD::cleanup_after_query() where= THD::DEFAULT_WHERE; } + /* Convert a string to another character set