summaryrefslogtreecommitdiff
path: root/libdbpp/connectionPool.cpp
blob: 24a78fade61a592051e7710e4ad2b2cc2dd703b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "connectionPool.h"
#include <resourcePool.impl.h>

template class AdHoc::ResourcePool<DB::Connection>;
template class AdHoc::ResourceHandle<DB::Connection>;

namespace DB {
	ConnectionPool::ConnectionPool(unsigned int m, unsigned int k, const std::string & t, const std::string & cs) :
		ResourcePool<Connection>(m, k),
		factory(ConnectionFactory::get(t)),
		connectionString(cs)
	{
	}

	Connection *
	ConnectionPool::createResource() const
	{
		return factory->create(connectionString);
	}

	void
	ConnectionPool::testResource(const Connection * c) const
	{
		c->ping();
	}
}