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
19 * pq\Exception\BadMethodCallException
25 $connection = new pq\Connection;
26 $connection->on(pq\Connection::EVENT_RESULT, function($c, $r) {
27 printf("Got result with %d rows\n", $r->numRows);
29 $connection->exec("SELECT * FROM generate_series(1,3)");
35 Got result with 3 rows