Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion ext/pgsql/pgsql.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ char pgsql_libpq_version[16];
#define PQfreemem free
#endif

#if PG_VERSION_NUM < 120000
#define PQERRORS_SQLSTATE 0
#endif

ZEND_DECLARE_MODULE_GLOBALS(pgsql)
static PHP_GINIT_FUNCTION(pgsql);

Expand Down Expand Up @@ -2821,7 +2825,7 @@ PHP_FUNCTION(pg_set_error_verbosity)

pgsql = link->conn;

if (verbosity & (PQERRORS_TERSE|PQERRORS_DEFAULT|PQERRORS_VERBOSE)) {
if (verbosity & (PQERRORS_TERSE|PQERRORS_DEFAULT|PQERRORS_VERBOSE|PQERRORS_SQLSTATE)) {
RETURN_LONG(PQsetErrorVerbosity(pgsql, verbosity));
} else {
RETURN_FALSE;
Expand Down
13 changes: 13 additions & 0 deletions ext/pgsql/pgsql.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,19 @@
* @cvalue PQERRORS_VERBOSE
*/
const PGSQL_ERRORS_VERBOSE = UNKNOWN;
#if PGVERSION_NUM > 110000
/**
* @var int
* @cvalue PQERRORS_SQLSTATE
*/
const PGSQL_ERRORS_SQLSTATE = UNKNOWN;
#else
/**
* @var int
* @cvalue PQERRORS_TERSE
*/
const PGSQL_ERRORS_SQLSTATE = UNKNOWN;
#endif

/* For lo_seek() */

Expand Down
8 changes: 7 additions & 1 deletion ext/pgsql/pgsql_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ext/pgsql/tests/07optional.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ if (function_exists('pg_set_error_verbosity')) {
pg_set_error_verbosity($db, PGSQL_ERRORS_TERSE);
pg_set_error_verbosity($db, PGSQL_ERRORS_DEFAULT);
pg_set_error_verbosity($db, PGSQL_ERRORS_VERBOSE);
pg_set_error_verbosity($db, PGSQL_ERRORS_SQLSTATE);
}
echo "OK";
?>
Expand Down