Commit:    cde53e7fcd3f74cb29af4d3fb9fb09812ee1d4a0
Author:    Andrey Hristov <and...@php.net>         Mon, 7 Jan 2013 16:36:21 
+0100
Parents:   f4142a92b2ecfa0fdf89ec83bb41c2a46b299973
Branches:  PHP-5.5 master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=cde53e7fcd3f74cb29af4d3fb9fb09812ee1d4a0

Log:
fix different values of mysqli_stmt_affected_rows between libmysql
and mysqlnd (in favor of libmysql) before execute and after prepare()

Changed paths:
  M  NEWS
  M  ext/mysqli/tests/057.phpt
  M  ext/mysqlnd/mysqlnd_ps.c


Diff:
diff --git a/NEWS b/NEWS
index cfd2aa3..e79501f 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,10 @@ PHP                                                          
              NEWS
   . Bug #23955: allow specifying Max-Age attribute in setcookie() (narfbg, 
Lars)
   . Bug #52126: timestamp for mail.log (Martin Jansen, Lars)
 
+- mysqlnd
+  . Fixed return value of mysqli_stmt_affected_rows() in the time after
+    prepare() and before execute(). (Andrey)
+
 - cURL:
   . Added new functions curl_escape, curl_multi_setopt, curl_multi_strerror
     curl_pause, curl_reset, curl_share_close, curl_share_init, 
diff --git a/ext/mysqli/tests/057.phpt b/ext/mysqli/tests/057.phpt
index 2cb8875..7c7e2b7 100644
--- a/ext/mysqli/tests/057.phpt
+++ b/ext/mysqli/tests/057.phpt
@@ -35,8 +35,8 @@ require_once('skipifconnectfailure.inc');
        var_dump(mysqli_stmt_reset($stmt));
 
        var_dump($stmt = mysqli_prepare($link, "SELECT * FROM 
test_store_result"));
-       if ($IS_MYSQLND && $stmt->affected_rows !== -1)
-                       printf("[001] Expecting -1, got %d\n", 
$stmt->affected_rows);
+       if ($stmt->affected_rows !== 0)
+                       printf("[001] Expecting 0, got %d\n", 
$stmt->affected_rows);
 
        var_dump(mysqli_stmt_execute($stmt));
        var_dump($stmt = @mysqli_prepare($link, "SELECT * FROM 
test_store_result"), mysqli_error($link));
diff --git a/ext/mysqlnd/mysqlnd_ps.c b/ext/mysqlnd/mysqlnd_ps.c
index 134be5f..4916c06 100644
--- a/ext/mysqlnd/mysqlnd_ps.c
+++ b/ext/mysqlnd/mysqlnd_ps.c
@@ -307,6 +307,7 @@ mysqlnd_stmt_read_prepare_response(MYSQLND_STMT * s 
TSRMLS_DC)
        stmt->warning_count = stmt->conn->upsert_status->warning_count = 
prepare_resp->warning_count;
        stmt->field_count = stmt->conn->field_count = prepare_resp->field_count;
        stmt->param_count = prepare_resp->param_count;
+       stmt->upsert_status->affected_rows = 0; /* be like libmysql */
 done:
        PACKET_FREE(prepare_resp);


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to