]> granicus.if.org Git - php/commitdiff
fix different values of mysqli_stmt_affected_rows between libmysql
authorAndrey Hristov <andrey@php.net>
Mon, 7 Jan 2013 15:36:21 +0000 (16:36 +0100)
committerAndrey Hristov <andrey@php.net>
Mon, 7 Jan 2013 15:36:21 +0000 (16:36 +0100)
and mysqlnd (in favor of libmysql) before execute and after prepare()

NEWS
ext/mysqli/tests/057.phpt
ext/mysqlnd/mysqlnd_ps.c

diff --git a/NEWS b/NEWS
index cfd2aa3dbc84f108c5db77bef326c3ad000eb2fa..e79501f679214655dcb39e379c3005476b8e9622 100644 (file)
--- 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, 
index 2cb887506aa4f91ef7a5b88497ff8ee3f3bec620..7c7e2b7568ee2954039f22102ca39eecd4b2e859 100644 (file)
@@ -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));
index 134be5fc53a766f566ee438cd3e4c3799a568646..4916c0650d7b759bccfdd5cd0dc70b8e1c4db0d1 100644 (file)
@@ -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);