Closed stan1334 closed 2 years ago
template<class ... Args> inline void execSql(soci::session & sql, const std::string & strSql, Args &&...args) { try { if (0 < sizeof...(args)) //sql << strSql, args...; ??? int a = 10; else sql << strSql; } catch (soci_error const& e) { VLOG_E("HDCommon", "execSql what is {}", e.what()); } VLOG_D("HDCommon", "execSql {} over", strSql); }
SOCI_EXEC(sql, SELECT_MAX_EVENTID_SQL, into(maxEventID)); SOCI_EXEC(sql, SELECT_MAX_EVENTID_SQL, into(maxEventID), use(111)); SOCI_EXEC(sql, SELECT_MAX_EVENTID_SQL, into(maxEventID), into(test222), use(test111) );
//sql << strSql, args...; ???
@mloskot @tt4g
define SOCI_EXEC(sql, strSql, ...) execSql(sql, strSql, __VA_ARGS__)
SOCI_EXEC(sql, SELECT_MAX_EVENTID_SQL, into(maxEventID)); SOCI_EXEC(sql, SELECT_MAX_EVENTID_SQL, into(maxEventID), use(111)); SOCI_EXEC(sql, SELECT_MAX_EVENTID_SQL, into(maxEventID), into(test222), use(test111) );
//sql << strSql, args...; ???
@mloskot @tt4g