From 59eee3cc57431d5fcd495b8a5769a62c5cef26b8 Mon Sep 17 00:00:00 2001 From: Mike Colagrosso Date: Tue, 17 Sep 2024 17:49:30 -0600 Subject: [PATCH] Explicitly set sort order for sources, contributors, and toc entries This is just to avoid any future undefined behavior. The current DB table implementation returns these rows in insertion order, but it might not be wise to depend on that. Either way, the result sets of these queries are small and can be sorted quickly. --- lib/Ebook.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Ebook.php b/lib/Ebook.php index 25666390..efb26b40 100644 --- a/lib/Ebook.php +++ b/lib/Ebook.php @@ -193,6 +193,7 @@ class Ebook{ SELECT * from EbookSources where EbookId = ? + order by EbookSourceId ', [$this->EbookId], EbookSource::class); } @@ -209,6 +210,7 @@ class Ebook{ from Contributors where EbookId = ? and MarcRole = ? + order by ContributorId ', [$this->EbookId, 'aut'], Contributor::class); } @@ -225,6 +227,7 @@ class Ebook{ from Contributors where EbookId = ? and MarcRole = ? + order by ContributorId ', [$this->EbookId, 'ill'], Contributor::class); } @@ -241,6 +244,7 @@ class Ebook{ from Contributors where EbookId = ? and MarcRole = ? + order by ContributorId ', [$this->EbookId, 'trl'], Contributor::class); } @@ -257,6 +261,7 @@ class Ebook{ from Contributors where EbookId = ? and MarcRole = ? + order by ContributorId ', [$this->EbookId, 'ctb'], Contributor::class); } @@ -274,6 +279,7 @@ class Ebook{ SELECT * from TocEntries where EbookId = ? + order by TocEntryId ', [$this->EbookId], stdClass::class); foreach($result as $row){