| 7216 | } |
| 7217 | |
| 7218 | void lua_final(sqlite3_context *context) |
| 7219 | { |
| 7220 | lua_func_arg_t *arg = sqlite3_user_data(context); |
| 7221 | struct sqlthdstate *thd = arg->thd; |
| 7222 | char *spname = arg->name; |
| 7223 | struct sqlclntstate *clnt = thd->sqlthd->clnt; |
| 7224 | char *err = NULL; |
| 7225 | struct sp_state *state = sqlite3_aggregate_context(context, sizeof(*state)); |
| 7226 | if (state->sp == NULL) { |
| 7227 | // step never got called - no matching rows |
| 7228 | sqlite3_result_null(context); |
| 7229 | return; |
| 7230 | } |
| 7231 | if (state->sp != clnt->sp) { |
| 7232 | swap_sp(&clnt->sp, &state->sp); |
| 7233 | } |
| 7234 | int rc = lua_final_int(spname, &err, thd, clnt, context); |
| 7235 | if (rc != 0) { |
| 7236 | sqlite3_result_error(context, err, -1); |
| 7237 | } else { |
| 7238 | emit_sqlite_result(clnt, context); |
| 7239 | } |
| 7240 | free(err); |
| 7241 | if (state->sp == clnt->sp) { |
| 7242 | reset_sp(clnt->sp); |
| 7243 | } else { |
| 7244 | close_sp(clnt); |
| 7245 | restore_sp(clnt, state); |
| 7246 | } |
| 7247 | } |
| 7248 | |
| 7249 | void lua_step(sqlite3_context *context, int argc, sqlite3_value **argv) |
| 7250 | { |
nothing calls this directly
no test coverage detected