SessionPoolContainer::get() fix

few documentation fixes
consolidated redundant MySQL connection params
This commit is contained in:
Aleksandar Fabijanic 2009-01-15 17:01:34 +00:00
parent b38f5ce99c
commit 363711ed39
4 changed files with 14 additions and 5 deletions

View File

@ -69,7 +69,10 @@ Poco::SharedPtr<SQLExecutor> MySQLTest::_pExecutor = 0;
//
// Connection string to POCO
std::string MySQLTest::_dbConnString = "user=root;password=;db=test;compress=true;auto-reconnect=true";
std::string MySQLTest::_dbConnString = "user=" MYSQL_USER
";password=" MYSQL_PWD
";db=" MYSQL_DB
";compress=true;auto-reconnect=true";
MySQLTest::MySQLTest(const std::string& name):

View File

@ -230,7 +230,7 @@ public:
static std::string uri(const std::string& connector,
const std::string& connectionString);
/// Utility function that teturns the URI formatted from supplied
/// arguments as "connector://connectionString".
/// arguments as "connector:///connectionString".
void setFeature(const std::string& name, bool state);
/// Set the state of a feature.

View File

@ -138,7 +138,7 @@ public:
static std::string name(const std::string& connector,
const std::string& connectionString);
/// Returns the name formatted from supplied arguments as "connector://connectionString".
/// Returns the name formatted from supplied arguments as "connector:///connectionString".
void setFeature(const std::string& name, bool state);
/// Sets feature for all the sessions.

View File

@ -37,6 +37,8 @@
#include "Poco/Data/SessionPoolContainer.h"
#include "Poco/Data/SessionFactory.h"
#include "Poco/Data/DataException.h"
#include "Poco/URI.h"
#include "Poco/String.h"
#include "Poco/Exception.h"
#include <algorithm>
@ -91,8 +93,12 @@ Session SessionPoolContainer::add(const std::string& sessionKey,
Session SessionPoolContainer::get(const std::string& name)
{
SessionPoolMap::Iterator it = _sessionPools.find(name);
if (_sessionPools.end() == it) throw NotFoundException(name);
URI uri(name);
std::string path = uri.getPath();
poco_assert (!path.empty());
std::string n = Session::uri(uri.getScheme(), path.substr(1));
SessionPoolMap::Iterator it = _sessionPools.find(n);
if (_sessionPools.end() == it) throw NotFoundException(n);
return it->second->get();
}