Bug #2291 mysql_stmt_affected_rows() does not return statement-local variable
Submitted: 5 Jan 2004 13:41 Modified: 5 Jan 2004 16:43
Reporter: Konstantin Osipov (OCA) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1, 5.0 OS:Any (all)
Assigned to: Assigned Account CPU Architecture:Any

[5 Jan 2004 13:41] Konstantin Osipov
Description:
Implementation of mysql_stmt_affected_rows() is the following:
/*  
  Return total affected rows from the last statement
*/
  
my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt)
{ 
  return stmt->mysql->last_used_con->affected_rows;
}
  

We should return statement-local variable here, otherwise that call is nothing but usual mysql_affected_rows

How to repeat:
-

Suggested fix:
Add statement-local variable affected_rows and copy it from mysql->last_used_conn->affected_rows in execute() function of  libmysql.c
[5 Jan 2004 16:43] Konstantin Osipov
See bug #2247