Skip to content

Instantly share code, notes, and snippets.

@barkady
Last active June 6, 2017 10:37
Show Gist options
  • Save barkady/90c63a911403a21e743bf975d3b1c8fc to your computer and use it in GitHub Desktop.
Save barkady/90c63a911403a21e743bf975d3b1c8fc to your computer and use it in GitHub Desktop.
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