summaryrefslogtreecommitdiff
path: root/tests/mysql_client_test.c
diff options
context:
space:
mode:
authorunknown <holyfoot/hf@mysql.com/hfmain.(none)>2007-11-30 19:16:13 +0400
committerunknown <holyfoot/hf@mysql.com/hfmain.(none)>2007-11-30 19:16:13 +0400
commit05fbb233d8e500da274dbd4bcffc134b23cfca13 (patch)
tree28d3e38d1d3b73e9352396555b28bd936c164013 /tests/mysql_client_test.c
parent63b65169534c97f0c225859d2d6d49f3cee2bc10 (diff)
downloadmariadb-git-05fbb233d8e500da274dbd4bcffc134b23cfca13.tar.gz
Bug #26921 Problem in mysql_insert_id() Embedded C API function.
client library only sets mysql->insert_id when query returned no recordset. So the embedded library should behave the same way libmysqld/lib_sql.cc: Bug #26921 Problem in mysql_insert_id() Embedded C API function. only set 'affected_rows' and 'insert_id' fields when query didn't return a recordset tests/mysql_client_test.c: Bug #26921 Problem in mysql_insert_id() Embedded C API function. testcase added
Diffstat (limited to 'tests/mysql_client_test.c')
-rw-r--r--tests/mysql_client_test.c11
1 files changed, 11 insertions, 0 deletions
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;
}