diff options
author | Edin Kadribasic <edink@php.net> | 2005-07-01 22:30:55 +0000 |
---|---|---|
committer | Edin Kadribasic <edink@php.net> | 2005-07-01 22:30:55 +0000 |
commit | 7ef1a91508ec876a3c79b9e4da42f3dca6c65b3e (patch) | |
tree | 8d8277095b7b432f3d7594c9cb851feb4a39b370 /ext/pdo_pgsql/pgsql_driver.c | |
parent | 5d6578987767e12479f9440fc90622cd1d23be46 (diff) | |
download | php-git-7ef1a91508ec876a3c79b9e4da42f3dca6c65b3e.tar.gz |
Fold PQresultErrorField() into a macro
Diffstat (limited to 'ext/pdo_pgsql/pgsql_driver.c')
-rw-r--r-- | ext/pdo_pgsql/pgsql_driver.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c index c0ec5c9d89..3d283fa188 100644 --- a/ext/pdo_pgsql/pgsql_driver.c +++ b/ext/pdo_pgsql/pgsql_driver.c @@ -160,12 +160,7 @@ static long pgsql_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len TSRM } else { ExecStatusType qs = PQresultStatus(res); if (qs != PGRES_COMMAND_OK && qs != PGRES_TUPLES_OK) { -#if HAVE_PQRESULTERRORFIELD - char * sqlstate = PQresultErrorField(res, PG_DIAG_SQLSTATE); - pdo_pgsql_error(dbh, qs, (const char *)sqlstate); -#else - pdo_pgsql_error(dbh, qs, NULL); -#endif + pdo_pgsql_error(dbh, qs, pdo_pgsql_sqlstate(res)); PQclear(res); return -1; } @@ -232,12 +227,7 @@ static char *pdo_pgsql_last_insert_id(pdo_dbh_t *dbh, const char *name, unsigned id = estrdup((char *)PQgetvalue(res, 0, 0)); *len = PQgetlength(res, 0, 0); } else { -#if HAVE_PQRESULTERRORFIELD - char * sqlstate = PQresultErrorField(res, PG_DIAG_SQLSTATE); - pdo_pgsql_error(dbh, status, (const char *)sqlstate); -#else - pdo_pgsql_error(dbh, status, NULL); -#endif + pdo_pgsql_error(dbh, status, pdo_pgsql_sqlstate(res)); } if (res) { |