mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-27 02:53:10 +01:00
re-added customizeSession() method from 1.4.x releases
This commit is contained in:
@@ -160,6 +160,12 @@ public:
|
|||||||
/// Returns true if session pool is active (not shut down).
|
/// Returns true if session pool is active (not shut down).
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual void customizeSession(Session& session);
|
||||||
|
/// Can be overridden by subclass to perform custom initialization
|
||||||
|
/// of a newly created database session.
|
||||||
|
///
|
||||||
|
/// The default implementation does nothing.
|
||||||
|
|
||||||
typedef Poco::AutoPtr<PooledSessionHolder> PooledSessionHolderPtr;
|
typedef Poco::AutoPtr<PooledSessionHolder> PooledSessionHolderPtr;
|
||||||
typedef Poco::AutoPtr<PooledSessionImpl> PooledSessionImplPtr;
|
typedef Poco::AutoPtr<PooledSessionImpl> PooledSessionImplPtr;
|
||||||
typedef std::list<PooledSessionHolderPtr> SessionList;
|
typedef std::list<PooledSessionHolderPtr> SessionList;
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ Session SessionPool::get()
|
|||||||
{
|
{
|
||||||
Session newSession(SessionFactory::instance().create(_connector, _connectionString));
|
Session newSession(SessionFactory::instance().create(_connector, _connectionString));
|
||||||
applySettings(newSession.impl());
|
applySettings(newSession.impl());
|
||||||
|
customizeSession(newSession);
|
||||||
|
|
||||||
PooledSessionHolderPtr pHolder(new PooledSessionHolder(*this, newSession.impl()));
|
PooledSessionHolderPtr pHolder(new PooledSessionHolder(*this, newSession.impl()));
|
||||||
_idleSessions.push_front(pHolder);
|
_idleSessions.push_front(pHolder);
|
||||||
@@ -221,6 +222,11 @@ void SessionPool::applySettings(SessionImpl* pImpl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SessionPool::customizeSession(Session&)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SessionPool::putBack(PooledSessionHolderPtr pHolder)
|
void SessionPool::putBack(PooledSessionHolderPtr pHolder)
|
||||||
{
|
{
|
||||||
Poco::Mutex::ScopedLock lock(_mutex);
|
Poco::Mutex::ScopedLock lock(_mutex);
|
||||||
|
|||||||
Reference in New Issue
Block a user