From 5a6161dea42f73a241dd7068eb6b6b5a2562b74d Mon Sep 17 00:00:00 2001 From: "holyfoot/hf@mysql.com/hfmain.(none)" <> Date: Fri, 30 Nov 2007 19:16:13 +0400 Subject: 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 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'libmysqld') 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; -- cgit v1.2.1