[DB] Use a single shared pool of connections to the database

This commit is contained in:
emeric
2015-08-19 13:31:50 +02:00
parent 4b35e03ef8
commit e18221689f
23 changed files with 89 additions and 62 deletions
+5 -4
View File
@@ -63,13 +63,13 @@ bool agentIsMobile()
namespace UserInterface {
Wt::WApplication*
LmsApplication::create(const Wt::WEnvironment& env, boost::filesystem::path dbPath)
LmsApplication::create(const Wt::WEnvironment& env, Wt::Dbo::SqlConnectionPool& connectionPool)
{
/*
* You could read information from the environment to decide whether
* the user has permission to start a new application
*/
return new LmsApplication(env, dbPath);
return new LmsApplication(env, connectionPool);
}
LmsApplication*
@@ -84,9 +84,9 @@ LmsApplication::instance()
* constructor so it is typically also an argument for your custom
* application constructor.
*/
LmsApplication::LmsApplication(const Wt::WEnvironment& env, boost::filesystem::path dbPath)
LmsApplication::LmsApplication(const Wt::WEnvironment& env, Wt::Dbo::SqlConnectionPool& connectionPool)
: Wt::WApplication(env),
_db(dbPath),
_db(connectionPool),
_coverResource(nullptr)
{
@@ -182,6 +182,7 @@ LmsApplication::handleAuthEvent(void)
Wt::WStackedWidget *contentsStack = new Wt::WStackedWidget();
contentsStack->setOverflow(Wt::WContainerWidget::OverflowAuto);
contentsStack->addStyleClass("contents");
// Setup a Left-aligned menu.
Wt::WMenu *leftMenu = new Wt::WMenu(contentsStack);