Last active
June 6, 2017 10:37
-
-
Save barkady/90c63a911403a21e743bf975d3b1c8fc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename... Ts> | |
void variadicExecutor(Ts&&...) {} | |
template<typename... TS> | |
bool execute(Poco::Data::Session& session, std::string sql, TS... Fargs) | |
{ | |
Poco::Data::Statement stmt = session << sql; | |
//because for `AbstractExtractors` `comma-operator` is covering this | |
//function. And behind the scene of `into` is exactly `AbstractExtractors`. | |
variadicExecutor(stmt.addExtract(Fargs)...); | |
stmt.execute(); | |
} | |
//Somewhere else | |
execute(session, query, | |
into(pHomer), | |
into(aBart), | |
into(pLisa)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment