MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / lua_func

Function lua_func

lua/sp.c:7283–7305  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7281}
7282
7283void lua_func(sqlite3_context *context, int argc, sqlite3_value **argv)
7284{
7285 lua_func_arg_t *arg = sqlite3_user_data(context);
7286 struct sqlthdstate *thd = arg->thd;
7287 char *spname = arg->name;
7288 struct sqlclntstate *clnt = thd->sqlthd->clnt;
7289 char *err = NULL;
7290 struct sp_state state = {0};
7291 check_sp(spname, clnt, &state);
7292 int rc = lua_func_int(spname, &err, thd, clnt, context, argc, argv);
7293 if (rc != 0) {
7294 sqlite3_result_error(context, err, -1);
7295 } else {
7296 emit_sqlite_result(clnt, context);
7297 }
7298 free(err);
7299 if (state.sp) {
7300 close_sp(clnt);
7301 restore_sp(clnt, &state);
7302 } else {
7303 reset_sp(clnt->sp);
7304 }
7305}
7306
7307void *exec_trigger(char *spname)
7308{

Callers

nothing calls this directly

Calls 9

sqlite3_user_dataFunction · 0.85
check_spFunction · 0.85
lua_func_intFunction · 0.85
sqlite3_result_errorFunction · 0.85
emit_sqlite_resultFunction · 0.85
freeFunction · 0.85
close_spFunction · 0.85
restore_spFunction · 0.85
reset_spFunction · 0.85

Tested by

no test coverage detected