File tree Expand file tree Collapse file tree 6 files changed +28
-2
lines changed Expand file tree Collapse file tree 6 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,7 @@ PHP NEWS
126126 . pg_cancel use thread safe PQcancel api instead. (David Carlier)
127127 . pg_trace new PGSQL_TRACE_SUPPRESS_TIMESTAMPS/PGSQL_TRACE_REGRESS_MODE
128128 contants support. (David Carlier)
129+ . pg_set_error_verbosity adding PGSQL_ERRORS_STATE constant. (David Carlier)
129130
130131- Phar:
131132 . Fix memory leak in phar_rename_archive(). (stkeke)
Original file line number Diff line number Diff line change @@ -220,6 +220,7 @@ PHP 8.3 UPGRADE NOTES
220220- PGSQL:
221221 . PGSQL_TRACE_SUPPRESS_TIMESTAMPS.
222222 . PGSQL_TRACE_REGRESS_MODE.
223+ . PGSQL_ERRORS_SQLSTATE.
223224
224225- Posix:
225226 . POSIX_SC_ARG_MAX.
Original file line number Diff line number Diff line change @@ -112,6 +112,10 @@ char pgsql_libpq_version[16];
112112#define PQfreemem free
113113#endif
114114
115+ #if PG_VERSION_NUM < 120000
116+ #define PQERRORS_SQLSTATE 0
117+ #endif
118+
115119ZEND_DECLARE_MODULE_GLOBALS (pgsql )
116120static PHP_GINIT_FUNCTION (pgsql );
117121
@@ -2821,7 +2825,7 @@ PHP_FUNCTION(pg_set_error_verbosity)
28212825
28222826 pgsql = link -> conn ;
28232827
2824- if (verbosity & (PQERRORS_TERSE |PQERRORS_DEFAULT |PQERRORS_VERBOSE )) {
2828+ if (verbosity & (PQERRORS_TERSE |PQERRORS_DEFAULT |PQERRORS_VERBOSE | PQERRORS_SQLSTATE )) {
28252829 RETURN_LONG (PQsetErrorVerbosity (pgsql , verbosity ));
28262830 } else {
28272831 RETURN_FALSE ;
Original file line number Diff line number Diff line change 183183 * @cvalue PQERRORS_VERBOSE
184184 */
185185 const PGSQL_ERRORS_VERBOSE = UNKNOWN ;
186+ #if PGVERSION_NUM > 110000
187+ /**
188+ * @var int
189+ * @cvalue PQERRORS_SQLSTATE
190+ */
191+ const PGSQL_ERRORS_SQLSTATE = UNKNOWN ;
192+ #else
193+ /**
194+ * @var int
195+ * @cvalue PQERRORS_TERSE
196+ */
197+ const PGSQL_ERRORS_SQLSTATE = UNKNOWN ;
198+ #endif
186199
187200 /* For lo_seek() */
188201
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ if (function_exists('pg_set_error_verbosity')) {
1919 pg_set_error_verbosity ($ db , PGSQL_ERRORS_TERSE );
2020 pg_set_error_verbosity ($ db , PGSQL_ERRORS_DEFAULT );
2121 pg_set_error_verbosity ($ db , PGSQL_ERRORS_VERBOSE );
22+ pg_set_error_verbosity ($ db , PGSQL_ERRORS_SQLSTATE );
2223}
2324echo "OK " ;
2425?>
You can’t perform that action at this time.
0 commit comments