Commit 061c62ef authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Use INNER JOIN rather than LEFT JOIN

parent 3a6ad48a
......@@ -139,7 +139,7 @@ std::vector<MediaPtr> Album::tracks() const
// This doesn't return the cached version, because it would be fairly complicated, if not impossible or
// counter productive, to maintain a cache that respects all orderings.
static const std::string req = "SELECT med.* FROM " + policy::MediaTable::Name + " med "
" LEFT JOIN " + policy::AlbumTrackTable::Name + " att ON att.media_id = med.id_media "
" INNER JOIN " + policy::AlbumTrackTable::Name + " att ON att.media_id = med.id_media "
" WHERE att.album_id = ? AND med.is_present = 1 ORDER BY att.disc_number, att.track_number";
return Media::fetchAll<IMedia>( m_dbConnection, req, m_id );
}
......@@ -215,7 +215,7 @@ bool Album::setAlbumArtist( Artist* artist )
std::vector<ArtistPtr> Album::artists() const
{
static const std::string req = "SELECT art.* FROM " + policy::ArtistTable::Name + " art "
"LEFT JOIN AlbumArtistRelation aar ON aar.artist_id = art.id_artist "
"INNER JOIN AlbumArtistRelation aar ON aar.artist_id = art.id_artist "
"WHERE aar.album_id = ?";
return Artist::fetchAll<IArtist>( m_dbConnection, req, m_id );
}
......
......@@ -89,7 +89,7 @@ std::vector<AlbumPtr> Artist::albums() const
std::vector<MediaPtr> Artist::media() const
{
static const std::string req = "SELECT med.* FROM " + policy::MediaTable::Name + " med "
"LEFT JOIN MediaArtistRelation mar ON mar.media_id = med.id_media "
"INNER JOIN MediaArtistRelation mar ON mar.media_id = med.id_media "
"WHERE mar.artist_id = ? AND med.is_present = 1";
return Media::fetchAll<IMedia>( m_dbConnection, req, m_id );
}
......
......@@ -58,7 +58,7 @@ const std::string& Label::name() const
std::vector<MediaPtr> Label::files()
{
static const std::string req = "SELECT f.* FROM " + policy::MediaTable::Name + " f "
"LEFT JOIN LabelFileRelation lfr ON lfr.media_id = f.id_media "
"INNER JOIN LabelFileRelation lfr ON lfr.media_id = f.id_media "
"WHERE lfr.label_id = ?";
return Media::fetchAll<IMedia>( m_dbConnection, req, m_id );
}
......
......@@ -144,7 +144,7 @@ void Media::setShowEpisode( ShowEpisodePtr episode )
std::vector<LabelPtr> Media::labels()
{
static const std::string req = "SELECT l.* FROM " + policy::LabelTable::Name + " l "
"LEFT JOIN LabelFileRelation lfr ON lfr.label_id = l.id_label "
"INNER JOIN LabelFileRelation lfr ON lfr.label_id = l.id_label "
"WHERE lfr.media_id = ?";
return Label::fetchAll<ILabel>( m_dbConnection, req, m_id );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment