summaryrefslogtreecommitdiff
path: root/libmysqld
diff options
context:
space:
mode:
authorkroki/tomash@moonlight.intranet <>2006-11-17 12:21:32 +0300
committerkroki/tomash@moonlight.intranet <>2006-11-17 12:21:32 +0300
commit5e2ef3a68eb6a2ff55c8798d7504b8f6af787bbb (patch)
tree592172c85c268458ccc191a7b7cfcc764879e8e8 /libmysqld
parentcddbb0f8173800fd8431be4df178bc042702b9eb (diff)
downloadmariadb-git-5e2ef3a68eb6a2ff55c8798d7504b8f6af787bbb.tar.gz
BUG#23383: mysql_affected_rows() returns different values than
mysql_stmt_affected_rows() The problem was that affected_rows for prepared statement wasn't updated in the client library on the error. The solution is to always update affected_rows, which will be equal to -1 on the error.
Diffstat (limited to 'libmysqld')
-rw-r--r--libmysqld/lib_sql.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index 1a3e10f08a8..93d47595010 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -224,20 +224,24 @@ static int emb_stmt_execute(MYSQL_STMT *stmt)
{
DBUG_ENTER("emb_stmt_execute");
char header[4];
+ my_bool res;
+
int4store(header, stmt->stmt_id);
THD *thd= (THD*)stmt->mysql->thd;
thd->client_param_count= stmt->param_count;
thd->client_params= stmt->params;
- if (emb_advanced_command(stmt->mysql, COM_EXECUTE,0,0,
- header, sizeof(header), 1, stmt) ||
- emb_mysql_read_query_result(stmt->mysql))
+
+ res= test(emb_advanced_command(stmt->mysql, COM_EXECUTE,0,0,
+ header, sizeof(header), 1, stmt) ||
+ emb_mysql_read_query_result(stmt->mysql));
+ stmt->affected_rows= stmt->mysql->affected_rows;
+ stmt->insert_id= stmt->mysql->insert_id;
+ if (res)
{
NET *net= &stmt->mysql->net;
set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate);
DBUG_RETURN(1);
}
- stmt->affected_rows= stmt->mysql->affected_rows;
- stmt->insert_id= stmt->mysql->insert_id;
DBUG_RETURN(0);
}