xref: /PHP-8.2/ext/pgsql/tests/02connection.phpt (revision e378968c)
1--TEST--
2PostgreSQL connection
3--EXTENSIONS--
4pgsql
5--SKIPIF--
6<?php include("skipif.inc"); ?>
7--FILE--
8<?php
9// connection function tests
10
11include('config.inc');
12
13$db = pg_pconnect($conn_str);
14var_dump($db);
15
16if (pg_connection_status($db) != PGSQL_CONNECTION_OK)
17{
18    echo "pg_connection_status() error\n";
19}
20if (!pg_connection_reset($db))
21{
22    echo "pg_connection_reset() error\n";
23}
24if (pg_connection_busy($db))
25{
26    echo "pg_connection_busy() error\n";
27}
28if (function_exists('pg_transaction_status')) {
29    if (pg_transaction_status($db) != PGSQL_TRANSACTION_IDLE)
30    {
31        echo "pg_transaction_status() error\n";
32    }
33}
34if (false === pg_host($db))
35{
36    echo "pg_host() error\n";
37}
38if (!pg_dbname($db))
39{
40    echo "pg_dbname() error\n";
41}
42if (!pg_port($db))
43{
44    echo "pg_port() error\n";
45}
46if (pg_tty($db))
47{
48    echo "pg_tty() error\n";
49}
50if (pg_options($db))
51{
52    echo "pg_options() error\n";
53}
54
55pg_close($db);
56
57?>
58--EXPECTF--
59object(PgSql\Connection)#%d (0) {
60}
61