mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
ext/pgsql adding PGSQL_ERRORS_SQLSTATE constant support.
Close GH-11181
This commit is contained in:
parent
3af5f47ce6
commit
f31d253849
6 changed files with 28 additions and 2 deletions
1
NEWS
1
NEWS
|
@ -126,6 +126,7 @@ PHP NEWS
|
||||||
. pg_cancel use thread safe PQcancel api instead. (David Carlier)
|
. pg_cancel use thread safe PQcancel api instead. (David Carlier)
|
||||||
. pg_trace new PGSQL_TRACE_SUPPRESS_TIMESTAMPS/PGSQL_TRACE_REGRESS_MODE
|
. pg_trace new PGSQL_TRACE_SUPPRESS_TIMESTAMPS/PGSQL_TRACE_REGRESS_MODE
|
||||||
contants support. (David Carlier)
|
contants support. (David Carlier)
|
||||||
|
. pg_set_error_verbosity adding PGSQL_ERRORS_STATE constant. (David Carlier)
|
||||||
|
|
||||||
- Phar:
|
- Phar:
|
||||||
. Fix memory leak in phar_rename_archive(). (stkeke)
|
. Fix memory leak in phar_rename_archive(). (stkeke)
|
||||||
|
|
|
@ -220,6 +220,7 @@ PHP 8.3 UPGRADE NOTES
|
||||||
- PGSQL:
|
- PGSQL:
|
||||||
. PGSQL_TRACE_SUPPRESS_TIMESTAMPS.
|
. PGSQL_TRACE_SUPPRESS_TIMESTAMPS.
|
||||||
. PGSQL_TRACE_REGRESS_MODE.
|
. PGSQL_TRACE_REGRESS_MODE.
|
||||||
|
. PGSQL_ERRORS_SQLSTATE.
|
||||||
|
|
||||||
- Posix:
|
- Posix:
|
||||||
. POSIX_SC_ARG_MAX.
|
. POSIX_SC_ARG_MAX.
|
||||||
|
|
|
@ -112,6 +112,10 @@ char pgsql_libpq_version[16];
|
||||||
#define PQfreemem free
|
#define PQfreemem free
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if PG_VERSION_NUM < 120000
|
||||||
|
#define PQERRORS_SQLSTATE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
ZEND_DECLARE_MODULE_GLOBALS(pgsql)
|
ZEND_DECLARE_MODULE_GLOBALS(pgsql)
|
||||||
static PHP_GINIT_FUNCTION(pgsql);
|
static PHP_GINIT_FUNCTION(pgsql);
|
||||||
|
|
||||||
|
@ -2821,7 +2825,7 @@ PHP_FUNCTION(pg_set_error_verbosity)
|
||||||
|
|
||||||
pgsql = link->conn;
|
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));
|
RETURN_LONG(PQsetErrorVerbosity(pgsql, verbosity));
|
||||||
} else {
|
} else {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
|
|
|
@ -183,6 +183,19 @@ namespace {
|
||||||
* @cvalue PQERRORS_VERBOSE
|
* @cvalue PQERRORS_VERBOSE
|
||||||
*/
|
*/
|
||||||
const PGSQL_ERRORS_VERBOSE = UNKNOWN;
|
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() */
|
/* For lo_seek() */
|
||||||
|
|
||||||
|
|
8
ext/pgsql/pgsql_arginfo.h
generated
8
ext/pgsql/pgsql_arginfo.h
generated
|
@ -1,5 +1,5 @@
|
||||||
/* This is a generated file, edit the .stub.php file instead.
|
/* This is a generated file, edit the .stub.php file instead.
|
||||||
* Stub hash: f18a73443942daa2b3695e8750c8daaea6b96194 */
|
* Stub hash: f5b563282ffa08a4f79293fcf91df284433a6f5c */
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_pg_connect, 0, 1, PgSql\\Connection, MAY_BE_FALSE)
|
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_pg_connect, 0, 1, PgSql\\Connection, MAY_BE_FALSE)
|
||||||
ZEND_ARG_TYPE_INFO(0, connection_string, IS_STRING, 0)
|
ZEND_ARG_TYPE_INFO(0, connection_string, IS_STRING, 0)
|
||||||
|
@ -754,6 +754,12 @@ static void register_pgsql_symbols(int module_number)
|
||||||
REGISTER_LONG_CONSTANT("PGSQL_ERRORS_TERSE", PQERRORS_TERSE, CONST_PERSISTENT);
|
REGISTER_LONG_CONSTANT("PGSQL_ERRORS_TERSE", PQERRORS_TERSE, CONST_PERSISTENT);
|
||||||
REGISTER_LONG_CONSTANT("PGSQL_ERRORS_DEFAULT", PQERRORS_DEFAULT, CONST_PERSISTENT);
|
REGISTER_LONG_CONSTANT("PGSQL_ERRORS_DEFAULT", PQERRORS_DEFAULT, CONST_PERSISTENT);
|
||||||
REGISTER_LONG_CONSTANT("PGSQL_ERRORS_VERBOSE", PQERRORS_VERBOSE, CONST_PERSISTENT);
|
REGISTER_LONG_CONSTANT("PGSQL_ERRORS_VERBOSE", PQERRORS_VERBOSE, CONST_PERSISTENT);
|
||||||
|
#if PGVERSION_NUM > 110000
|
||||||
|
REGISTER_LONG_CONSTANT("PGSQL_ERRORS_SQLSTATE", PQERRORS_SQLSTATE, CONST_PERSISTENT);
|
||||||
|
#endif
|
||||||
|
#if !(PGVERSION_NUM > 110000)
|
||||||
|
REGISTER_LONG_CONSTANT("PGSQL_ERRORS_SQLSTATE", PQERRORS_TERSE, CONST_PERSISTENT);
|
||||||
|
#endif
|
||||||
REGISTER_LONG_CONSTANT("PGSQL_SEEK_SET", SEEK_SET, CONST_PERSISTENT);
|
REGISTER_LONG_CONSTANT("PGSQL_SEEK_SET", SEEK_SET, CONST_PERSISTENT);
|
||||||
REGISTER_LONG_CONSTANT("PGSQL_SEEK_CUR", SEEK_CUR, CONST_PERSISTENT);
|
REGISTER_LONG_CONSTANT("PGSQL_SEEK_CUR", SEEK_CUR, CONST_PERSISTENT);
|
||||||
REGISTER_LONG_CONSTANT("PGSQL_SEEK_END", SEEK_END, CONST_PERSISTENT);
|
REGISTER_LONG_CONSTANT("PGSQL_SEEK_END", SEEK_END, CONST_PERSISTENT);
|
||||||
|
|
|
@ -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_TERSE);
|
||||||
pg_set_error_verbosity($db, PGSQL_ERRORS_DEFAULT);
|
pg_set_error_verbosity($db, PGSQL_ERRORS_DEFAULT);
|
||||||
pg_set_error_verbosity($db, PGSQL_ERRORS_VERBOSE);
|
pg_set_error_verbosity($db, PGSQL_ERRORS_VERBOSE);
|
||||||
|
pg_set_error_verbosity($db, PGSQL_ERRORS_SQLSTATE);
|
||||||
}
|
}
|
||||||
echo "OK";
|
echo "OK";
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue