WIP, Using table for filters in Audio Widget
This commit is contained in:
+1
-1
@@ -31,7 +31,7 @@ Artist::getNone(Wt::Dbo::Session& session)
|
||||
}
|
||||
|
||||
Wt::Dbo::collection<Artist::pointer>
|
||||
Artist::getAll(Wt::Dbo::Session& session, std::size_t offset, std::size_t size)
|
||||
Artist::getAll(Wt::Dbo::Session& session, int offset, int size)
|
||||
{
|
||||
return session.find<Artist>().offset(offset).limit(size);
|
||||
}
|
||||
|
||||
@@ -20,14 +20,15 @@ class Artist
|
||||
public:
|
||||
|
||||
typedef Wt::Dbo::ptr<Artist> pointer;
|
||||
|
||||
typedef Wt::Dbo::dbo_traits<Artist>::IdType id_type;
|
||||
|
||||
Artist() {}
|
||||
Artist(const std::string& p_name);
|
||||
|
||||
// Accessors
|
||||
static pointer getByName(Wt::Dbo::Session& session, const std::string& name);
|
||||
static pointer getNone(Wt::Dbo::Session& session);
|
||||
static Wt::Dbo::collection<pointer> getAll(Wt::Dbo::Session& session, std::size_t offset, std::size_t size);
|
||||
static Wt::Dbo::collection<pointer> getAll(Wt::Dbo::Session& session, int offset = -1, int size = -1);
|
||||
|
||||
const std::string& getName(void) const { return _name; }
|
||||
|
||||
@@ -66,6 +67,8 @@ class Release
|
||||
static pointer getByName(Wt::Dbo::Session& session, const std::string& name);
|
||||
static pointer getNone(Wt::Dbo::Session& session);
|
||||
|
||||
static Wt::Dbo::collection<pointer> getAll(Wt::Dbo::Session& session, Artist::id_type id, int offset = -1, int size = -1);
|
||||
|
||||
// Create
|
||||
static pointer create(Wt::Dbo::Session& session, const std::string& name);
|
||||
|
||||
|
||||
@@ -27,3 +27,9 @@ Release::create(Wt::Dbo::Session& session, const std::string& name)
|
||||
return session.add(new Release(name));
|
||||
}
|
||||
|
||||
Wt::Dbo::collection<Release::pointer>
|
||||
Release::getAll(Wt::Dbo::Session& session, Artist::id_type id, int offset, int size)
|
||||
{
|
||||
return session.query<Release::pointer>("select * from Release INNER JOIN Release.id = Artist.id").where("artist.id = ?").bind(id);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user