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:
parent
52f5811461
commit
6cda931465
@ -24,6 +24,8 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef SQLPP_CONNECTION_POOL_H
|
||||
#define SQLPP_CONNECTION_POOL_H
|
||||
|
||||
@ -36,6 +38,7 @@
|
||||
#include <type_traits>
|
||||
#include <sqlpp11/exception.h>
|
||||
#include <sqlpp11/pool_connection.h>
|
||||
#include <sqlpp11/query_task.h>
|
||||
|
||||
namespace sqlpp
|
||||
{
|
||||
@ -206,6 +209,12 @@ namespace sqlpp
|
||||
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,
|
||||
|
Loading…
Reference in New Issue
Block a user