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

Remove useless _Cache declarations/usages

parent 7374789f
......@@ -267,7 +267,7 @@ std::shared_ptr<Album> Album::create(DBConnection dbConnection, const std::strin
auto album = std::make_shared<Album>( title );
static const std::string req = "INSERT INTO " + policy::AlbumTable::Name +
"(id_album, title) VALUES(NULL, ?)";
if ( _Cache::insert( dbConnection, album, req, title ) == false )
if ( insert( dbConnection, album, req, title ) == false )
return nullptr;
album->m_dbConnection = dbConnection;
return album;
......@@ -278,7 +278,7 @@ std::shared_ptr<Album> Album::createUnknownAlbum( DBConnection dbConnection, con
auto album = std::make_shared<Album>( artist );
static const std::string req = "INSERT INTO " + policy::AlbumTable::Name +
"(id_album, artist_id) VALUES(NULL, ?)";
if ( _Cache::insert( dbConnection, album, req, artist->id() ) == false )
if ( insert( dbConnection, album, req, artist->id() ) == false )
return nullptr;
album->m_dbConnection = dbConnection;
return album;
......
......@@ -49,8 +49,6 @@ struct AlbumTable
class Album : public IAlbum, public DatabaseHelpers<Album, policy::AlbumTable>
{
using _Cache = DatabaseHelpers<Album, policy::AlbumTable>;
public:
Album( DBConnection dbConnection, sqlite::Row& row );
Album( const std::string& title );
......@@ -103,7 +101,6 @@ class Album : public IAlbum, public DatabaseHelpers<Album, policy::AlbumTable>
mutable bool m_tracksCached;
mutable std::mutex m_tracksLock;
friend _Cache;
friend struct policy::AlbumTable;
};
......
......@@ -102,7 +102,7 @@ std::shared_ptr<AlbumTrack> AlbumTrack::create(DBConnection dbConnection, unsign
auto self = std::make_shared<AlbumTrack>( media, trackNb, albumId, discNumber );
static const std::string req = "INSERT INTO " + policy::AlbumTrackTable::Name
+ "(media_id, track_number, album_id, disc_number) VALUES(?, ?, ?, ?)";
if ( _Cache::insert( dbConnection, self, req, media->id(), trackNb, albumId, discNumber ) == false )
if ( insert( dbConnection, self, req, media->id(), trackNb, albumId, discNumber ) == false )
return nullptr;
self->m_dbConnection = dbConnection;
return self;
......
......@@ -46,8 +46,6 @@ struct AlbumTrackTable
class AlbumTrack : public IAlbumTrack, public DatabaseHelpers<AlbumTrack, policy::AlbumTrackTable>
{
using _Cache = DatabaseHelpers<AlbumTrack, policy::AlbumTrackTable>;
public:
AlbumTrack( DBConnection dbConnection, sqlite::Row& row );
AlbumTrack(Media* media, unsigned int trackNumber, unsigned int albumId , unsigned int discNumber);
......@@ -80,7 +78,6 @@ class AlbumTrack : public IAlbumTrack, public DatabaseHelpers<AlbumTrack, policy
std::shared_ptr<Album> m_album;
friend _Cache;
friend struct policy::AlbumTrackTable;
};
......
......@@ -199,7 +199,7 @@ std::shared_ptr<Artist> Artist::create( DBConnection dbConnection, const std::st
auto artist = std::make_shared<Artist>( name );
static const std::string req = "INSERT INTO " + policy::ArtistTable::Name +
"(id_artist, name) VALUES(NULL, ?)";
if ( _Cache::insert( dbConnection, artist, req, name ) == false )
if ( insert( dbConnection, artist, req, name ) == false )
return nullptr;
artist->m_dbConnection = dbConnection;
return artist;
......
......@@ -42,9 +42,6 @@ struct ArtistTable
class Artist : public IArtist, public DatabaseHelpers<Artist, policy::ArtistTable>
{
private:
using _Cache = DatabaseHelpers<Artist, policy::ArtistTable>;
public:
Artist( DBConnection dbConnection, sqlite::Row& row );
Artist( const std::string& name );
......@@ -73,6 +70,5 @@ private:
std::string m_artworkUrl;
unsigned int m_nbAlbums;
friend _Cache;
friend struct policy::ArtistTable;
};
......@@ -116,7 +116,7 @@ std::shared_ptr<AudioTrack> AudioTrack::create( DBConnection dbConnection, const
static const std::string req = "INSERT INTO " + policy::AudioTrackTable::Name
+ "(codec, bitrate, samplerate, nb_channels, language, description, media_id) VALUES(?, ?, ?, ?, ?, ?, ?)";
auto track = std::make_shared<AudioTrack>( codec, bitrate, sampleRate, nbChannels, language, desc, mediaId );
if ( _Cache::insert( dbConnection, track, req, codec, bitrate, sampleRate, nbChannels, language, desc, mediaId ) == false )
if ( insert( dbConnection, track, req, codec, bitrate, sampleRate, nbChannels, language, desc, mediaId ) == false )
return nullptr;
track->m_dbConnection = dbConnection;
return track;
......
......@@ -41,8 +41,6 @@ struct AudioTrackTable
class AudioTrack : public IAudioTrack, public DatabaseHelpers<AudioTrack, policy::AudioTrackTable>
{
using _Cache = DatabaseHelpers<AudioTrack, policy::AudioTrackTable>;
public:
AudioTrack( DBConnection dbConnection, sqlite::Row& row );
AudioTrack(const std::string& codec, unsigned int bitrate, unsigned int sampleRate, unsigned int nbChannels, const std::string& language, const std::string& desc , unsigned int mediaId);
......@@ -71,7 +69,6 @@ class AudioTrack : public IAudioTrack, public DatabaseHelpers<AudioTrack, policy
std::string m_description;
unsigned int m_mediaId;
private:
friend struct policy::AudioTrackTable;
};
......
......@@ -72,7 +72,7 @@ std::shared_ptr<Folder> Folder::create( DBConnection connection, const std::stri
auto self = std::make_shared<Folder>( path, lastModificationDate, isRemovable, parentId );
static const std::string req = "INSERT INTO " + policy::FolderTable::Name +
"(path, id_parent, last_modification_date, is_removable) VALUES(?, ?, ?, ?)";
if ( _Cache::insert( connection, self, req, path, sqlite::ForeignKey( parentId ),
if ( insert( connection, self, req, path, sqlite::ForeignKey( parentId ),
lastModificationDate, isRemovable ) == false )
return nullptr;
self->m_dbConection = connection;
......
......@@ -47,8 +47,6 @@ struct FolderTable
class Folder : public IFolder, public DatabaseHelpers<Folder, policy::FolderTable>
{
using _Cache = DatabaseHelpers<Folder, policy::FolderTable>;
public:
Folder( DBConnection dbConnection, sqlite::Row& row );
Folder( const std::string& path, time_t lastModificationDate, bool isRemovable, unsigned int parent );
......@@ -76,6 +74,5 @@ private:
unsigned int m_lastModificationDate;
bool m_isRemovable;
friend _Cache;
friend struct policy::FolderTable;
};
......@@ -67,7 +67,7 @@ LabelPtr Label::create(DBConnection dbConnection, const std::string& name )
{
auto self = std::make_shared<Label>( name );
const char* req = "INSERT INTO Label VALUES(NULL, ?)";
if ( _Cache::insert( dbConnection, self, req, self->m_name ) == false )
if ( insert( dbConnection, self, req, self->m_name ) == false )
return nullptr;
self->m_dbConnection = dbConnection;
return self;
......
......@@ -52,8 +52,6 @@ struct LabelCachePolicy
class Label : public ILabel, public DatabaseHelpers<Label, policy::LabelTable>
{
using _Cache = DatabaseHelpers<Label, policy::LabelTable>;
public:
Label( DBConnection dbConnection, sqlite::Row& row );
Label( const std::string& name );
......@@ -70,7 +68,6 @@ class Label : public ILabel, public DatabaseHelpers<Label, policy::LabelTable>
unsigned int m_id;
std::string m_name;
friend _Cache;
friend struct policy::LabelTable;
};
......
......@@ -82,7 +82,7 @@ std::shared_ptr<Media> Media::create( DBConnection dbConnection, Type type, cons
static const std::string req = "INSERT INTO " + policy::MediaTable::Name +
"(type, mrl, folder_id, last_modification_date, title) VALUES(?, ?, ?, ?, ?)";
if ( _Cache::insert( dbConnection, self, req, type, self->m_mrl, sqlite::ForeignKey( folderId ),
if ( insert( dbConnection, self, req, type, self->m_mrl, sqlite::ForeignKey( folderId ),
self->m_lastModificationDate, self->m_title) == false )
return nullptr;
self->m_dbConnection = dbConnection;
......
......@@ -53,10 +53,7 @@ struct MediaTable
class Media : public IMedia, public DatabaseHelpers<Media, policy::MediaTable>
{
private:
using _Cache = DatabaseHelpers<Media, policy::MediaTable>;
public:
// Those should be private, however the standard states that the expression
// ::new (pv) T(std::forward(args)...)
// shall be well-formed, and private constructor would prevent that.
......@@ -129,7 +126,6 @@ class Media : public IMedia, public DatabaseHelpers<Media, policy::MediaTable>
ShowEpisodePtr m_showEpisode;
MoviePtr m_movie;
friend _Cache;
friend struct policy::MediaTable;
};
......
......@@ -143,7 +143,7 @@ std::shared_ptr<Movie> Movie::create(DBConnection dbConnection, const std::strin
auto movie = std::make_shared<Movie>( title );
static const std::string req = "INSERT INTO " + policy::MovieTable::Name
+ "(title) VALUES(?)";
if ( _Cache::insert( dbConnection, movie, req, title ) == false )
if ( insert( dbConnection, movie, req, title ) == false )
return nullptr;
movie->m_dbConnection = dbConnection;
return movie;
......
......@@ -41,8 +41,6 @@ struct MovieTable
class Movie : public IMovie, public DatabaseHelpers<Movie, policy::MovieTable>
{
using _Cache = DatabaseHelpers<Movie, policy::MovieTable>;
public:
Movie( DBConnection dbConnection, sqlite::Row& row );
Movie( const std::string& title );
......
......@@ -154,7 +154,7 @@ std::shared_ptr<Show> Show::create(DBConnection dbConnection, const std::string&
auto show = std::make_shared<Show>( name );
static const std::string req = "INSERT INTO " + policy::ShowTable::Name
+ "(name) VALUES(?)";
if ( _Cache::insert( dbConnection, show, req, name ) == false )
if ( insert( dbConnection, show, req, name ) == false )
return nullptr;
show->m_dbConnection = dbConnection;
return show;
......
......@@ -44,8 +44,6 @@ struct ShowTable
class Show : public IShow, public DatabaseHelpers<Show, policy::ShowTable>
{
using _Cache = DatabaseHelpers<Show, policy::ShowTable>;
public:
Show( DBConnection dbConnection, sqlite::Row& row );
Show( const std::string& name );
......@@ -77,7 +75,6 @@ class Show : public IShow, public DatabaseHelpers<Show, policy::ShowTable>
time_t m_lastSyncDate;
std::string m_tvdbId;
friend _Cache;
friend struct policy::ShowTable;
};
......
......@@ -171,7 +171,7 @@ std::shared_ptr<ShowEpisode> ShowEpisode::create( DBConnection dbConnection, con
auto episode = std::make_shared<ShowEpisode>( title, episodeNumber, showId );
static const std::string req = "INSERT INTO " + policy::ShowEpisodeTable::Name
+ "(episode_number, title, show_id) VALUES(? , ?, ?)";
if ( _Cache::insert( dbConnection, episode, req, episodeNumber, title, showId ) == false )
if ( insert( dbConnection, episode, req, episodeNumber, title, showId ) == false )
return nullptr;
episode->m_dbConnection = dbConnection;
return episode;
......
......@@ -45,8 +45,6 @@ struct ShowEpisodeTable
class ShowEpisode : public IShowEpisode, public DatabaseHelpers<ShowEpisode, policy::ShowEpisodeTable>
{
using _Cache = DatabaseHelpers<ShowEpisode, policy::ShowEpisodeTable>;
public:
ShowEpisode( DBConnection dbConnection, sqlite::Row& row );
ShowEpisode(const std::string& name, unsigned int episodeNumber, unsigned int showId );
......@@ -82,7 +80,6 @@ class ShowEpisode : public IShowEpisode, public DatabaseHelpers<ShowEpisode, pol
unsigned int m_showId;
ShowPtr m_show;
friend _Cache;
friend struct policy::ShowEpisodeTable;
};
......
......@@ -79,7 +79,7 @@ std::shared_ptr<VideoTrack> VideoTrack::create( DBConnection dbConnection, const
static const std::string req = "INSERT INTO " + policy::VideoTrackTable::Name
+ "(codec, width, height, fps, media_id) VALUES(?, ?, ?, ?, ?)";
auto track = std::make_shared<VideoTrack>( codec, width, height, fps, mediaId );
if ( _Cache::insert( dbConnection, track, req, codec, width, height, fps, mediaId ) == false )
if ( insert( dbConnection, track, req, codec, width, height, fps, mediaId ) == false )
return nullptr;
track->m_dbConnection = dbConnection;
return track;
......
......@@ -42,8 +42,6 @@ struct VideoTrackTable
class VideoTrack : public IVideoTrack, public DatabaseHelpers<VideoTrack, policy::VideoTrackTable>
{
using _Cache = DatabaseHelpers<VideoTrack, policy::VideoTrackTable>;
public:
VideoTrack( DBConnection dbConnection, sqlite::Row& row );
VideoTrack( const std::string& codec, unsigned int width, unsigned int height, float fps, unsigned int mediaId );
......
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