Skip to content

Commit ba1ee9c

Browse files
authored
Merge pull request #821 from utopia-php/feat-sum-and-count-exceptions
2 parents 396aea4 + 376f588 commit ba1ee9c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/Database/Adapter/SQL.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3273,7 +3273,11 @@ public function count(Document $collection, array $queries = [], ?int $max = nul
32733273
$stmt->bindValue($key, $value, $this->getPDOType($value));
32743274
}
32753275

3276-
$this->execute($stmt);
3276+
try {
3277+
$this->execute($stmt);
3278+
} catch (PDOException $e) {
3279+
throw $this->processException($e);
3280+
}
32773281

32783282
$result = $stmt->fetchAll();
32793283
$stmt->closeCursor();
@@ -3355,7 +3359,11 @@ public function sum(Document $collection, string $attribute, array $queries = []
33553359
$stmt->bindValue($key, $value, $this->getPDOType($value));
33563360
}
33573361

3358-
$this->execute($stmt);
3362+
try {
3363+
$this->execute($stmt);
3364+
} catch (PDOException $e) {
3365+
throw $this->processException($e);
3366+
}
33593367

33603368
$result = $stmt->fetchAll();
33613369
$stmt->closeCursor();

0 commit comments

Comments
 (0)