mirror of
https://github.com/pocoproject/poco.git
synced 2025-02-20 22:31:23 +01:00
serialize SessionPoolContainer access
This commit is contained in:
parent
5eb44ce36b
commit
10bdb05987
@ -82,12 +82,12 @@ std::string ODBCOracleTest::_connectString = "DRIVER={" ORACLE_ODBC_DRI
|
||||
"DBQ=" ORACLE_SERVER ":" ORACLE_PORT "/" ORACLE_SID ";"
|
||||
"UID=" ORACLE_UID ";"
|
||||
"PWD=" ORACLE_PWD ";"
|
||||
"TLO=O;" //?
|
||||
"TLO=O;" // translation option
|
||||
"FBS=60000;" // fetch buffer size (bytes), default 60000
|
||||
"FWC=F;" // force SQL_WCHAR support (T/F), default F
|
||||
"CSR=F;" // close cursor (T/F), default F
|
||||
"MDI=Me;" // metadata (SQL_ATTR_METADATA_ID) ID default (T/F), default T
|
||||
"MTS=T;" //?
|
||||
"MDI=T;" // metadata ID (SQL_ATTR_METADATA_ID) (T/F), default T
|
||||
"MTS=F;" // Microsoft Transaction Server support (T/F)
|
||||
"DPM=F;" // disable SQLDescribeParam (T/F), default F
|
||||
"NUM=NLS;" // numeric settings (NLS implies Globalization Support)
|
||||
"BAM=IfAllSuccessful;" // batch autocommit, (IfAllSuccessful/UpToFirstFailure/AllSuccessful), default IfAllSuccessful
|
||||
@ -101,7 +101,7 @@ std::string ODBCOracleTest::_connectString = "DRIVER={" ORACLE_ODBC_DRI
|
||||
"XSM=Default;" // schema field (Default/Database/Owner), default Default
|
||||
"EXC=F;" // EXEC syntax (T/F), default F
|
||||
"APA=T;" // thread safety (T/F), default T
|
||||
"DBA=W;"; // write access
|
||||
"DBA=W;"; // write access (R/W)
|
||||
|
||||
const std::string ODBCOracleTest::MULTI_INSERT =
|
||||
"BEGIN "
|
||||
|
@ -62,9 +62,9 @@ SessionPoolContainer::~SessionPoolContainer()
|
||||
|
||||
void SessionPoolContainer::add(SessionPool* pPool)
|
||||
{
|
||||
FastMutex::ScopedLock lock(_mutex);
|
||||
poco_check_ptr (pPool);
|
||||
|
||||
FastMutex::ScopedLock lock(_mutex);
|
||||
if (_sessionPools.find(pPool->name()) != _sessionPools.end())
|
||||
throw SessionPoolExistsException("Session pool already exists: " + pPool->name());
|
||||
|
||||
@ -79,8 +79,9 @@ Session SessionPoolContainer::add(const std::string& sessionKey,
|
||||
int maxSessions,
|
||||
int idleTime)
|
||||
{
|
||||
FastMutex::ScopedLock lock(_mutex);
|
||||
std::string name = SessionPool::name(sessionKey, connectionString);
|
||||
|
||||
FastMutex::ScopedLock lock(_mutex);
|
||||
SessionPoolMap::Iterator it = _sessionPools.find(name);
|
||||
|
||||
// pool already exists, silently return a session from it
|
||||
@ -108,6 +109,8 @@ SessionPool& SessionPoolContainer::getPool(const std::string& name)
|
||||
std::string path = uri.getPath();
|
||||
poco_assert (!path.empty());
|
||||
std::string n = Session::uri(uri.getScheme(), path.substr(1));
|
||||
|
||||
FastMutex::ScopedLock lock(_mutex);
|
||||
SessionPoolMap::Iterator it = _sessionPools.find(n);
|
||||
if (_sessionPools.end() == it) throw NotFoundException(n);
|
||||
return *it->second;
|
||||
|
Loading…
x
Reference in New Issue
Block a user