summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorunknown <kroki/tomash@moonlight.intranet>2006-10-02 15:01:19 +0400
committerunknown <kroki/tomash@moonlight.intranet>2006-10-02 15:01:19 +0400
commit43ed743350afd799d04b76ac26582e765f4cbbca (patch)
tree0e2fdcdcda49fec88475e692d7b790d452c2f103 /tests
parent6a698c3b3aec6c88cc4083a2b24ee64f6dc8f794 (diff)
parentbe929087ec9a5b4e161591fcebab9687472779eb (diff)
downloadmariadb-git-43ed743350afd799d04b76ac26582e765f4cbbca.tar.gz
Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-real-bug21726
into moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.1-real-bug21726 mysql-test/t/rpl_insert_id.test: Use local. sql/item_func.cc: Use local. sql/item_func.h: Use local. sql/log_event.cc: SCCS merged sql/set_var.cc: Use local. sql/sql_class.h: Use local. sql/sql_insert.cc: Use local. sql/sql_load.cc: Use local. sql/sql_parse.cc: Use local. sql/sql_select.cc: Use local. sql/sql_update.cc: Use local. mysql-test/r/rpl_insert_id.result: Use local. sql/sql_class.cc: Manual merge. Add comment for THD::cleanup_after_query(). tests/mysql_client_test.c: Manual merge. Add test case for bug#21726: Incorrect result with multiple invocations of LAST_INSERT_ID.
Diffstat (limited to 'tests')
-rw-r--r--tests/mysql_client_test.c42
1 files changed, 40 insertions, 2 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index cd9ac675c25..148295398f4 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -15438,6 +15438,43 @@ static void test_bug21206()
DBUG_VOID_RETURN;
}
+/*
+ Bug#21726: Incorrect result with multiple invocations of
+ LAST_INSERT_ID
+
+ Test that client gets updated value of insert_id on UPDATE that uses
+ LAST_INSERT_ID(expr).
+*/
+static void test_bug21726()
+{
+ const char *create_table[]=
+ {
+ "DROP TABLE IF EXISTS t1",
+ "CREATE TABLE t1 (i INT)",
+ "INSERT INTO t1 VALUES (1)",
+ };
+ const char *update_query= "UPDATE t1 SET i= LAST_INSERT_ID(i + 1)";
+ int rc;
+ my_ulonglong insert_id;
+
+ DBUG_ENTER("test_bug21726");
+ myheader("test_bug21726");
+
+ fill_tables(create_table, sizeof(create_table) / sizeof(*create_table));
+
+ rc= mysql_query(mysql, update_query);
+ myquery(rc);
+ insert_id= mysql_insert_id(mysql);
+ DIE_UNLESS(insert_id == 2);
+
+ rc= mysql_query(mysql, update_query);
+ myquery(rc);
+ insert_id= mysql_insert_id(mysql);
+ DIE_UNLESS(insert_id == 3);
+
+ DBUG_VOID_RETURN;
+}
+
/*
Read and parse arguments and MySQL options from my.cnf
@@ -15713,8 +15750,9 @@ static struct my_tests_st my_tests[]= {
{ "test_bug17667", test_bug17667 },
{ "test_bug15752", test_bug15752 },
{ "test_mysql_insert_id", test_mysql_insert_id },
- { "test_bug19671", test_bug19671},
- { "test_bug21206", test_bug21206},
+ { "test_bug19671", test_bug19671 },
+ { "test_bug21206", test_bug21206 },
+ { "test_bug21726", test_bug21726 },
{ 0, 0 }
};