Fixed bad access since some tracks may be duplicated in the database
This commit is contained in:
@@ -152,13 +152,15 @@ Track::getById(Session& session, IdType id)
|
||||
.where("id = ?").bind(id);
|
||||
}
|
||||
|
||||
Track::pointer
|
||||
std::vector<Track::pointer>
|
||||
Track::getByRecordingMBID(Session& session, const UUID& mbid)
|
||||
{
|
||||
session.checkSharedLocked();
|
||||
|
||||
return session.getDboSession().find<Track>()
|
||||
Wt::Dbo::collection<Track::pointer> res = session.getDboSession().find<Track>()
|
||||
.where("recording_mbid = ?").bind(std::string {mbid.getAsString()});
|
||||
|
||||
return std::vector<Track::pointer>(res.begin(), res.end());
|
||||
}
|
||||
|
||||
Track::pointer
|
||||
|
||||
@@ -62,7 +62,7 @@ class Track : public Wt::Dbo::Dbo<Track>
|
||||
static std::size_t getCount(Session& session);
|
||||
static pointer getByPath(Session& session, const std::filesystem::path& p);
|
||||
static pointer getById(Session& session, IdType id);
|
||||
static pointer getByRecordingMBID(Session& session, const UUID& MBID);
|
||||
static std::vector<pointer> getByRecordingMBID(Session& session, const UUID& MBID);
|
||||
static std::vector<pointer> getSimilarTracks(Session& session,
|
||||
const std::unordered_set<IdType>& trackIds,
|
||||
std::optional<std::size_t> offset = {},
|
||||
|
||||
Reference in New Issue
Block a user