1 # int pq\Connection::on(string $event, callable $callback)
8 Any pq\Connection::EVENT_*.
9 * callable $callback as function(pq\Connection $c[, pq\Result $r)
10 The callback to invoke on event.
14 * int, number of previously attached event listeners.
18 * pq\Exception\InvalidArgumentException
24 $connection = new pq\Connection;
25 $connection->on(pq\Connection::EVENT_RESULT, function($c, $r) {
26 printf("Got result with %d rows\n", $r->numRows);
28 $connection->exec("SELECT * FROM generate_series(1,3)");
34 Got result with 3 rows