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

Method define

hdr/sqlite_modern_cpp.h:436–447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

434
435 template <typename Function>
436 void define(const std::string &name, Function&& func) {
437 typedef utility::function_traits<Function> traits;
438
439 auto funcPtr = new auto(std::forward<Function>(func));
440 if(int result = sqlite3_create_function_v2(
441 _db.get(), name.c_str(), traits::arity, SQLITE_UTF8, funcPtr,
442 sql_function_binder::scalar<traits::arity, typename std::remove_reference<Function>::type>,
443 nullptr, nullptr, [](void* ptr){
444 delete static_cast<decltype(funcPtr)>(ptr);
445 }))
446 errors::throw_sqlite_error(result);
447 }
448
449 template <typename StepFunction, typename FinalFunction>
450 void define(const std::string &name, StepFunction&& step, FinalFunction&& final) {

Callers 1

mainFunction · 0.80

Calls 1

throw_sqlite_errorFunction · 0.85

Tested by

no test coverage detected