mirror of
https://github.com/pocoproject/poco.git
synced 2025-03-04 07:27:23 +01:00
SessionPoolContainer::get() fix
few documentation fixes consolidated redundant MySQL connection params
This commit is contained in:
parent
b38f5ce99c
commit
363711ed39
@ -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):
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user