Files
php-src/ext/pgsql/tests/02connection.phpt
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

59 lines
924 B
PHP

--TEST--
PostgreSQL connection
--EXTENSIONS--
pgsql
--SKIPIF--
<?php include("inc/skipif.inc"); ?>
--FILE--
<?php
// connection function tests
include('inc/config.inc');
$db = pg_pconnect($conn_str);
var_dump($db);
if (pg_connection_status($db) != PGSQL_CONNECTION_OK)
{
echo "pg_connection_status() error\n";
}
if (!pg_connection_reset($db))
{
echo "pg_connection_reset() error\n";
}
if (pg_connection_busy($db))
{
echo "pg_connection_busy() error\n";
}
if (pg_transaction_status($db) != PGSQL_TRANSACTION_IDLE)
{
echo "pg_transaction_status() error\n";
}
if (false === pg_host($db))
{
echo "pg_host() error\n";
}
if (!pg_dbname($db))
{
echo "pg_dbname() error\n";
}
if (!pg_port($db))
{
echo "pg_port() error\n";
}
if (pg_tty($db))
{
echo "pg_tty() error\n";
}
if (pg_options($db))
{
echo "pg_options() error\n";
}
pg_close($db);
?>
--EXPECTF--
object(PgSql\Connection)#%d (0) {
}