mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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.
This commit is contained in:
@ -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 }
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user