WIP, Using table for filters in Audio Widget

This commit is contained in:
emeric
2014-05-20 19:06:29 +02:00
parent df74634014
commit eadb0fbec3
7 changed files with 183 additions and 319 deletions
+1 -1
View File
@@ -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);
}
+5 -2
View File
@@ -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);
+6
View File
@@ -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);
}