1 # array pq\Result::fetchAll([int $fetch_type = pq\Result::$fetchType])
3 Fetch all rows at once.
7 * Optional int $fetch_type = pq\Result::$fetchType
8 The type the return value should have, see pq\Result::FETCH_* constants.
12 * array, all fetched rows.
16 * pq\Exception\InvalidArgumentException
17 * pq\Exception\BadMethodCallException
24 $connection = new pq\Connection;
26 $result = $connection->exec("SELECT id, name, email FROM accounts WHERE email LIKE '_@%'");
28 foreach ($result->fetchAll(pq\Result::FETCH_OBJECT) as $row) {
29 echo "ID: {$row->id}\n";
30 echo "Name: {$row->name}\n";
31 echo "Mail: {$row->email}\n\n";
33 } catch (\pq\Exception $e) {
34 echo $e->getMessage(), "\n";