0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-16 21:04:15 +08:00

Add operator() to create query task

This commit is contained in:
Frank Park 2017-04-09 18:32:30 -04:00
parent 52f5811461
commit 6cda931465

View File

@ -24,6 +24,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#pragma once
#ifndef SQLPP_CONNECTION_POOL_H #ifndef SQLPP_CONNECTION_POOL_H
#define SQLPP_CONNECTION_POOL_H #define SQLPP_CONNECTION_POOL_H
@ -36,6 +38,7 @@
#include <type_traits> #include <type_traits>
#include <sqlpp11/exception.h> #include <sqlpp11/exception.h>
#include <sqlpp11/pool_connection.h> #include <sqlpp11/pool_connection.h>
#include <sqlpp11/query_task.h>
namespace sqlpp namespace sqlpp
{ {
@ -206,6 +209,12 @@ namespace sqlpp
throw sqlpp::exception("Failed to spawn a new connection."); throw sqlpp::exception("Failed to spawn a new connection.");
} }
} }
template<typename Query, typename Lambda>
void operator()(Query query, Lambda callback)
{
query_task<connection_pool, Query, Lambda>(*this, query, callback)();
}
}; };
template<typename Connection_config, template<typename Connection_config,