cvs: php-src /ext/pdo_pgsql pgsql_driver.c
| From: | Ilia Alshanetsky | Date: | Sun, 29 Jan 2006 17:36:12 +0000 |
| Subject: | cvs: php-src /ext/pdo_pgsql pgsql_driver.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-36672@lists.php.net to get a copy of this message | ||
iliaa Sun Jan 29 17:36:12 2006 UTC
Modified files:
/php-src/ext/pdo_pgsql pgsql_driver.c
Log:
MFB51: Fixed bug #36176 (PDO_PGSQL - PDO::exec() does not return number of
rows affected by the operation).
http://cvs.php.net/viewcvs.cgi/php-src/ext/pdo_pgsql/pgsql_driver.c?r1=1.56&r2=1.57&diff_format=u
Index: php-src/ext/pdo_pgsql/pgsql_driver.c
diff -u php-src/ext/pdo_pgsql/pgsql_driver.c:1.56 php-src/ext/pdo_pgsql/pgsql_driver.c:1.57
--- php-src/ext/pdo_pgsql/pgsql_driver.c:1.56 Sun Jan 1 13:09:53 2006
+++ php-src/ext/pdo_pgsql/pgsql_driver.c Sun Jan 29 17:36:12 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pgsql_driver.c,v 1.56 2006/01/01 13:09:53 sniper Exp $ */
+/* $Id: pgsql_driver.c,v 1.57 2006/01/29 17:36:12 iliaa Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -222,23 +222,26 @@
{
pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data;
PGresult *res;
+ long ret = 1;
if (!(res = PQexec(H->server, sql))) {
/* fatal error */
pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, NULL);
return -1;
- } else {
- ExecStatusType qs = PQresultStatus(res);
- if (qs != PGRES_COMMAND_OK && qs != PGRES_TUPLES_OK) {
- pdo_pgsql_error(dbh, qs, pdo_pgsql_sqlstate(res));
- PQclear(res);
- return -1;
- }
- H->pgoid = PQoidValue(res);
+ }
+ ExecStatusType qs = PQresultStatus(res);
+ if (qs != PGRES_COMMAND_OK && qs != PGRES_TUPLES_OK) {
+ pdo_pgsql_error(dbh, qs, pdo_pgsql_sqlstate(res));
PQclear(res);
+ return -1;
}
+ H->pgoid = PQoidValue(res);
+#if HAVE_PQCMDTUPLES
+ ret = atol(PQcmdTuples(res));
+#endif
+ PQclear(res);
- return 1;
+ return ret;
}
static int pgsql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char
**quoted, int *quotedlen, enum pdo_param_type paramtype TSRMLS_DC)