Use 'insert ... returning' instead of 'Db::GetLastInsertedId()'

This commit is contained in:
Alex Cabal 2025-03-10 11:04:20 -05:00
parent 4446b6d161
commit 5066252355
12 changed files with 44 additions and 57 deletions

View file

@ -1777,7 +1777,7 @@ final class Ebook{
throw $error;
}
Db::Query('
$this->EbookId = Db::QueryInt('
INSERT into Ebooks (Identifier, WwwFilesystemPath, RepoFilesystemPath, KindleCoverUrl, EpubUrl,
AdvancedEpubUrl, KepubUrl, Azw3Url, DistCoverUrl, Title, FullTitle, AlternateTitle,
Description, LongDescription, Language, WordCount, ReadingEase, GitHubUrl, WikipediaUrl,
@ -1808,6 +1808,7 @@ final class Ebook{
?,
?,
?)
returning EbookId
', [$this->Identifier, $this->WwwFilesystemPath, $this->RepoFilesystemPath, $this->KindleCoverUrl, $this->EpubUrl,
$this->AdvancedEpubUrl, $this->KepubUrl, $this->Azw3Url, $this->DistCoverUrl, $this->Title,
$this->FullTitle, $this->AlternateTitle, $this->Description, $this->LongDescription,
@ -1815,8 +1816,6 @@ final class Ebook{
$this->EbookCreated, $this->EbookUpdated, $this->TextSinglePageByteCount, $this->IndexableText,
$this->IndexableAuthors, $this->IndexableCollections]);
$this->EbookId = Db::GetLastInsertedId();
try{
$this->AddTags();
$this->AddLocSubjects();