From f3b9442c9fe85954d11b0a75bff99ae38e7900cd Mon Sep 17 00:00:00 2001 From: Frank Park Date: Tue, 11 Apr 2017 14:47:37 -0400 Subject: [PATCH] Add operator() to allow query with callback --- include/sqlpp11/pool_connection.h | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/include/sqlpp11/pool_connection.h b/include/sqlpp11/pool_connection.h index f4eea7dc..a668f926 100644 --- a/include/sqlpp11/pool_connection.h +++ b/include/sqlpp11/pool_connection.h @@ -57,6 +57,18 @@ namespace sqlpp } } + pool_connection(const pool_connection&) = delete; + pool_connection(pool_connection&& other) : _impl(std::move(other._impl)), origin(other.origin) + { + } + pool_connection& operator=(const pool_connection&) = delete; + pool_connection& operator=(pool_connection&& other) + { + _impl = std::move(other._impl); + origin = other.origin; + return *this; + } + template auto operator()(Args&&... args) -> decltype(_impl->args(std::forward(args)...)) { @@ -81,16 +93,10 @@ namespace sqlpp return _impl->prepare(t); } - pool_connection(const pool_connection&) = delete; - pool_connection(pool_connection&& other) : _impl(std::move(other._impl)), origin(other.origin) + template + void operator()(Query query, Lambda callback) { - } - pool_connection& operator=(const pool_connection&) = delete; - pool_connection& operator=(pool_connection&& other) - { - _impl = std::move(other._impl); - origin = other.origin; - return *this; + query_task(*origin, query, callback)(); } }; }