summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-12-29 02:29:04 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2015-12-29 06:00:07 +0000
commit65ed9ee3ea259432de6e82e89ad24e4b6b399840 (patch)
treeb6bef74f75deaef7d8f19eda0d8fb67c269e4a6c
parentAdd missing doxygen comments (diff)
downloadlibdbpp-65ed9ee3ea259432de6e82e89ad24e4b6b399840.tar.bz2
libdbpp-65ed9ee3ea259432de6e82e89ad24e4b6b399840.tar.xz
libdbpp-65ed9ee3ea259432de6e82e89ad24e4b6b399840.zip
Test a connection is suitably finished before adding back to the pool.
-rw-r--r--libdbpp/connectionPool.cpp6
-rw-r--r--libdbpp/connectionPool.h2
2 files changed, 8 insertions, 0 deletions
diff --git a/libdbpp/connectionPool.cpp b/libdbpp/connectionPool.cpp
index 24a78fa..9dc3a1c 100644
--- a/libdbpp/connectionPool.cpp
+++ b/libdbpp/connectionPool.cpp
@@ -19,6 +19,12 @@ namespace DB {
}
void
+ ConnectionPool::returnTestResource(const Connection * c) const
+ {
+ c->finish();
+ }
+
+ void
ConnectionPool::testResource(const Connection * c) const
{
c->ping();
diff --git a/libdbpp/connectionPool.h b/libdbpp/connectionPool.h
index c2ce950..859c269 100644
--- a/libdbpp/connectionPool.h
+++ b/libdbpp/connectionPool.h
@@ -20,6 +20,8 @@ namespace DB {
/// Create a new connection.
Connection * createResource() const override;
/// Ping a connection.
+ void returnTestResource(const Connection *) const override;
+ /// Ping a connection.
void testResource(const Connection *) const override;
private: