"pegase-dre.self", "dbname" => "dre", "user" => "root", "password" => "admin", #"user" => "reader", #"password" => "reader", ]); function e($sql) { global $pgsql; $v = $pgsql->exec($sql); $v = var_export($v, true); echo "'$sql' --> $v\n"; } function g($sql) { global $pgsql; $v = $pgsql->get($sql); $v = var_export($v, true); echo "'$sql' --> $v\n"; } function o($sql) { global $pgsql; $r = $pgsql->one($sql); $r = var_export($r, true); echo "'$sql' --> $r\n"; } function a($sql) { global $pgsql; $rs = $pgsql->all($sql); echo "'$sql'\n"; foreach ($rs as $r) { $r = var_export($r, true); echo " --> $r\n"; } } g("select age from personnes where id=1"); o("select name, age from personnes where id=2"); a("select id, name, age from personnes"); $n = rand(); $pgsql->exec([ "insert", "into" => "personnes", "values" => [ "name" => "prout$n", "age" => $n, ], ]); class MyChannel extends CapacitorChannel { const COLUMN_DEFINITIONS = [ "name" => "varchar", "value" => "int", ]; function getItemValues($item): ?array { return $item; } } $storage = new PgsqlStorage($pgsql); $channel = new MyChannel(); new Capacitor($storage, $channel); $channel->charge([ "name" => "one", "value" => rand(), ]); foreach ($channel->all(null) as $row) { var_export($row); }