Commit Graph

84 Commits

Author SHA1 Message Date
Peter Kokot
80ae7f7979
Update pgsql extensions preprocessor macros help texts (#15290)
[skip ci]
2024-08-08 16:14:43 +02:00
Peter Kokot
f66feaec0f
Sync HAVE_<extension> help texts (#15167)
This syncs all help texts of extension preprocessor macros to the same
style "Define to 1 if the PHP extension '<ext>' is available.".
[skip ci]
2024-08-02 01:41:47 +02:00
Peter Kokot
1ceadaed52
Autotools: Normalize and quote all PHP_NEW_EXTENSION arguments (#15144)
This adds Autoconf quote characters to all PHP_NEW_EXTENSION arguments
and syncs the CS across the php-src Autotools build system.
2024-07-29 00:14:59 +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
Peter Kokot
f4ce50ddfb
Add optional pkg-config support for PostgreSQL library (libpq) (#14540)
The pkg-config (libpq.pc file) was added in PostgreSQL 9.3. This adds a
common setup M4 macro PHP_SETUP_PGSQL to find client PostgreSQL library
libpq on the system with pkg-config. If not found, check falls back to
pg_config to find the libpq and its headers in common locations as
before.

The PGSQL_CFLAGS and PGSQL_LIBS environment variables can override the
libpq installation paths:

    ./configure --with-pgsql --with-pdo-pgsql \
        PGSQL_CFLAGS=-I/path/to/libpq \
        PGSQL_LIBS="-L/path/to/libpq -lpq"

Passing manual, non-standard PostgreSQL installation path can be done
with configure option arguments:

    ./configure \
        --with-pgsql=/any/path/to/postgresql \
        --with-pdo-postgresql=/any/path/to/postgresql

If this DIR argument (PostgreSQL installation directory or path to the
pg_config) is passed, it takes precedence over the pkg-config, when
installed on the system.

This also removes the unused HAVE_LIBPQ symbol and passing the
PGSQL_INCLUDE and PGSQL_LIBDIR environment variable to configure in
favor of PGSQL_CFLAGS and PGSQL_LIBS.

Instead of the obsolete backticks the recommended $(...) is used when
invoking the pg_config.

Follow-up of GH-4235 (Use PKG_CHECK_MODULES to detect the pq library)
2024-06-21 18:35:37 +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
Peter Kokot
2969889fb8
Remove conditional pg_encoding_to_char usage (#14557)
The pg_encoding_to_char is available in PostgreSQL since ~7.3 where also
the --enable-multibyte option was removed. PHP minimum PostgreSQL
version at this point is 9.1, which also has the pg_encoding_to_char
declaration in libpq-fe.h.

This removes conditional usage and the HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT
symbol.
2024-06-13 16:00:16 +02:00
Peter Kokot
d545b1d643
Add missing ext/pcre dependency for ext/pgsql (#14541) 2024-06-11 23:38:23 +02: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
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
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
Peter Kokot
42a4e50513
Sync logical operators in shell scripting code (#13560)
This updates the obsolescent `-a` and `-o` binary primaries to `&&` and
`||`.

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html
2024-03-01 20:40:16 +01:00
Remi Collet
21aaf3321f
check PQsetErrorContextVisibility availability (libpq >= 9.6) 2023-06-21 08:47:59 +02:00
Christoph M. Becker
ce668c0ec6 PGSQL and POD_SQL: don't include pg_config.h
Even if that header file is available, we better consider it private,
and don't include it.  The information about whether SSL support is
enabled is now missing (`USE_(OPEN)SSL`), and it seems there is no
alternative way to get it (`PQinitSSL()` is always defined), so we
remove it from the PHP info.  Furthermore, the `PG_VERSION` and
`PG_VERSION_STR` macros are no longer available, but as of libpq 9.1
there is `PQlibVersion()` which allows us to construct `PG_VERSION` in
a most likely backwards compatible manner.  The additional information
available through `PG_VERSION_STR` is lost, though, so we define
`PGSQL_LIBPQ_VERSION_STR` basically as alias of `PGSQL_LIBPQ_VERSION`,
and deprecate it right away.

Since we are now requiring at least libpq 9.1, we can remove some
further compatibility code and additional checks.

Regarding the raised requirements: official support for PostGreSQL 9.0
ended on 2015-10-08, and even CentOS 7 already has PostGreSQL 9.2, so
this is not supposed to be too much of an issue.
2020-05-25 10:48:35 +02:00
Christoph M. Becker
4bc1d8333a Raise ext/pgsql requirements to PostGreSQL 7.4
We can safely assume that users have at the very least libpq 7.4, for
which official support ended on 2010-10-01; even CentOS 6 has 8.4 now.
It is also noteworthy that PDO_PGSQL already requires libpq 7.4 or
later.
2020-05-22 15:56:24 +02:00
Peter Kokot
a2b758dab5 Remove HAVE_PQPUTCOPYEND
Symbol is not used anywhere in the code and also Postgresql 7.x is
EOL anyway.

Closes GH-4453
2019-07-22 16:05:26 +02:00
Remi Collet
66bd7875f8 add comment about pg_config/pkgconfig 2019-06-12 09:39:11 +02:00
Joe Watkins
eac238fb6c
Revert "ext/pgsql: Use PKG_CHECK_MODULES to detect the pq library"
This reverts commit 1e265174ed.
2019-06-12 08:00:55 +02:00
Hugh McMaster
1e265174ed
ext/pgsql: Use PKG_CHECK_MODULES to detect the pq library 2019-06-11 08:53:49 +02:00
Peter Kokot
75fb74860d Normalize comments in *nix build system m4 files
Normalization include:
- Use dnl for everything that can be ommitted when configure is built in
  favor of the shell comment character # which is visible in the output.
- Line length normalized to 80 columns
- Dots for most of the one line sentences
- Macro definitions include similar pattern header comments now
2019-05-12 18:43:03 +02:00
Peter Kokot
9df6a1e4dd Add AS_HELP_STRING to *nix build configure options
The Autoconf's default AS_HELP_STRING macro can properly format help
strings [1] so watching out if columns are aligned manually is not
anymore.

[1] https://www.gnu.org/software/autoconf/manual/autoconf.html#Pretty-Help-Strings
2019-03-07 20:36:59 +01:00
Peter Kokot
1ad08256f3 Sync leading and final newlines in source code files
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-14 12:56:38 +02:00
Peter Kokot
cf3b852109 Trim trailing whitespaces in build files
Some editors utilizing .editorconfig automatically trim whitespaces. For
convenience this patch removes whitespaces in certain build files:
- ext/*/config*.m4
- configure.ac
- acinclude.m4
2018-07-29 03:43:45 +02:00
Peter Kokot
8d3f8ca12a Remove unused Git attributes ident
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.

In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.

This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
2018-07-25 00:53:25 +02:00
Anatol Belski
7a6a3d923b fix arg order, CFLAGS is the fifth arg in m4 2014-10-17 16:03:40 +02:00
Anatol Belski
7f1107de91 converted ext/ereg, ext/phar and ext/pgsql for static tsrmls usage 2014-10-16 13:47:43 +02:00
Yasuo Ohgaki
28be6aea9c Added pg_lo_truncate() and 64bit large object support from PostgreSQL 9.3 and up 2014-01-15 14:37:24 +09:00
Christopher Jones
c6d977dd39 Fix long-standing visual pain point: the misalignment of './configure help' text.
Whitespace changes and a couple of grammar fixes.
2013-08-06 11:06:09 -07:00
Yasuo Ohgaki
77d11b4959 add pg_escape_identifier/pg_escape_literal 2011-11-25 02:21:01 +00:00
Hartmut Holzgraefe
54981e8c2e MFH: corrected library search path order in tests 2008-07-23 21:44:25 +00:00
Hartmut Holzgraefe
432b57b2ae added support for object ids in pg_lo_create() and pg_lo_import() where available
(based on code provided by Tatsuo Ishii)
2008-07-23 00:17:19 +00:00
Jani Taskinen
0261432888 MFH 2007-07-11 21:51:55 +00:00
Ilia Alshanetsky
7605d10252 PQfreemem checks 2007-02-18 17:05:53 +00:00
Ilia Alshanetsky
fab29dcbcf Make pg_escape_bytea() use PQescapeByteaConn() whenever possible. 2006-10-06 21:45:10 +00:00
Ilia Alshanetsky
e8c70bfa99 Added support for character sets in pg_escape_string() for PostgreSQL
8.1.4 and higher.
2006-10-04 23:27:03 +00:00
Ilia Alshanetsky
2cc1f53f3b Added a check for PQftable() function 2006-09-15 19:47:50 +00:00
foobar
8c56ee5cb6 MFH: - Fixed bug #35911 (HAVE_PG_CONFIG_H set incorrectly) 2006-01-05 21:53:19 +00:00
foobar
03897956b2 revert fix that did not fix anything 2005-07-22 22:00:55 +00:00
Yasuo Ohgaki
813bd67320 fix build with older postgresql 2005-07-22 18:48:14 +00:00
foobar
a20383ba06 - Unify the "configure --help" texts 2005-05-29 23:17:16 +00:00
Antony Dovgal
1c4eb9b684 fix typo 2005-04-03 13:06:08 +00:00
Christopher Kings-Lynne
030ebaaa45 (PHP pg_unescape_bytea) Use libpq version of PQunescapeBytea if it exists.
# The version in libpq is newer and faster than the one in PHP, but it is
# necessary for me to add a string copy for freeing purposes.  This copy
# is only needed in Windows AFAIK, how can I detect that?
2005-03-25 06:26:31 +00:00
Christopher Kings-Lynne
e2b87e6230 Tweak some #if's to be more orthogonal.
(PHP pg_set_error_verbosity) New function to set PostgreSQL error verbosity

(PHP pg_copy_from) Use non-deprecated API if it is available

(PHP pg_copy_to) Use non-deprecated API if it is available
2005-03-22 08:51:23 +00:00
Christopher Kings-Lynne
1168c30635 Added several new functions to support the PostgreSQL v3 protocol
introduced in PostgreSQL 7.4.

(PHP pg_transaction_status) New function to get in-transaction status of
                            a database connection.

(PHP pg_query_params) New function to allow execution of parameterized
                      queries.

(PHP pg_prepare) New function to allow preparing named queries.

(PHP pg_execute) New function to allow execution of named prepared
                 queries.

(PHP pg_send_query_params) New function that is the async equivalent of
                           pg_query_params.

(PHP pg_send_prepare) New function that is the async equivalent of
                      pg_prepare.

(PHP pg_send_execute) New function that is the async equivalent of
                      pg_execute.

(PHP pg_result_error_field) New function that allows highly detailed
                            error information, most importantly the
                            SQLSTATE error code

# Regression tests are included for all but 2 functions, the rest will
# follow shortly.  Docs will also follow shortly.
2005-03-19 08:46:56 +00:00
foobar
69eec3f3b9 MFB_4_3: Quote macro names in AC_DEFUN() 2004-12-30 07:08:39 +00:00
Joe Orton
2685ca935f Update extensions to use /path/to/$PHP_LIBDIR rather than /path/to/lib
to support multi-ABI platforms.
2004-11-03 14:32:52 +00:00
Marcus Boerger
b460ae868e Use pg_config if it can be found. 2004-01-09 18:44:33 +00:00
Marcus Boerger
ab36d72c16 Needed function detection 2003-07-27 16:46:40 +00:00
Marcus Boerger
7a85edd370 Added pg_version() which returns an associative array of client/protocol/server
version.
@Added pg_version() function. (Marcus)
2003-07-22 23:05:17 +00:00