diff --git a/src/Database/Adapter/MariaDB.php b/src/Database/Adapter/MariaDB.php index 7aed62094..e85cd236c 100644 --- a/src/Database/Adapter/MariaDB.php +++ b/src/Database/Adapter/MariaDB.php @@ -314,8 +314,7 @@ public function createAttribute(string $collection, string $id, string $type, in ->prepare($sql) ->execute(); } catch (PDOException $e) { - $this->processException($e); - return false; + throw $this->processException($e); } } diff --git a/src/Database/Adapter/Mongo.php b/src/Database/Adapter/Mongo.php index 8a8706a58..ba84b942a 100644 --- a/src/Database/Adapter/Mongo.php +++ b/src/Database/Adapter/Mongo.php @@ -1059,7 +1059,7 @@ public function find(string $collection, array $queries = [], ?int $limit = 25, try { $results = $this->client->find($name, $filters, $options)->cursor->firstBatch ?? []; } catch (MongoException $e) { - $this->processException($e); + throw $this->processException($e); } if (empty($results)) { diff --git a/src/Database/Adapter/Postgres.php b/src/Database/Adapter/Postgres.php index a6d4a9b7b..bb75b23c5 100644 --- a/src/Database/Adapter/Postgres.php +++ b/src/Database/Adapter/Postgres.php @@ -300,8 +300,7 @@ public function createAttribute(string $collection, string $id, string $type, in ->prepare($sql) ->execute(); } catch (PDOException $e) { - $this->processException($e); - return false; + throw $this->processException($e); } } @@ -1661,6 +1660,7 @@ public function deleteDocument(string $collection, string $id): bool * @return array * @throws DatabaseException * @throws TimeoutException + * @throws Exception */ public function find(string $collection, array $queries = [], ?int $limit = 25, ?int $offset = null, array $orderAttributes = [], array $orderTypes = [], array $cursor = [], string $cursorDirection = Database::CURSOR_AFTER): array { @@ -1804,7 +1804,7 @@ public function find(string $collection, array $queries = [], ?int $limit = 25, try { $stmt->execute(); } catch (PDOException $e) { - $this->processException($e); + throw $this->processException($e); } $results = $stmt->fetchAll(); diff --git a/tests/e2e/Adapter/Base.php b/tests/e2e/Adapter/Base.php index a2aea9b30..eabcb5d0d 100644 --- a/tests/e2e/Adapter/Base.php +++ b/tests/e2e/Adapter/Base.php @@ -989,10 +989,21 @@ public function testQueryTimeout(): void if (!$this->getDatabase()->getAdapter()->getSupportForTimeouts()) { $this->expectNotToPerformAssertions(); } + static::getDatabase()->createCollection('global-timeouts'); - $this->assertEquals(true, static::getDatabase()->createAttribute('global-timeouts', 'longtext', Database::VAR_STRING, 100000000, true)); - for ($i = 0 ; $i <= 200 ; $i++) { + $this->assertEquals( + true, + static::getDatabase()->createAttribute( + collection: 'global-timeouts', + id: 'longtext', + type: Database::VAR_STRING, + size: 100000000, + required: true + ) + ); + + for ($i = 0 ; $i <= 20 ; $i++) { static::getDatabase()->createDocument('global-timeouts', new Document([ 'longtext' => file_get_contents(__DIR__ . '/../../resources/longtext.txt'), '$permissions' => [