Author: wyoung
Date: Mon Jan 11 18:20:38 2010
New Revision: 2605
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=2605&view=rev
Log:
Added 'safe' parameter to ScopedConnection's ctor, defaulting to false
for previous behavior. When true, uses ConnectionPool::safe_grab()
instead of grab().
Modified:
trunk/lib/scopedconnection.cpp
trunk/lib/scopedconnection.h
Modified: trunk/lib/scopedconnection.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/scopedconnection.cpp?rev=2605&r1=2604&r2=2605&view=diff
==============================================================================
--- trunk/lib/scopedconnection.cpp (original)
+++ trunk/lib/scopedconnection.cpp Mon Jan 11 18:20:38 2010
@@ -29,9 +29,9 @@
namespace mysqlpp {
-ScopedConnection::ScopedConnection(ConnectionPool& pool) :
+ScopedConnection::ScopedConnection(ConnectionPool& pool, bool safe) :
pool_(pool),
-connection_(pool.grab())
+connection_(safe ? pool.safe_grab() : pool.grab())
{
}
Modified: trunk/lib/scopedconnection.h
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/scopedconnection.h?rev=2605&r1=2604&r2=2605&view=diff
==============================================================================
--- trunk/lib/scopedconnection.h (original)
+++ trunk/lib/scopedconnection.h Mon Jan 11 18:20:38 2010
@@ -55,7 +55,9 @@
/// \internal Note that there is no default ctor on purpose. RAII.
///
/// \param pool The ConnectionPool to use.
- explicit ScopedConnection(ConnectionPool& pool);
+ /// \param safe By default, we get the connection from the pool with
+ /// ConnectionPool::grab(), but we can call safe_grab() instead.
+ explicit ScopedConnection(ConnectionPool& pool, bool safe = false);
/// \brief Destructor
///
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits