php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #61266
Patch unittest_pg_affected_rows_returns_0_after_select revision 2012-03-03 13:45 UTC by ben dot pineau at gmail dot com
Patch pg_affected_rows_returns_0_after_select.patch revision 2012-03-03 13:43 UTC by ben dot pineau at gmail dot com

Patch pg_affected_rows_returns_0_after_select.patch for Documentation problem Bug #61266

Patch version 2012-03-03 13:43 UTC

Return to Bug #61266 | Download this patch
Patch Revisions:

Developer: ben.pineau@gmail.com

--- ext/pgsql/pgsql.c-orig	2012-03-01 17:21:02.000000000 +0100
+++ ext/pgsql/pgsql.c	2012-03-02 11:55:34.000000000 +0100
@@ -2012,7 +2012,8 @@
 			break;
 		case PHP_PG_CMD_TUPLES:
 #if HAVE_PQCMDTUPLES
-			Z_LVAL_P(return_value) = atoi(PQcmdTuples(pgsql_result));
+			Z_LVAL_P(return_value) = (PQresultStatus(pgsql_result) == PGRES_COMMAND_OK) ?
+					atol(PQcmdTuples(pgsql_result)) : 0L;
 #else
 			php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not supported under this build");
 			Z_LVAL_P(return_value) = 0;
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 19:01:33 2024 UTC