Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions src/Database/Adapter/MariaDB.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -654,7 +654,11 @@ public function createDocument(string $collection, Document $document): Document
$columns = '';
$columnNames = '';

$this->getPDO()->beginTransaction();
try {
$this->getPDO()->beginTransaction();
} catch (PDOException $e) {
$this->getPDO()->rollBack();
}

/**
* Insert Attributes
Expand DownExpand Up@@ -798,7 +802,11 @@ public function updateDocument(string $collection, Document $document): Document
return $carry;
}, $initial);

$this->getPDO()->beginTransaction();
try {
$this->getPDO()->beginTransaction();
} catch (PDOException $e) {
$this->getPDO()->rollBack();
}

/**
* Get removed Permissions
Expand DownExpand Up@@ -1005,7 +1013,11 @@ public function deleteDocument(string $collection, string $id): bool
{
$name = $this->filter($collection);

$this->getPDO()->beginTransaction();
try {
$this->getPDO()->beginTransaction();
} catch (PDOException $e) {
$this->getPDO()->rollBack();
}

$sql = "
DELETE FROM {$this->getSQLTable($name)}
Expand Down
24 changes: 20 additions & 4 deletions src/Database/Adapter/SQLite.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -110,7 +110,11 @@ public function createCollection(string $name, array $attributes = [], array $in
$namespace = $this->getNamespace();
$id = $this->filter($name);

$this->getPDO()->beginTransaction();
try {
$this->getPDO()->beginTransaction();
} catch (PDOException $e) {
$this->getPDO()->rollBack();
}

/** @var array<string> $attributeStrings */
$attributeStrings = [];
Expand DownExpand Up@@ -228,7 +232,11 @@ public function deleteCollection(string $id): bool
{
$id = $this->filter($id);

$this->getPDO()->beginTransaction();
try {
$this->getPDO()->beginTransaction();
} catch (PDOException $e) {
$this->getPDO()->rollBack();
}

$sql = "DROP TABLE `{$this->getNamespace()}_{$id}`";
$sql = $this->trigger(Database::EVENT_COLLECTION_DELETE, $sql);
Expand DownExpand Up@@ -424,7 +432,11 @@ public function createDocument(string $collection, Document $document): Document
$columns = ['_uid'];
$values = ['_uid'];

$this->getPDO()->beginTransaction();
try {
$this->getPDO()->beginTransaction();
} catch (PDOException $e) {
$this->getPDO()->rollBack();
}

/**
* Insert Attributes
Expand DownExpand Up@@ -567,7 +579,11 @@ public function updateDocument(string $collection, Document $document): Document
return $carry;
}, $initial);

$this->getPDO()->beginTransaction();
try {
$this->getPDO()->beginTransaction();
} catch (PDOException $e) {
$this->getPDO()->rollBack();
}

/**
* Get removed Permissions
Expand Down