diff --git a/lib/Query/DataQuery.php b/lib/Query/DataQuery.php index ea33803..4203182 100644 --- a/lib/Query/DataQuery.php +++ b/lib/Query/DataQuery.php @@ -4,6 +4,8 @@ * * @copyright 2021 Marcin Łojewski * @author Marcin Łojewski + * @copyright 2025 Claus-Justus Heine + * @author Claus-Justus Heine * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -21,6 +23,8 @@ namespace OCA\UserSQL\Query; +use UnexpectedValueException; + use Doctrine\DBAL\Driver\Statement; use Doctrine\DBAL\Exception as DBALException; use OC\DB\Connection; @@ -151,6 +155,10 @@ class DataQuery "driverOptions" => array() ); + if (empty($this->properties[DB::DRIVER])) { + throw new UnexpectedValueException('Attempt to connect without configuration.'); + } + if ($this->properties[DB::DRIVER] == 'mysql') { if ($this->properties[DB::SSL_CA]) { $parameters["driverOptions"][\PDO::MYSQL_ATTR_SSL_CA] = \OC::$SERVERROOT . '/' . $this->properties[DB::SSL_CA];