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.
This commit is contained in:
Mike Colagrosso 2024-09-17 17:49:30 -06:00 committed by Alex Cabal
parent 7d8cfd351e
commit 59eee3cc57

View file

@ -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){