2016-09-14 16:27:39 +02:00
|
|
|
#!/usr/bin/env php
|
|
|
|
<?php
|
|
|
|
|
2018-07-01 19:33:12 +02:00
|
|
|
require \dirname(__DIR__) . '/vendor/autoload.php';
|
2016-09-14 16:27:39 +02:00
|
|
|
|
|
|
|
use Amp\Postgres;
|
|
|
|
|
2017-03-17 16:17:24 +01:00
|
|
|
Amp\Loop::run(function () {
|
2018-10-14 17:48:07 +02:00
|
|
|
$host = 'localhost';
|
|
|
|
$port = Postgres\ConnectionConfig::DEFAULT_PORT;
|
|
|
|
$user = 'postgres';
|
|
|
|
|
2017-05-26 21:41:02 +02:00
|
|
|
/** @var \Amp\Postgres\Connection $connection */
|
2018-10-14 17:48:07 +02:00
|
|
|
$connection = yield Postgres\connect(new Postgres\ConnectionConfig($host, $port, $user));
|
2017-05-16 06:28:37 +02:00
|
|
|
|
2017-12-03 02:35:49 +01:00
|
|
|
/** @var \Amp\Postgres\ResultSet $result */
|
2017-05-26 21:41:02 +02:00
|
|
|
$result = yield $connection->query('SHOW ALL');
|
2017-05-16 06:28:37 +02:00
|
|
|
|
2017-01-18 19:52:40 +01:00
|
|
|
while (yield $result->advance()) {
|
2016-09-14 16:27:39 +02:00
|
|
|
$row = $result->getCurrent();
|
|
|
|
\printf("%-35s = %s (%s)\n", $row['name'], $row['setting'], $row['description']);
|
|
|
|
}
|
2017-03-17 16:17:24 +01:00
|
|
|
});
|