Loading sql/sql_insert.cc +2 −1 Original line number Diff line number Diff line Loading @@ -3006,7 +3006,8 @@ bool select_insert::send_eof() ((thd->client_capabilities & CLIENT_FOUND_ROWS) ? info.touched : info.updated); id= autoinc_value_of_first_inserted_row > 0 ? autoinc_value_of_first_inserted_row : thd->last_insert_id; autoinc_value_of_first_inserted_row : thd->insert_id_used ? thd->last_insert_id : 0; ::send_ok(thd, (ulong) thd->row_count_func, id, buff); DBUG_RETURN(0); } Loading tests/mysql_client_test.c +16 −0 Original line number Diff line number Diff line Loading @@ -15241,6 +15241,22 @@ static void test_mysql_insert_id() myquery(rc); res= mysql_insert_id(mysql); DIE_UNLESS(res == 0); /* Test for bug #34889: mysql_client_test::test_mysql_insert_id test fails sporadically */ rc= mysql_query(mysql, "create table t2 (f1 int not null primary key auto_increment, f2 varchar(255))"); myquery(rc); rc= mysql_query(mysql, "insert into t2 values (null,'b')"); myquery(rc); rc= mysql_query(mysql, "insert into t1 select 5,'c'"); myquery(rc); res= mysql_insert_id(mysql); DIE_UNLESS(res == 0); rc= mysql_query(mysql, "drop table t2"); myquery(rc); rc= mysql_query(mysql, "insert into t1 select null,'d'"); myquery(rc); res= mysql_insert_id(mysql); Loading Loading
sql/sql_insert.cc +2 −1 Original line number Diff line number Diff line Loading @@ -3006,7 +3006,8 @@ bool select_insert::send_eof() ((thd->client_capabilities & CLIENT_FOUND_ROWS) ? info.touched : info.updated); id= autoinc_value_of_first_inserted_row > 0 ? autoinc_value_of_first_inserted_row : thd->last_insert_id; autoinc_value_of_first_inserted_row : thd->insert_id_used ? thd->last_insert_id : 0; ::send_ok(thd, (ulong) thd->row_count_func, id, buff); DBUG_RETURN(0); } Loading
tests/mysql_client_test.c +16 −0 Original line number Diff line number Diff line Loading @@ -15241,6 +15241,22 @@ static void test_mysql_insert_id() myquery(rc); res= mysql_insert_id(mysql); DIE_UNLESS(res == 0); /* Test for bug #34889: mysql_client_test::test_mysql_insert_id test fails sporadically */ rc= mysql_query(mysql, "create table t2 (f1 int not null primary key auto_increment, f2 varchar(255))"); myquery(rc); rc= mysql_query(mysql, "insert into t2 values (null,'b')"); myquery(rc); rc= mysql_query(mysql, "insert into t1 select 5,'c'"); myquery(rc); res= mysql_insert_id(mysql); DIE_UNLESS(res == 0); rc= mysql_query(mysql, "drop table t2"); myquery(rc); rc= mysql_query(mysql, "insert into t1 select null,'d'"); myquery(rc); res= mysql_insert_id(mysql); Loading