diff options
| author | Ilia Alshanetsky <iliaa@php.net> | 2006-01-29 17:35:54 +0000 |
|---|---|---|
| committer | Ilia Alshanetsky <iliaa@php.net> | 2006-01-29 17:35:54 +0000 |
| commit | 9b0f4a62342ba558e604b0c0c3526a9b48da4c79 (patch) | |
| tree | e0387b842aa413cb7815bf117017a3ff0d83051b /ext | |
| parent | af56d9f1d48c165d164a2ae53bbe6184123d93d5 (diff) | |
| download | php-git-9b0f4a62342ba558e604b0c0c3526a9b48da4c79.tar.gz | |
Fixed bug #36176 (PDO_PGSQL - PDO::exec() does not return number of rows
affected by the operation).
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/pdo_pgsql/pgsql_driver.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c index 18b2112c1b..c9fe4b174e 100644 --- a/ext/pdo_pgsql/pgsql_driver.c +++ b/ext/pdo_pgsql/pgsql_driver.c @@ -270,23 +270,26 @@ static long pgsql_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len TSRM { 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) |
