mirror of
https://github.com/pocoproject/poco.git
synced 2025-05-02 15:41:36 +02: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
|
// 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):
|
MySQLTest::MySQLTest(const std::string& name):
|
||||||
|
@ -230,7 +230,7 @@ public:
|
|||||||
static std::string uri(const std::string& connector,
|
static std::string uri(const std::string& connector,
|
||||||
const std::string& connectionString);
|
const std::string& connectionString);
|
||||||
/// Utility function that teturns the URI formatted from supplied
|
/// 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);
|
void setFeature(const std::string& name, bool state);
|
||||||
/// Set the state of a feature.
|
/// Set the state of a feature.
|
||||||
|
@ -138,7 +138,7 @@ public:
|
|||||||
|
|
||||||
static std::string name(const std::string& connector,
|
static std::string name(const std::string& connector,
|
||||||
const std::string& connectionString);
|
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);
|
void setFeature(const std::string& name, bool state);
|
||||||
/// Sets feature for all the sessions.
|
/// Sets feature for all the sessions.
|
||||||
|
@ -37,6 +37,8 @@
|
|||||||
#include "Poco/Data/SessionPoolContainer.h"
|
#include "Poco/Data/SessionPoolContainer.h"
|
||||||
#include "Poco/Data/SessionFactory.h"
|
#include "Poco/Data/SessionFactory.h"
|
||||||
#include "Poco/Data/DataException.h"
|
#include "Poco/Data/DataException.h"
|
||||||
|
#include "Poco/URI.h"
|
||||||
|
#include "Poco/String.h"
|
||||||
#include "Poco/Exception.h"
|
#include "Poco/Exception.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
@ -91,8 +93,12 @@ Session SessionPoolContainer::add(const std::string& sessionKey,
|
|||||||
|
|
||||||
Session SessionPoolContainer::get(const std::string& name)
|
Session SessionPoolContainer::get(const std::string& name)
|
||||||
{
|
{
|
||||||
SessionPoolMap::Iterator it = _sessionPools.find(name);
|
URI uri(name);
|
||||||
if (_sessionPools.end() == it) throw NotFoundException(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();
|
return it->second->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user