mirror of
https://github.com/danog/postgres.git
synced 2024-11-30 04:29:12 +01:00
22 lines
595 B
PHP
22 lines
595 B
PHP
#!/usr/bin/env php
|
|
<?php
|
|
|
|
require \dirname(__DIR__) . '/vendor/autoload.php';
|
|
|
|
use Amp\Postgres;
|
|
|
|
Amp\Loop::run(function () {
|
|
$config = Postgres\ConnectionConfig::fromString('host=localhost user=postgres');
|
|
|
|
/** @var \Amp\Postgres\Connection $connection */
|
|
$connection = yield Postgres\connect($config);
|
|
|
|
/** @var \Amp\Postgres\ResultSet $result */
|
|
$result = yield $connection->query('SHOW ALL');
|
|
|
|
while (yield $result->advance()) {
|
|
$row = $result->getCurrent();
|
|
\printf("%-35s = %s (%s)\n", $row['name'], $row['setting'], $row['description']);
|
|
}
|
|
});
|