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