MCPcopy Create free account
hub / github.com/SqliteModernCpp/sqlite_modern_cpp / final

Function final

hdr/sqlite_modern_cpp.h:976–993  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

974 typename Functions
975 >
976 inline void final(sqlite3_context* db) {
977 auto ctxt = static_cast<AggregateCtxt<ContextType>*>(sqlite3_aggregate_context(db, sizeof(AggregateCtxt<ContextType>)));
978 try {
979 if(!ctxt) return;
980 if(!ctxt->constructed) new(ctxt) AggregateCtxt<ContextType>();
981 store_result_in_db(db,
982 static_cast<Functions*>(sqlite3_user_data(db))->second(ctxt->obj));
983 } catch(sqlite_exception &e) {
984 sqlite3_result_error_code(db, e.get_code());
985 sqlite3_result_error(db, e.what(), -1);
986 } catch(std::exception &e) {
987 sqlite3_result_error(db, e.what(), -1);
988 } catch(...) {
989 sqlite3_result_error(db, "Unknown error", -1);
990 }
991 if(ctxt && ctxt->constructed)
992 ctxt->~AggregateCtxt();
993 }
994
995 template<
996 std::size_t Count,

Callers

nothing calls this directly

Calls 2

store_result_in_dbFunction · 0.85
get_codeMethod · 0.80

Tested by

no test coverage detected