int pq\Connection::on(string $event, callable $callback)

Listen for an event.

Params:

Returns:

Throws:

Example:

<?php

$connection = new pq\Connection;
$connection->on(pq\Connection::EVENT_RESULT, function($c, $r) {
    printf("Got result with %d rows\n", $r->numRows);
});
$connection->exec("SELECT * FROM generate_series(1,3)");

?>

Yields:

Got result with 3 rows