summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libmysqld/lib_sql.cc8
-rw-r--r--mysql-test/r/bdb_notembedded.result35
-rw-r--r--mysql-test/t/bdb_notembedded.test38
-rw-r--r--tests/mysql_client_test.c11
4 files changed, 16 insertions, 76 deletions
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index 7ac663480c8..6aee2fd6614 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -251,9 +251,11 @@ static my_bool emb_read_query_result(MYSQL *mysql)
mysql->warning_count= res->embedded_info->warning_count;
mysql->server_status= res->embedded_info->server_status;
mysql->field_count= res->fields;
- mysql->fields= res->embedded_info->fields_list;
- mysql->affected_rows= res->embedded_info->affected_rows;
- mysql->insert_id= res->embedded_info->insert_id;
+ if (!(mysql->fields= res->embedded_info->fields_list))
+ {
+ mysql->affected_rows= res->embedded_info->affected_rows;
+ mysql->insert_id= res->embedded_info->insert_id;
+ }
mysql->net.last_errno= 0;
mysql->net.last_error[0]= 0;
mysql->info= 0;
diff --git a/mysql-test/r/bdb_notembedded.result b/mysql-test/r/bdb_notembedded.result
deleted file mode 100644
index 14cb5fad915..00000000000
--- a/mysql-test/r/bdb_notembedded.result
+++ /dev/null
@@ -1,35 +0,0 @@
-set autocommit=1;
-reset master;
-create table bug16206 (a int);
-insert into bug16206 values(1);
-start transaction;
-insert into bug16206 values(2);
-commit;
-show binlog events;
-Log_name Pos Event_type Server_id End_log_pos Info
-f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4
-f n Query 1 n use `test`; create table bug16206 (a int)
-f n Query 1 n use `test`; insert into bug16206 values(1)
-f n Query 1 n use `test`; insert into bug16206 values(2)
-drop table bug16206;
-reset master;
-create table bug16206 (a int) engine= bdb;
-insert into bug16206 values(0);
-insert into bug16206 values(1);
-start transaction;
-insert into bug16206 values(2);
-commit;
-insert into bug16206 values(3);
-show binlog events;
-Log_name Pos Event_type Server_id End_log_pos Info
-f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4
-f n Query 1 n use `test`; create table bug16206 (a int) engine= bdb
-f n Query 1 n use `test`; insert into bug16206 values(0)
-f n Query 1 n use `test`; insert into bug16206 values(1)
-f n Query 1 n use `test`; BEGIN
-f n Query 1 n use `test`; insert into bug16206 values(2)
-f n Query 1 n use `test`; COMMIT
-f n Query 1 n use `test`; insert into bug16206 values(3)
-drop table bug16206;
-set autocommit=0;
-End of 5.0 tests
diff --git a/mysql-test/t/bdb_notembedded.test b/mysql-test/t/bdb_notembedded.test
deleted file mode 100644
index 24e64ebbfb2..00000000000
--- a/mysql-test/t/bdb_notembedded.test
+++ /dev/null
@@ -1,38 +0,0 @@
--- source include/not_embedded.inc
--- source include/have_bdb.inc
-
-#
-# Bug #16206: Superfluous COMMIT event in binlog when updating BDB in autocommit mode
-#
-set autocommit=1;
-
-let $VERSION=`select version()`;
-
-reset master;
-create table bug16206 (a int);
-insert into bug16206 values(1);
-start transaction;
-insert into bug16206 values(2);
-commit;
---replace_result $VERSION VERSION
---replace_column 1 f 2 n 5 n
-show binlog events;
-drop table bug16206;
-
-reset master;
-create table bug16206 (a int) engine= bdb;
-insert into bug16206 values(0);
-insert into bug16206 values(1);
-start transaction;
-insert into bug16206 values(2);
-commit;
-insert into bug16206 values(3);
---replace_result $VERSION VERSION
---replace_column 1 f 2 n 5 n
-show binlog events;
-drop table bug16206;
-
-set autocommit=0;
-
-
---echo End of 5.0 tests
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 29935a4924d..eb255e7881c 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -15358,6 +15358,8 @@ static void test_bug21206()
Test that client gets updated value of insert_id on UPDATE that uses
LAST_INSERT_ID(expr).
+ select_query added to test for bug
+ #26921 Problem in mysql_insert_id() Embedded C API function
*/
static void test_bug21726()
{
@@ -15370,6 +15372,8 @@ static void test_bug21726()
const char *update_query= "UPDATE t1 SET i= LAST_INSERT_ID(i + 1)";
int rc;
my_ulonglong insert_id;
+ const char *select_query= "SELECT * FROM t1";
+ MYSQL_RES *result;
DBUG_ENTER("test_bug21726");
myheader("test_bug21726");
@@ -15386,6 +15390,13 @@ static void test_bug21726()
insert_id= mysql_insert_id(mysql);
DIE_UNLESS(insert_id == 3);
+ rc= mysql_query(mysql, select_query);
+ myquery(rc);
+ insert_id= mysql_insert_id(mysql);
+ DIE_UNLESS(insert_id == 3);
+ result= mysql_store_result(mysql);
+ mysql_free_result(result);
+
DBUG_VOID_RETURN;
}