Skip to content

Commit 00ad886

Browse files
authored
Merge pull request #526 from utopia-php/check-last-insert
Check last insert
2 parents 0eed7f1 + 895ce2c commit 00ad886

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Database/Adapter/MariaDB.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,10 @@ public function createDocument(string $collection, Document $document): Document
950950

951951
$document['$internalId'] = $this->getDocument($collection, $document->getId(), [Query::select(['$internalId'])])->getInternalId();
952952

953+
if (empty($document['$internalId'])) {
954+
throw new DatabaseException('Error creating document empty "$internalId"');
955+
}
956+
953957
if (isset($stmtPermissions)) {
954958
$stmtPermissions->execute();
955959
}

0 commit comments

Comments
 (0)