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

Function lua_final_int

lua/sp.c:7042–7054  ·  view source on GitHub ↗

TODO: This needs to be more robust - perhaps a hash table of Lua VMs per UDF * allowing us to invoke multiple UDFs per SQL statement. Also, test running * SQL stmts in a UDF, which invoke other UDFs. Does nesting work? */

Source from the content-addressed store, hash-verified

7040 * allowing us to invoke multiple UDFs per SQL statement. Also, test running
7041 * SQL stmts in a UDF, which invoke other UDFs. Does nesting work? */
7042static int lua_final_int(char *spname, char **err, struct sqlthdstate *thd,
7043 struct sqlclntstate *clnt, sqlite3_context *context)
7044{
7045 int rc, new_vm;
7046 if ((rc = setup_sp(spname, thd, clnt, &new_vm, err)) != 0) return rc;
7047 if (new_vm) {
7048 *err = "failed to obtain lua aggregate object";
7049 return -1;
7050 }
7051 Lua L = clnt->sp->lua;
7052 if ((rc = get_func_by_name(L, "final", err)) != 0) return rc;
7053 return run_func(clnt, 0, err, 1);
7054}
7055
7056static int lua_step_int(char *spname, char **err, struct sqlthdstate *thd,
7057 struct sqlclntstate *clnt, sqlite3_context *context,

Callers 1

lua_finalFunction · 0.85

Calls 3

setup_spFunction · 0.85
get_func_by_nameFunction · 0.85
run_funcFunction · 0.85

Tested by

no test coverage detected