summaryrefslogtreecommitdiff
path: root/ext/pdo_pgsql/pgsql_driver.c
diff options
context:
space:
mode:
authorMatteo Beccati <mbeccati@php.net>2016-08-04 09:28:58 +0200
committerMatteo Beccati <mbeccati@php.net>2016-08-04 09:28:58 +0200
commitd3a8e107acb4f729016b6d649bc83a888359fb7d (patch)
treec577e25d60103502d4f0db7100506d9b556592b4 /ext/pdo_pgsql/pgsql_driver.c
parent78488a54c8f23c16bf0ca044c50c0fac8e303400 (diff)
downloadphp-git-d3a8e107acb4f729016b6d649bc83a888359fb7d.tar.gz
Clean up FR #72633
Diffstat (limited to 'ext/pdo_pgsql/pgsql_driver.c')
-rw-r--r--ext/pdo_pgsql/pgsql_driver.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c
index 52a7768492..5b78bcc438 100644
--- a/ext/pdo_pgsql/pgsql_driver.c
+++ b/ext/pdo_pgsql/pgsql_driver.c
@@ -360,12 +360,13 @@ static char *pdo_pgsql_last_insert_id(pdo_dbh_t *dbh, const char *name, unsigned
char *id = NULL;
PGresult *res;
ExecStatusType status;
- const char *q[1];
- q[0] = name;
- if (PHP_PDO_PGSQL_LASTVAL_PG_VERSION <= PQserverVersion(H->server) && name == NULL) {
+ if (name == NULL) {
res = PQexec(H->server, "SELECT LASTVAL()");
} else {
+ const char *q[1];
+ q[0] = name;
+
res = PQexecParams(H->server, "SELECT CURRVAL($1)", 1, NULL, q, NULL, NULL, 0);
}
status = PQresultStatus(res);