Fixed bad MediaLibrary::getCount()
This commit is contained in:
@@ -43,7 +43,7 @@ namespace Database
|
|||||||
{
|
{
|
||||||
session.checkReadTransaction();
|
session.checkReadTransaction();
|
||||||
|
|
||||||
return session.getDboSession().query<int>("SELECT COUNT(*) FROM cluster");
|
return session.getDboSession().query<int>("SELECT COUNT(*) FROM media_library");
|
||||||
}
|
}
|
||||||
|
|
||||||
MediaLibrary::pointer MediaLibrary::find(Session& session, MediaLibraryId id)
|
MediaLibrary::pointer MediaLibrary::find(Session& session, MediaLibraryId id)
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
@@ -38,7 +40,7 @@ namespace Database
|
|||||||
MediaLibrary() = default;
|
MediaLibrary() = default;
|
||||||
|
|
||||||
// find
|
// find
|
||||||
std::size_t getCount(Session& session);
|
static std::size_t getCount(Session& session);
|
||||||
static pointer find(Session& session, MediaLibraryId id);
|
static pointer find(Session& session, MediaLibraryId id);
|
||||||
static pointer find(Session& session, std::string_view name);
|
static pointer find(Session& session, std::string_view name);
|
||||||
static pointer find(Session& session, const std::filesystem::path& path);
|
static pointer find(Session& session, const std::filesystem::path& path);
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include "database/Cluster.hpp"
|
#include "database/Cluster.hpp"
|
||||||
#include "database/Db.hpp"
|
#include "database/Db.hpp"
|
||||||
#include "database/Listen.hpp"
|
#include "database/Listen.hpp"
|
||||||
|
#include "database/MediaLibrary.hpp"
|
||||||
#include "database/Release.hpp"
|
#include "database/Release.hpp"
|
||||||
#include "database/Session.hpp"
|
#include "database/Session.hpp"
|
||||||
#include "database/StarredArtist.hpp"
|
#include "database/StarredArtist.hpp"
|
||||||
@@ -77,6 +78,7 @@ void DatabaseFixture::testDatabaseEmpty()
|
|||||||
EXPECT_EQ(Cluster::getCount(session), 0);
|
EXPECT_EQ(Cluster::getCount(session), 0);
|
||||||
EXPECT_EQ(ClusterType::getCount(session), 0);
|
EXPECT_EQ(ClusterType::getCount(session), 0);
|
||||||
EXPECT_EQ(Listen::getCount(session), 0);
|
EXPECT_EQ(Listen::getCount(session), 0);
|
||||||
|
EXPECT_EQ(MediaLibrary::getCount(session), 0);
|
||||||
EXPECT_EQ(Release::getCount(session), 0);
|
EXPECT_EQ(Release::getCount(session), 0);
|
||||||
EXPECT_EQ(StarredArtist::getCount(session), 0);
|
EXPECT_EQ(StarredArtist::getCount(session), 0);
|
||||||
EXPECT_EQ(StarredRelease::getCount(session), 0);
|
EXPECT_EQ(StarredRelease::getCount(session), 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user