From 26930efc255d191fbebf0d9a15650c4a07540480 Mon Sep 17 00:00:00 2001 From: Claus-Justus Heine Date: Fri, 16 Jun 2023 10:06:28 +0200 Subject: [PATCH] DateQuery: use try-catch around statement prepare. Signed-off-by: Claus-Justus Heine --- lib/Query/DataQuery.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/Query/DataQuery.php b/lib/Query/DataQuery.php index 2f11c55..81e01c6 100644 --- a/lib/Query/DataQuery.php +++ b/lib/Query/DataQuery.php @@ -109,7 +109,15 @@ class DataQuery } $query = $this->queryProvider[$queryName]; - $result = $this->connection->prepare($query, $limit, $offset); + try { + $result = $this->connection->prepare($query, $limit, $offset); + } catch (DBALException $exception) { + $this->logger->error( + "Could not prepare the query: " . $exception->getMessage(), + ["app" => $this->appName] + ); + return false; + } foreach ($params as $param => $value) { $result->bindValue(":" . $param, $value);