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? */
| 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? */ |
| 7042 | static 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 | |
| 7056 | static int lua_step_int(char *spname, char **err, struct sqlthdstate *thd, |
| 7057 | struct sqlclntstate *clnt, sqlite3_context *context, |
no test coverage detected