Commit Graph

53 Commits

Author SHA1 Message Date
Tim Düsterhus
29f98e7485
Replace @deprecated by #[\Deprecated] for internal functions / class constants (#14750)
Co-authored-by: Gina Peter Banyard <girgias@php.net>
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2024-07-10 16:47:31 +02:00
Peter Kokot
4f450b6264
Bump minimum libpq version to 10.0 (#14628)
This bumps the libpq client-side PostgreSQL library minimum required
version from 9.1 to 10.0.

- Sanity check: PQlibVersion -> PQencryptPasswordConn (available since
  libpq 10.0)
- PQsetErrorContextVisibility (available since libpq 9.6)
- lo_truncate64 (available since libpq 9.3), if 32-bit system doesn't
  support lo_*64 functions, error is returned and functions are always
  available

Additionally, the conditional functions usages in pdo_pgsql and pgsql
extensions that got piled up are cleaned and synced:

- pg_prepare (PQprepare available since libpq 7.4)
- pg_query_params (PQexecParams available since libpq 7.4)
- pg_result_error_field (PQresultErrorField available since libpq 7.4)
- pg_send_prepare (PQsendPrepare available since libpq 7.4)
- pg_send_query_params (PQsendQueryParams available since libpq 7.4)
- pg_set_error_verbosity (PQsetErrorVerbosity available since libpq 7.4)
- pg_transaction_status (PQtransactionStatus available since libpq 7.4)

The Windows libpq version is currently at version 11.4:
https://github.com/winlibs/postgresql

Discussion: https://news-web.php.net/php.internals/123609
Follow-up of GH-14540
2024-06-25 20:50:04 +02:00
David Carlier
564914ac1a
ext/pgsql: adding postgresql 17 new libpq wrapper call.
pg_set_chunked_rows_size to allow to fetch results in chunk of max N rows.

close GH-14571
2024-06-15 19:56:15 +01:00
David Carlier
2bb8fbd0a8
ext/pgsql: add pg_jit server info.
since PostgreSQL 11, LLVM JIT feature had been brought thus reporting
the settings to the client connection.

Close GH-14566
2024-06-14 16:27:00 +01:00
Peter Kokot
65ff5117ab
Check for PQERRORS_SQLSTATE in PGVerbosity enum (#14519)
The PG_VERSION_NUM is not available in intended public PostgreSQL
headers unless the pg_config.h is included or the PostgreSQL server
development headers are installed separately. This instead resorts to
checking for the PGVerbosity enum value. The PQERRORS_SQLSTATE was added
to PostgreSQL 12.0. At the time of writing, on Windows, PostgreSQL is at 11.4 so
it is not defined there yet.
2024-06-09 11:47:06 +02:00
Peter Kokot
01887afdfa
Fix typo s/PGVERSION_NUM/PG_VERSION_NUM (#14516) 2024-06-09 06:48:44 +02:00
David Carlier
e69bccd7c7
ext/pgsql: adding pg_socket_poll.
Using PQSocketPoll to poll on a connection's socket.
Returns immediatly is there no event expected on read and write.
Other than that, it is a thin wrapper on top of poll, thus reflecting
 its return value.

close GH-14366
2024-05-31 20:10:49 +01:00
Máté Kocsis
661c5ee546
Fix implicitly nullable parameter type for pg_put_copy_end() 2024-05-28 20:11:01 +02:00
David Carlier
162a311cc8
ext/pgsql: adding pg_put_copy_data/pg_put_copy_end.
pg_put_copy_data allows to send COPY commands to the server.
pg_put_copy_end signals the end of the n commands.

Both return 3 states ; 1, 0 and -1 when 1 is success, 0 the buffer queue
is full then -1 for errors.

Close GH-14325
2024-05-28 18:35:40 +01:00
David Carlier
9aa3a0d702
ext/pgsql: adding pg_change_password functionality.
handy call to change an user password while taking care transparently
of the password's encryption.

close GH-14262
2024-05-20 12:57:37 +01:00
武田 憲太郎
77fa4c0fce
ext/pgsql: add pg_result_memory_size
Close GH-14214
2024-05-13 22:58:02 +01:00
Jakub Zelenka
107ed64e2e
Merge branch 'PHP-8.3' 2023-11-20 16:24:57 +00:00
Jakub Zelenka
1e66e6ae73
Revert incomplete PG pipeline addition
Closes GH-12735
2023-11-20 16:22:29 +00:00
David Carlier
994d19d500 Merge branch 'PHP-8.3' 2023-11-10 16:08:08 +00:00
Dmitriy Degtyaryov
63898008c0 Fix GH-9344: pgsql pipeline mode proposal.
Adding pg_send_flush_request.
Fix freeze after next execute pg_send_* on PQgetResult in _php_pgsql_link_has_results.
Set nonblocking for pipelining mode.
No flush client buffer in pg_send_* for pipelining mode.

Close GH-12644
2023-11-10 16:06:04 +00:00
Omar Emara
75da0d7c45 PGSQL: Allow unconditional selection in pg_select
Previously, pg_select did not allow unconditional selection, where an
empty ids array would result in a function failure.

This patch implements two changes:
- Make the ids array an optional parameter.
- Allow the ids array to be empty.

In both cases, unconditional selection happen, which is equivalent to
pg_query('SELECT * FROM <table>;').

Two test cases were added to test the aforementioned changes.

Close GH-5332
2023-10-08 18:22:50 +01:00
Máté Kocsis
7ae0273ba3 Make the $row param of pg_fetch_result(), pg_field_prtlen() and pg_field_is_null() nullable 2023-07-18 12:59:21 +02:00
Remi Collet
21aaf3321f
check PQsetErrorContextVisibility availability (libpq >= 9.6) 2023-06-21 08:47:59 +02:00
David CARLIER
dd8514a0bd ext/pgsql: adding pg_set_error_context_visibility.
another level of context for pg_last_error/pg_result_error() to include
or not the context in those. PQSHOW_CONTEXT_ERRORS being the default.

Close GH-11395
2023-06-13 18:07:39 +01:00
Máté Kocsis
85338569de Narrow bool return types to true when possible 2023-05-07 19:34:09 +02:00
David CARLIER
f31d253849 ext/pgsql adding PGSQL_ERRORS_SQLSTATE constant support.
Close GH-11181
2023-05-05 15:08:27 +01:00
David Carlier
7ec8ae12c4 ext/pgsql: pg_trace allow to refine its trace mode via 2 new constants.
- PGSQL_TRACE_SUPPRESS_TIMESTAMPS.
- PGSQL_TRACE_REGRESS_MODE to have a more verbose and observable
output to check possible regressions.

Close GH-11041
2023-05-05 11:05:03 +01:00
David CARLIER
6a9061e0af Fix GH-9344: pgsql pipeline mode proposal.
Adding pg_enter_pipeline_mode, pg_exit_pipeline_mode,
pg_pipeline_sync and pg_pipeline_status.

Close GH-10868
2023-04-28 20:53:11 +01:00
SATO Kentaro
7fccdf72a4
Add support for generating namespaced constant
Closes GH-10552
2023-02-23 10:05:30 +01:00
Máté Kocsis
eae893bd3e
Declare ext/pgsql constants in stubs (#9092) 2022-07-27 07:32:40 +02:00
Máté Kocsis
d98634e652
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix 2nd param name of pg_send_execute()
2021-10-13 14:19:54 +02:00
Máté Kocsis
ca219d7d27
Fix 2nd param name of pg_send_execute()
Closes GH-7576
2021-10-13 14:14:47 +02:00
Máté Kocsis
1bf1481a2a
Specify a few array func info entries (#7425) 2021-08-30 14:29:18 +02:00
Máté Kocsis
8e6e9838b0
Add support for generating MAY_BE_ARRAY_OF_REF func info flag (#7416) 2021-08-30 13:50:34 +02:00
Máté Kocsis
68946bdd90
Generate optimizer func info from stubs for ext/gd and ext/pgsql (#7408) 2021-08-26 17:38:08 +02:00
Máté Kocsis
b1822899fc
Add support for generating optimizer function info from stubs (#7367) 2021-08-24 16:35:33 +02:00
Máté Kocsis
2378f35787
Use single line phpdoc in stubs where possible 2021-07-20 13:16:56 +02:00
Joe Watkins
570d9b63e9
Not serializable flag permeation 2021-07-20 12:28:35 +02:00
Máté Kocsis
b382883696
Indent stubs inside global namespace blocks (#7261) 2021-07-20 10:23:58 +02:00
Máté Kocsis
32aff25ceb
Convert resources to objects in ext/pgsql
Closes GH-6791

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2021-05-11 00:09:30 +02:00
Máté Kocsis
12799847a6
Merge branch 'PHP-8.0'
* Fix pg_get_notify() parameter name
2021-04-26 19:38:57 +02:00
Máté Kocsis
d1e590fe72
Fix pg_get_notify() parameter name
Closes GH-6916
2021-04-26 19:37:41 +02:00
Máté Kocsis
af56982a5e
Generate class entries from stubs for oci8, odbc, openssl, pcntl, pdo, pgsql
Closes GH-6691
2021-02-14 23:19:21 +01:00
Máté Kocsis
d5f92baad0 Fix default value handling of mysqli_fetch_object()
Make [] acceptable both for classes without constructors and
classes with a constructor that takes no arguments.

Closes GH-6336.
2020-10-20 16:48:12 +02:00
Máté Kocsis
d6264b0966
Verify parameter names of function aliases
Closes GH-6335
2020-10-16 10:56:33 +02:00
Nikita Popov
a7e84e2e02 Fix default value for some pgsql functions
These set the PGSQL_DML_EXEC flag by default.
2020-10-13 17:29:05 +02:00
Nikita Popov
7b0f5f424d Don't accept null in pg_unescape_bytea()
This is an error that slipped in via 8d37c37bcd.
pg_unescape_bytea() did not accept null in PHP 7.4, and it is not
meaningful for it to accept null now -- it will always fail, and now
with a misleading OOM message.
2020-10-13 15:37:13 +02:00
Nikita Popov
3171fec6da Update ext/pgsql parameter names
Closes GH-6294.
2020-10-13 12:30:44 +02:00
Nikita Popov
8ff2f2f84b Return empty array for no rows in pg_fetch_all()
This makes it line up with pg_fetch_all_columns(), as well as
similar functions in other exts, such as mysqli_fetch_all().
2020-09-21 17:22:02 +02:00
Nikita Popov
54f03d31e0 Promote invalid field to ValueError in pgsql
The same error condition is a ValueError in mysqli, be consistent.

Additionally, do not display the argument name for these errors.
As the signatures are overloaded, the argument name may not match
the meaning at all.
2020-09-21 17:00:23 +02:00
Nikita Popov
d1bbc39e4c pg_unescape_bytea() can only fail on OOM
The implementation did not check for PQunescapeBytea failure
correctly, because it checked for a null pointer after estrndup,
which certainly cannot happen. Inspection of the PGunescapeBytea
implementation has shown that this function can only fail on OOM,
so let's check for that explicitly and remove false as a possible
return type.

While we're here, avoid an unnecessary copy of the result.
2020-09-21 15:46:55 +02:00
Nikita Popov
7300f6fc17 Deprecate pgsql function aliases
These have been documentation-deprecated for a very long time,
make it official.
2020-09-21 11:33:05 +02:00
Máté Kocsis
8d37c37bcd
Fix a few UNKNOWN default values in ext/pgsql
Closes GH-6149
2020-09-17 11:00:59 +02:00
George Peter Banyard
d0111d785d Promote warnings to Errors in PostgreSQL extension
Do some drive by indentation fixes
Also fix pg_select() in regards to the $result_type arg which was missing from ZPP

Closes GH-6129
2020-09-14 17:01:35 +02:00
Nikita Popov
f29bfc0bd8 Use string|int union types in pgsql
For "field name or field offset" parameters.

Also make $ctor_params an ?array parameter.
2020-09-11 17:33:09 +02:00