diff --git a/src/Query/SelectQuery.php b/src/Query/SelectQuery.php index 52a39271..0fec98f1 100644 --- a/src/Query/SelectQuery.php +++ b/src/Query/SelectQuery.php @@ -368,7 +368,18 @@ public function getIterator(): StatementInterface { return $this->run(); } - + /** + * Request the first result as array (when you know that you have just one result). + */ + public function fetch(int $mode = StatementInterface::FETCH_ASSOC): array + { + $st = $this->run(); + try { + return $st->fetch($mode); + } finally { + $st->close(); + } + } /** * Request all results as array. */